/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1877f2;
    --primary-dark: #0c5fc7;
    --secondary: #42b72a;
    --danger: #e4405f;
    --warning: #ffa500;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --text: #050505;
    --text-secondary: #65676b;
    --border: #dadde1;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* Header */
header {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    text-align: center;
}

header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--surface);
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab:hover {
    background: var(--bg);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-content.active {
    display: block;
}

/* Form */
.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 20px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--surface);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.1);
}

small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

small.warning {
    color: var(--danger);
    font-weight: 600;
}

/* Info Box */
.info-box {
    background: #e7f3ff;
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-box strong {
    color: var(--primary);
}

#total-budget {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

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

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.log-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.log-clear-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.log-clear-controls label {
    font-weight: 600;
    color: #333;
}

.log-clear-controls select,
.log-clear-controls input[type="datetime-local"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.batch-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
    flex-wrap: wrap;
}

.hint-box {
    background: #f7f7fb;
    border-left: 4px solid var(--primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #444;
}

#jobs-upload-result {
    margin-top: 10px;
    font-size: 0.95rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg);
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s;
}

#progress-log {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Stats */
#stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Logs */
#logs-container {
    margin-top: 20px;
}

.log-section-title {
    margin: 20px 0 10px;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.log-entry {
    background: var(--bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
}

.log-entry.success {
    border-left-color: var(--secondary);
}

.log-entry.error {
    border-left-color: var(--danger);
}

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

.log-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.log-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.log-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.log-detail {
    font-size: 0.875rem;
}

.log-detail strong {
    color: var(--primary);
}

.log-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.log-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.log-toggle {
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.log-toggle:hover {
    background: var(--primary);
    color: white;
}

.log-stop {
    border: 1px solid var(--danger);
    background: transparent;
    color: var(--danger);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.log-stop:hover {
    background: var(--danger);
    color: white;
}

.log-error {
    margin-top: 10px;
    padding: 10px;
    background: #ffe7e7;
    border-radius: 6px;
    color: var(--danger);
}

.log-error-detail {
    margin-top: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
}

.log-error-detail summary {
    cursor: pointer;
    font-weight: 600;
}

.log-error-detail pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    margin-top: 6px;
}

.log-steps {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
    display: none;
}

.log-steps.open {
    display: block;
}

.log-step {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.85rem;
}

.log-step:last-child {
    border-bottom: none;
}

.log-step-time {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.8rem;
}

.log-step-text {
    color: var(--text);
}

.log-step-empty {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Config Section */
.config-section {
    margin-bottom: 40px;
}

.config-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}
/* ========== MONITOR TABLE - Adicione no final do style.css ========== */

/* Monitor Controls */
.monitor-controls {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Monitor Summary */
.monitor-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Monitor Table */
#monitor-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.monitor-table thead {
    background: #f3f4f6;
}

.page-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-ok {
    background: #16a34a;
}

.dot-danger {
    background: #dc2626;
}

.status-text {
    font-weight: 600;
    font-size: 0.9rem;
}

.status-success {
    color: #16a34a;
}

.status-danger {
    color: #dc2626;
}

.limit-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.limit-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.limit-save {
    padding: 6px 10px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.limit-save:hover {
    background: var(--primary);
    color: white;
}

.page-id {
    font-family: monospace;
    font-size: 0.85rem;
}

.monitor-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.monitor-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.monitor-table tbody tr:hover {
    background: #f9fafb;
}

.monitor-table td {
    padding: 12px 16px;
    color: #1f2937;
}

.text-center {
    text-align: center !important;
}

.page-name {
    font-weight: 500;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.value-active {
    color: #10b981;
    font-weight: 600;
}

.value-paused {
    color: #f59e0b;
    font-weight: 600;
}

.value-available {
    font-weight: 600;
    color: #2563eb;
}

.value-available.low {
    color: #ef4444;
}

/* Status */
.status-ok {
    color: #10b981;
}

.status-warning {
    color: #f59e0b;
}

.status-critical {
    color: #ef4444;
}

/* Usage Bar */
.usage-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin: 4px 0;
}

.usage-fill {
    height: 100%;
    transition: width 0.3s;
}

.usage-fill.status-ok {
    background: #10b981;
}

.usage-fill.status-warning {
    background: #f59e0b;
}

.usage-fill.status-critical {
    background: #ef4444;
}

/* Error Row */
.error-row {
    background: #fef2f2;
}

.error-cell {
    color: #991b1b;
    font-size: 12px;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .monitor-table {
        font-size: 12px;
    }
    
    .monitor-table th,
    .monitor-table td {
        padding: 8px 12px;
    }
}/* ADICIONAR NO frontend/css/style.css */

/* ========================================
   PUBLISHER SELECTOR
======================================== */
.publisher-selector {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.publisher-dropdown-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.publisher-dropdown-wrapper label {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.publisher-select {
    flex: 1;
    max-width: 300px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.publisher-select:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: white;
}

.publisher-select:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.publisher-select option {
    padding: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========================================
   PUBLISHERS LIST
======================================== */
.publishers-list {
    margin-top: 20px;
}

.publisher-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
}

.publisher-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.publisher-card.default {
    border-color: #4CAF50;
    background: #f1f8f4;
}

.publisher-card.inactive {
    opacity: 0.6;
    background: #f5f5f5;
}

.publisher-color-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.publisher-info {
    flex: 1;
}

.publisher-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.publisher-badge {
    background: #4CAF50;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.publisher-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    flex-wrap: wrap;
}

.publisher-id {
    font-size: 12px;
    color: #555;
}

.btn-copy {
    border: 1px solid #ccc;
    background: #f7f7f7;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.btn-copy:hover {
    background: #eee;
}

.publisher-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.publisher-token-preview {
    font-family: monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    display: inline-block;
}

.publisher-actions {
    display: flex;
    gap: 8px;
}

.publisher-actions button {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: #2196F3;
    color: white;
}

.btn-edit:hover {
    background: #1976D2;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-toggle {
    background: #FF9800;
    color: white;
}

.btn-toggle:hover {
    background: #F57C00;
}

/* ========================================
   FORM MODAL
======================================== */
.modal-small {
    max-width: 500px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group input[type="color"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
    font-size: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
}

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-row .toggle-label {
    font-weight: 600;
    color: #333;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ========================================
   MODAL ACTIONS
======================================== */
.modal-actions {
    margin-bottom: 20px;
}
