:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background-color);
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-card {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    min-width: 150px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card span {
    display: block;
    font-size: 2rem;
    font-weight: bold;
}

.form-container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
    transition: transform 0.3s ease;
}

.form-container:hover {
    transform: translateY(-2px);
}

h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--warning-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #d97706;
    transform: translateY(-2px);
}

.btn-archived {
    background-color: var(--text-secondary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-archived:hover {
    background-color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-back {
    background-color: var(--text-secondary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background-color: var(--text-primary);
    transform: translateX(-5px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
}

.ads-container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.ads-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.ads-list::-webkit-scrollbar {
    width: 8px;
}

.ads-list::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.ads-list::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

.ads-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

.ad-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: fit-content;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.ad-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* Previous Count Label */
.prev-count-container {
    margin-top: -10px;
    margin-bottom: 15px;
}

.prev-count-label {
    display: inline-block;
    background-color: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.ad-card h3 {
    color: var(--text-primary);
    margin-right: 100px;
    font-size: 1.2rem;
    line-height: 1.4;
    word-break: break-word;
    font-weight: 600;
}

.ad-card p {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.5;
}

.ad-card .links {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.ad-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: rgba(37, 99, 235, 0.1);
}

.ad-card a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.status-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 1;
    max-width: 100px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.status-indicator i {
    font-size: 0.9em;
}

.status-up {
    background-color: var(--success-color);
    color: white;
}

.status-down {
    background-color: var(--danger-color);
    color: white;
}

.status-unchanged {
    background-color: var(--warning-color);
    color: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalFadeIn 0.3s ease;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close:hover {
    color: var(--danger-color);
}

#historyContent {
    overflow-y: auto;
    max-height: calc(80vh - 100px);
    padding-right: 10px;
    margin-top: 20px;
}

#historyContent::-webkit-scrollbar {
    width: 8px;
}

#historyContent::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

#historyContent::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

#historyContent::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
    margin-bottom: 10px;
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-item:hover {
    background-color: var(--background-color);
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.history-ads {
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.button-group .btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.button-group .btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.button-group .btn-secondary {
    background-color: var(--warning-color);
    color: white;
}

.button-group .btn-secondary:hover {
    background-color: #d97706;
    transform: translateY(-2px);
}

.ad-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-update, .btn-history {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-update {
    background-color: var(--primary-color);
    color: white;
}

.btn-update:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-history {
    background-color: var(--text-secondary);
    color: white;
}

.btn-history:hover {
    background-color: var(--text-primary);
    transform: translateY(-2px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.sort-options {
    display: flex;
    gap: 10px;
}

.btn-sort {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sort.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-options {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--card-background);
    color: var(--text-primary);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--card-background);
    color: var(--text-primary);
    font-size: 0.9em;
    transition: all 0.3s ease;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .stats {
        flex-direction: column;
        width: 100%;
    }

    .stat-card {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
    }

    .sort-options {
        width: 100%;
        justify-content: center;
    }

    .ad-actions {
        flex-direction: column;
    }
    
    .btn-update, .btn-history {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }

    .filter-options {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-select, .search-input {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* AI Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

.chat-toggle {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    font-weight: 500;
}

.chat-toggle:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.chat-toggle i {
    font-size: 18px;
}

.chat-toggle-text {
    font-size: 14px;
}

.chat-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-container.open {
    display: flex;
}

.chat-container.maximized {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: auto;
    height: auto;
    z-index: 1001;
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-controls {
    display: flex;
    gap: 10px;
}

.chat-maximize, .chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.chat-maximize:hover, .chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message.user-message {
    align-items: flex-end;
}

.message.ai-message {
    align-items: flex-start;
}

.message-content {
    display: flex;
    gap: 10px;
    max-width: 80%;
}

.user-message .message-content {
    flex-direction: row-reverse;
}

.ai-message .message-content {
    flex-direction: row;
}

.message-content i {
    font-size: 16px;
    color: var(--primary-color);
    margin-top: 2px;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.user-message .message-time {
    text-align: right;
}

.ai-message .message-time {
    text-align: left;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

#chatForm {
    display: flex;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#sendButton {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

#sendButton:hover {
    background: var(--secondary-color);
}

#sendButton:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.typing-indicator {
    opacity: 0.7;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat message content styles for Markdown */
.chat-message-content {
    line-height: 1.5;
}

.chat-message-content h1,
.chat-message-content h2,
.chat-message-content h3,
.chat-message-content h4,
.chat-message-content h5,
.chat-message-content h6 {
    margin: 10px 0 5px 0;
    color: var(--text-primary);
    font-weight: 600;
}

.chat-message-content h1 { font-size: 1.4em; }
.chat-message-content h2 { font-size: 1.3em; }
.chat-message-content h3 { font-size: 1.2em; }
.chat-message-content h4 { font-size: 1.1em; }
.chat-message-content h5 { font-size: 1.0em; }
.chat-message-content h6 { font-size: 0.9em; }

.chat-message-content p {
    margin: 8px 0;
    color: var(--text-primary);
}

.chat-message-content ul,
.chat-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-message-content li {
    margin: 4px 0;
}

.chat-message-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 10px 0;
    padding: 10px 15px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 0 4px 4px 0;
}

.chat-message-content code {
    background: var(--light-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.chat-message-content pre {
    background: var(--light-gray);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--border-color);
}

.chat-message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.chat-message-content strong {
    font-weight: 600;
}

.chat-message-content em {
    font-style: italic;
}

.chat-message-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.chat-message-content a:hover {
    text-decoration: underline;
}

.chat-message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.chat-message-content th,
.chat-message-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.chat-message-content th {
    background: var(--light-gray);
    font-weight: 600;
}

.chat-message-content tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.chat-message-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.chat-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.chat-message-content .hljs {
    background: transparent !important;
}

/* Responsive design for chat */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
    }
    
    .chat-toggle {
        padding: 12px 16px;
    }
    
    .chat-toggle-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
    }
    
    .chat-toggle {
        padding: 10px 14px;
    }
    
    .chat-toggle-text {
        font-size: 12px;
    }
    
    .chat-message-content h1 { font-size: 1.3em; }
    .chat-message-content h2 { font-size: 1.2em; }
    .chat-message-content h3 { font-size: 1.1em; }
    .chat-message-content h4 { font-size: 1.0em; }
    .chat-message-content h5 { font-size: 0.9em; }
    .chat-message-content h6 { font-size: 0.8em; }
    
    .chat-message-content pre {
        font-size: 12px;
        padding: 10px;
    }
    
    .chat-message-content table {
        font-size: 12px;
    }
    
    .chat-message-content th,
    .chat-message-content td {
        padding: 6px 8px;
    }
}

/* Controles do histórico */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.btn-toggle {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

.btn-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.time-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-filters label {
    font-weight: 500;
    color: var(--text-primary);
}

.time-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-background);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.time-filters select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#chartContainer {
    margin-top: 20px;
    padding: 20px;
    background: var(--card-background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#historyChart {
    max-width: 100%;
    height: auto;
}

.modal-content.large {
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
} 