/* ============================================================================
   SCRAPER API DASHBOARD - ESTILOS INFONIS
   ============================================================================ */

:root {
    /* Paleta INFONIS - Azul Corporativo */
    --primary: #1e3a8a;        /* Azul oscuro corporativo */
    --primary-light: #3b82f6;  /* Azul brillante */
    --primary-dark: #1e40af;   /* Azul profundo */
    --accent: #ff6b35;         /* Naranja/coral vibrante */
    --accent-light: #ffa07a;   /* Naranja claro */
    
    /* Estados */
    --success: #10b981;        /* Verde éxito */
    --warning: #f59e0b;        /* Amarillo advertencia */
    --danger: #ef4444;         /* Rojo peligro */
    
    /* Grises */
    --dark: #1e293b;           /* Texto principal */
    --gray: #64748b;           /* Texto secundario */
    --light-gray: #f1f5f9;     /* Fondos claros */
    --white: #ffffff;          /* Blanco puro */
    
    /* Diseño */
    --radius: 12px;
    --shadow: 0 4px 6px rgba(30, 58, 138, 0.08);
    --shadow-lg: 0 10px 15px rgba(30, 58, 138, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #ff6b35 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 24px 0;
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title .logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 24px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-gray);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.healthy {
    background: var(--success);
}

.status-dot.degraded {
    background: var(--warning);
}

.status-dot.error {
    background: var(--danger);
}

.celery-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-gray);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
}

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

.status-dot-small.healthy {
    background: var(--success);
}

.status-dot-small.error {
    background: var(--danger);
}

.status-dot-small.warning {
    background: var(--warning);
}

/* Workers Info en Header */
.workers-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-gray);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
}

.workers-count {
    font-weight: 600;
}

.workers-count.healthy {
    color: var(--success);
}

.workers-count.warning {
    color: var(--warning);
    animation: pulse 2s ease-in-out infinite;
}

.btn-restart-workers {
    background: transparent;
    border: 2px solid var(--light-gray);
    color: var(--dark);
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 1;
    visibility: visible;
}

.btn-restart-workers:hover {
    background: var(--light-gray);
    transform: rotate(90deg) scale(1.1);
}

.btn-restart-workers.warning {
    border-color: var(--warning);
    color: var(--warning);
    animation: pulseRing 2s ease-in-out infinite;
}

.btn-restart-workers.warning:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.last-update {
    font-size: 13px;
    color: var(--gray);
}

/* Usuario y Logout */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light-gray);
    padding: 8px 16px;
    border-radius: 24px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

.btn-logout {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: var(--white);
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.2);
}

.btn-logout:hover {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 107, 53, 0.3);
}

.btn-logout:active {
    transform: translateY(0);
}

/* ============================================================================
   STATS OVERVIEW
   ============================================================================ */

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.stat-active {
    border-left-color: var(--accent);
}

.stat-card.stat-results {
    border-left-color: var(--primary-light);
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

/* ============================================================================
   TABS
   ============================================================================ */

.tabs-container {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
}

.tabs-nav {
    display: flex;
    background: linear-gradient(135deg, #f1f5f9 0%, #e0e7ff 100%);
    border-bottom: 2px solid var(--primary);
    padding: 8px;
    gap: 8px;
}

.tab-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray);
    position: relative;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary);
}

.tab-button.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-icon {
    font-size: 20px;
}

.tab-label {
    font-size: 15px;
}

.tabs-content {
    padding: 0;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 2px solid var(--primary-light);
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
}

.tab-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}

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

/* Legacy section styles (keep for modals and other uses) */
.section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-gray);
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}

/* ============================================================================
   SCRAPERS CONTAINER
   ============================================================================ */

.scrapers-container,
#configContainer,
#resultsContainer {
    padding: 28px;
}

.scrapers-container {
    display: grid;
    gap: 24px;
}

.scraper-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius);
    padding: 24px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.scraper-item:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.15);
}

.scraper-item.active {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: var(--success);
}

.scraper-item.failed {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: var(--danger);
}

.scraper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.scraper-title {
    flex: 1;
}

.scraper-title h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.scraper-title .technology {
    font-size: 13px;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 6px;
}

.scraper-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.scraper-status.inactive {
    background: #e5e7eb;
    color: #4b5563;
}

.scraper-status.running {
    background: #d1fae5;
    color: #065f46;
}

.scraper-status.completed {
    background: #dbeafe;
    color: #1e40af;
}

.scraper-status.failed {
    background: #fee2e2;
    color: #991b1b;
}

.scraper-description {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 16px;
    line-height: 1.6;
}

.scraper-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray);
    background: var(--white);
    padding: 8px 12px;
    border-radius: 8px;
}

.meta-item strong {
    color: var(--dark);
}

/* Progress Section */
.progress-section {
    margin: 20px 0;
    padding: 16px;
    background: var(--white);
    border-radius: 8px;
    display: none;
}

.progress-section.active {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #dbeafe 0%, #fef3c7 100%);
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.progress-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.progress-stats {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
}

/* Indicador de pulso animado */
.pulse-indicator {
    position: relative;
    width: 12px;
    height: 12px;
}

.pulse-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-dot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.75;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.95);
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 0.75;
    }
    50% {
        transform: scale(1.2);
        opacity: 0;
    }
    100% {
        transform: scale(0.95);
        opacity: 0;
    }
}

.progress-details {
    margin-top: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.detail-item {
    background: var(--white);
    padding: 10px 14px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item-full {
    grid-column: 1 / -1; /* Ocupar todo el ancho del grid */
}

.detail-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scraper Actions */
.scraper-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================================
   CONFIGURATION
   ============================================================================ */

.config-upload-area {
    padding: 20px;
}

.upload-placeholder {
    text-align: center;
    padding: 60px 40px;
    background: var(--light-gray);
    border: 2px dashed var(--gray);
    border-radius: var(--radius);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.upload-placeholder h3 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 8px;
}

.upload-placeholder p {
    color: var(--gray);
    margin-bottom: 24px;
}

.config-info-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius);
    padding: 24px;
    border-left: 4px solid var(--warning);
}

.config-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.config-meta {
    font-size: 13px;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.config-columns {
    margin: 16px 0;
    padding: 12px;
    background: var(--white);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray);
}

.config-columns strong {
    color: var(--dark);
}

.config-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ============================================================================
   RESULTS
   ============================================================================ */

.results-grid {
    display: grid;
    gap: 16px;
}

.result-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.result-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.1);
    transform: translateX(4px);
}

.result-info {
    flex: 1;
}

.result-filename {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray);
}

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

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

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

.btn-success:hover {
    background: #059669;
}

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

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

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
    border: 2px solid var(--gray);
}

.btn-secondary:hover {
    background: var(--gray);
    color: var(--white);
    border-color: var(--dark);
}

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

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    max-width: 540px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--gray);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--light-gray);
    color: var(--dark);
}

.modal-body {
    padding: 24px 28px;
}

.scraper-info-modal {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--light-gray);
    border-radius: 8px;
}

.scraper-info-modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.scraper-info-modal p {
    font-size: 14px;
    color: var(--gray);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: var(--white);
    border-radius: 8px;
    border: 2px solid var(--light-gray);
    transition: all 0.2s;
}

.checkbox-label:hover {
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--light-gray);
    outline: none;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.input-group span {
    font-weight: 600;
    color: var(--dark);
    min-width: 60px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--white);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-left-color: var(--success);
}

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

.toast.warning {
    border-left-color: var(--warning);
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
    font-size: 14px;
    color: var(--dark);
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ============================================================================
   LOADING & EMPTY STATES
   ============================================================================ */

.loading-spinner {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.preview-info {
    text-align: center;
    margin-bottom: 24px;
}

.preview-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.preview-placeholder {
    text-align: center;
    padding: 60px 20px;
    background: var(--light-gray);
    border-radius: 8px;
}

.preview-placeholder p {
    color: var(--gray);
    margin-bottom: 12px;
}

/* Preview Table */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-gray);
}

.preview-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.preview-header p {
    font-size: 14px;
    color: var(--gray);
}

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid var(--light-gray);
}

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

.preview-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    position: sticky;
    top: 0;
}

.preview-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.preview-table tbody tr {
    transition: background 0.2s;
}

.preview-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.preview-table tbody tr:hover {
    background: #e5e7eb;
}

.preview-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-gray);
}

.preview-table td:first-child {
    font-weight: 600;
    color: var(--dark);
}

/* Pagination */
/* Search Container */
.search-container {
    padding: 16px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--light);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--gray);
}

.search-indicator {
    background: var(--primary-light);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.btn-clear-search {
    position: absolute;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-clear-search:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-page {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--dark);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-page:hover:not(.active):not(:disabled) {
    background: var(--light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-page.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    cursor: default;
    font-weight: 600;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--gray);
    font-weight: 600;
}

.pagination-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    padding: 0 12px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-input {
        font-size: 16px; /* Prevenir zoom en iOS */
    }
    
    .pagination {
        gap: 4px;
    }
    
    .pagination-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-page {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .pagination-info {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
    
    .header-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .scraper-meta {
        grid-template-columns: 1fr;
    }
    
    .scraper-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    #toastContainer {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ============================================================================
   SCROLLBAR
   ============================================================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark);
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

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

.mt-2 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

/* ============================================================================
   INPUT READONLY
   ============================================================================ */

.input-readonly {
    background-color: #f3f4f6 !important;
    cursor: not-allowed !important;
    color: #6b7280 !important;
}

.input-readonly:focus {
    border-color: var(--light-gray) !important;
    box-shadow: none !important;
}

/* ============================================================================
   MODAL SMALL
   ============================================================================ */

.modal-small {
    max-width: 450px;
}

/* ============================================================================
   INFO MODAL
   ============================================================================ */

.info-detail {
    padding: 0;
}

.info-detail h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    background: var(--light-gray);
    border-radius: 8px;
}

.info-item.info-full {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    opacity: 0.7;
}

.info-value {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
}

/* ============================================================================
   WARNING MESSAGE
   ============================================================================ */

.warning-message {
    text-align: center;
    padding: 20px 0;
}

.warning-message p {
    margin: 10px 0;
    font-size: 15px;
    line-height: 1.6;
}

.warning-message strong {
    font-size: 16px;
    color: var(--dark);
}

.warning-note {
    margin-top: 16px;
    padding: 12px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    font-size: 14px;
    color: #92400e;
}

#stopScraperName {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin: 14px 0;
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    margin-bottom: 24px;
    border-radius: var(--radius);
    padding: 18px 24px;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--warning);
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.alert-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
}

.alert-message strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 6px;
}

.alert-message p {
    font-size: 14px;
    color: #78350f;
    margin: 0;
    line-height: 1.5;
}

.btn-warning {
    background: var(--warning);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

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

.status-dot.warning {
    background: var(--warning);
}

/* ============================================================================
   MONITOREO DE WORKERS
   ============================================================================ */

.monitoring-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 24px;
    margin-top: 24px;
}

.system-status-card,
.concurrency-control-card,
.workers-status-card,
.charts-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid #e2e8f0;
}

.system-status-card {
    grid-column: 1 / -1;
}

.concurrency-control-card {
    grid-column: 1 / -1;
}

.workers-status-card {
    grid-column: 1 / -1;
}

.charts-card {
    grid-column: 1 / -1;
}

.system-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.metric-label {
    font-weight: 600;
    color: var(--dark);
}

.metric-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 18px;
}

.concurrency-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.slider-container label {
    font-weight: 600;
    color: var(--dark);
    min-width: 120px;
}

#concurrency-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--light-gray);
    outline: none;
    -webkit-appearance: none;
}

#concurrency-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#concurrency-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 18px;
    min-width: 30px;
    text-align: center;
}

.concurrency-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.concurrency-info p {
    margin: 4px 0;
    color: var(--dark);
}

.workers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.worker-card {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
}

.worker-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.worker-card.active {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.worker-card.inactive {
    border-left-color: var(--gray);
    background: #f8fafc;
}

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

.worker-name {
    font-weight: 700;
    color: var(--dark);
    font-size: 16px;
}

.worker-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.worker-status.inactive {
    background: var(--gray);
    color: white;
}

.worker-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.worker-metric {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.worker-metric-label {
    color: var(--gray);
}

.worker-metric-value {
    font-weight: 600;
    color: var(--dark);
}

.worker-controls {
    display: flex;
    gap: 8px;
}

.worker-controls button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.worker-controls .btn-start {
    background: var(--success);
    color: white;
}

.worker-controls .btn-start:hover {
    background: #059669;
}

.worker-controls .btn-stop {
    background: var(--danger);
    color: white;
}

.worker-controls .btn-stop:hover {
    background: #dc2626;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 16px;
}

.chart-container {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 16px;
    position: relative;
    height: 300px;
}

.chart-container h4 {
    margin-bottom: 16px;
    color: var(--dark);
    font-size: 16px;
    font-weight: 600;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 250px;
    width: 100% !important;
    height: 250px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .monitoring-container {
        grid-template-columns: 1fr;
    }
    
    .system-metrics {
        grid-template-columns: 1fr;
    }
    
    .concurrency-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .slider-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .workers-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .chart-container canvas {
        height: 200px !important;
    }
}

/* Estilos adicionales para gráficos */
.chart-container {
    overflow: hidden;
}

.chart-container canvas {
    display: block;
    margin: 0 auto;
}

/* Indicador de modo desarrollo */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dev-mode-indicator {
    display: flex;
    align-items: center;
}

.dev-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.5);
    }
    100% {
        box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    }
}
