:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #0b172a; /* Fondo azul oscuro para los marcos */
    color: var(--text-color);
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Fallback overlay (ya no se usa a nivel de body) */
body::before {
    display: none;
}

.background-elements {
    display: none;
}
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: -100px;
    left: -100px;
}

.circle-2 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    bottom: -50px;
    right: -50px;
}

.glass-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Imagen de fondo confinada al contenedor */
.glass-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('assets/9R1A3884.JPG') no-repeat center center;
    background-size: cover;
    z-index: -2;
    filter: blur(3px); /* Blur reducido para que la imagen se vea más */
    transform: scale(1.02); /* Escala menor */
}

/* Capa oscura sobre la imagen para legibilidad */
.glass-container::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.25); /* Overlay más transparente */
    z-index: -1;
}

header.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    margin-bottom: 2.5rem;
    gap: 2rem;
}

header.main-header .header-content {
    flex: 1;
}

.logo {
    max-width: 120px; /* Tamaño reducido para la esquina */
    height: auto;
    margin-bottom: 1.5rem;
    filter: brightness(0) invert(1) drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #6bf1b6, #6970f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(73, 82, 232, 0.2); /* Sutil brillo para que resalte más */
}

header p {
    color: #94a3b8;
    font-size: 1.1rem;
}

.drop-zone {
    width: 100%;
    height: 200px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    border: 2px dashed #475569;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.drop-zone .icon {
    color: #94a3b8;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.drop-zone:hover .icon {
    color: var(--primary-color);
}

.drop-zone__prompt {
    font-size: 1.2rem;
    font-weight: 500;
    color: #cbd5e1;
}

.drop-zone__input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.dashboard {
    margin-top: 3rem;
    animation: fadeIn 0.5s ease;
}

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

.summary-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.cards-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.top-cards .card,
.bottom-cards .card {
    flex: 1;
    min-width: 200px;
    max-width: 33%;
}

.card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, border-color 0.4s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.card.warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.card.danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.card.success::before { background: linear-gradient(90deg, #10b981, #34d399); }

/* Tarjetas verdes (fila superior) */
.card-green {
    background: rgba(38, 217, 140, 0.12); /* Nuevo verde brillante */
    border-color: rgba(38, 217, 140, 0.35);
}
.card-green::before { background: linear-gradient(90deg, #26d98c, #38ef9e); }
.card-green .number { color: #6bf1b6; }

/* Tarjetas moradas (fila inferior) */
.card-purple {
    background: rgba(73, 82, 232, 0.12); /* Nuevo morado/azul vibrante */
    border-color: rgba(73, 82, 232, 0.35);
}
.card-purple::before { background: linear-gradient(90deg, #4952e8, #6970f5); }
.card-purple .number { color: #a1a6ff; }

/* Icono de tarjeta */
.card-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.card-icon svg {
    width: 24px;
    height: 24px;
    opacity: 0.7;
}

.card-green .card-icon svg { color: #26d98c; }
.card-purple .card-icon svg { color: #6970f5; }

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card .number {
    font-size: 2rem;
    font-weight: 700;
}

.card.warning .number { color: var(--warning-color); }
.card.danger .number { color: var(--danger-color); }
.card.success .number { color: var(--success-color); }

.actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.category-tables h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #f8fafc;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.category-tables h2::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 32px;
    background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 500;
}

.filter-group select,
.filter-group input[type="text"] {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    border-color: var(--primary-color);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    margin-top: 1.2rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    margin-top: 0;
}

.table-container {
    margin-bottom: 2.5rem;
}

.table-container h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #94a3b8;
}

.table-wrapper {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: #cbd5e1;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr.cancelled-row {
    background: rgba(239, 68, 68, 0.15) !important;
}

tbody tr.cancelled-row:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

tbody tr.promo-guia-row {
    background: rgba(56, 189, 248, 0.15) !important;
}

tbody tr.promo-guia-row:hover {
    background: rgba(56, 189, 248, 0.25) !important;
}

tbody tr.inferred-row {
    background: rgba(20, 184, 166, 0.1) !important;
    border-left: 3px solid rgba(20, 184, 166, 0.6);
}

tbody tr.inferred-row:hover {
    background: rgba(20, 184, 166, 0.2) !important;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge.yes {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.no {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .glass-container {
        padding: 1.5rem;
    }
    header h1 {
        font-size: 2rem;
    }
}

/* ── Tab Navigation ─────────────────────────────────────── */
.tab-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 8px 8px 0 0;
}

.tab-btn:hover { color: #f8fafc; }

.tab-btn.active {
    color: #f8fafc;
    border-bottom-color: #3b82f6;
    background: rgba(59,130,246,0.08);
}

.tab-actions { margin-left: auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Activity Analysis Tab ──────────────────────────────── */
.activity-header {
    margin-bottom: 2rem;
}

.activity-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.8rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.activity-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.activity-header-top .search-group {
    flex: 1;
    max-width: 400px;
    margin-bottom: 0;
}

.activity-header p { color: #94a3b8; }

.activity-grid { /* wrapper for the matrix */ }

/* ── Matrix Table ─────────────────────────────────────────── */
.matrix-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 600px;
}

.matrix-table thead tr {
    background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(139,92,246,0.2));
}

.matrix-table thead th {
    padding: 0.85rem 0.75rem;
    text-align: center;
    font-weight: 600;
    color: #93c5fd;
    border-bottom: 2px solid rgba(59,130,246,0.4);
    white-space: nowrap;
}

.matrix-product-col {
    text-align: left !important;
    min-width: 220px;
    position: sticky;
    left: 0;
    background: rgba(20,30,48,0.95) !important;
    z-index: 2;
    color: #f1f5f9 !important;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.matrix-hour-col {
    min-width: 70px;
    font-size: 0.82rem;
}

.matrix-total-col {
    min-width: 90px;
    background: rgba(16,185,129,0.08) !important;
    color: #6ee7b7 !important;
    border-left: 1px solid rgba(16,185,129,0.2);
}

.matrix-row {
    transition: background 0.15s;
}

.matrix-row:hover {
    background: rgba(255,255,255,0.04) !important;
}

.matrix-row:hover .matrix-product-name {
    color: #93c5fd;
}

.matrix-product-name {
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    font-weight: 500;
    text-align: left;
    position: sticky;
    left: 0;
    background: rgba(15,23,42,0.95);
    z-index: 1;
    border-right: 1px solid rgba(255,255,255,0.05);
    transition: color 0.2s;
}

.matrix-cell {
    padding: 0.65rem 0.5rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s;
    font-size: 0.9rem;
}

.matrix-total {
    padding: 0.65rem 0.75rem;
    text-align: center;
    font-weight: 700;
    color: #6ee7b7;
    background: rgba(16,185,129,0.06);
    border-left: 1px solid rgba(16,185,129,0.15);
    font-size: 0.9rem;
}

/* Fila de totales (tfoot) */
.matrix-footer {
    background: rgba(59,130,246,0.12) !important;
    border-top: 2px solid rgba(59,130,246,0.4);
}

.matrix-footer .matrix-product-name {
    background: rgba(20,30,60,0.95);
    color: #93c5fd;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.matrix-footer-cell {
    color: #f8fafc !important;
    background: rgba(59,130,246,0.15) !important;
    border-left: 1px solid rgba(59,130,246,0.2) !important;
}

/* Zebra rows */
.matrix-table tbody tr:nth-child(even) .matrix-product-name {
    background: rgba(20,30,50,0.95);
}
.matrix-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

/* ── Sophisticated Dark Mode (After File Upload) ─────────────────────── */
body.dashboard-active {
    background-color: #040914; /* Fondo oscuro muy elegante */
}

body.dashboard-active .glass-container {
    background: #0b1121; /* Contenedor oscuro sólido sin transparencias */
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

body.dashboard-active .glass-container::before,
body.dashboard-active .glass-container::after {
    display: none; /* Ocultar foto al subir archivo */
}

/* Ajustes de tablas base para modo oscuro */
body.dashboard-active .table-wrapper,
body.dashboard-active .filters-bar,
body.dashboard-active .activity-card {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.05);
}

/* Acentos del Nuevo Morado en Modo Oscuro */
body.dashboard-active .tab-btn.active {
    color: #c4c8ff;
    border-bottom-color: #4952e8;
    background: rgba(73, 82, 232, 0.1);
}

body.dashboard-active th {
    background: rgba(73, 82, 232, 0.12); /* Morado sutil */
    color: #a1a6ff;
    border-bottom: 2px solid rgba(73, 82, 232, 0.3);
}

body.dashboard-active .matrix-table thead tr {
    background: rgba(73, 82, 232, 0.12);
}

body.dashboard-active .matrix-table thead th {
    color: #a1a6ff;
    border-bottom-color: rgba(73, 82, 232, 0.3);
}

body.dashboard-active .horario-pill {
    background: rgba(73, 82, 232, 0.15);
    border-color: rgba(73, 82, 232, 0.3);
}

body.dashboard-active .horario-time {
    color: #a1a6ff;
}

body.dashboard-active tbody tr.promo-guia-row {
    background: rgba(73, 82, 232, 0.08) !important;
}

body.dashboard-active tbody tr.inferred-row {
    background: rgba(45, 212, 191, 0.1) !important; /* Mantenemos el turquesa para los inferidos */
}

body.dashboard-active tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}
body.dashboard-active tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}
