/* 
   Aloha POS Combos Dashboard Style Sheet
   Design Style: Papa John's Corporate Light Theme (Modern UI)
*/

:root {
    --bg-primary: #f3f4f6;     /* Light grey background */
    --bg-secondary: #ffffff;   /* Card background */
    --glass-bg: #ffffff;
    --glass-border: rgba(0, 104, 71, 0.15); /* Sutil PJ Green border */
    
    --text-primary: #111827;   /* Dark grey/black for readability */
    --text-secondary: #4b5563; /* Medium grey */
    --text-muted: #6b7280;     /* Muted grey */
    
    /* Papa John's Corporate Palette */
    --primary: #006847;       /* PJ Green */
    --primary-glow: rgba(0, 104, 71, 0.15);
    --secondary: #DF1937;     /* PJ Red */
    --secondary-glow: rgba(223, 25, 55, 0.15);
    --emerald: #10b981;
    --rose: #DF1937;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background overlay (soft lights) */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 104, 71, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(223, 25, 55, 0.03) 0%, transparent 40%),
        var(--bg-primary);
}

/* Light Theme Card Style */
.glassmorphism {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

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

.logo-icon {
    font-size: 32px;
    color: var(--primary);
    filter: drop-shadow(0 2px 4px var(--primary-glow));
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text h1 span {
    color: var(--primary);
    margin-left: 4px;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
    font-weight: 600;
}

.db-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(0, 104, 71, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(0, 104, 71, 0.1);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
}

/* Filters Panel - Corrected to Flexbox to prevent overlap */
.filters-panel {
    padding: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.filter-group {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input, 
.filter-group select {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    width: 100%;
}

.filter-group input:focus, 
.filter-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.filter-group select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.group-by-container {
    flex: 1 2 280px;
    min-width: 260px;
}

.toggle-buttons {
    display: flex;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

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

.toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.filter-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    min-width: 120px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #005036;
    box-shadow: 0 6px 18px rgba(0, 104, 71, 0.35);
}

.btn-secondary {
    background: var(--secondary);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--secondary-glow);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: #c3132e;
    box-shadow: 0 6px 18px rgba(223, 25, 55, 0.35);
}

/* KPIs Container */
.kpis-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 768px) {
    .kpis-container {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.icon-green {
    background: rgba(0, 104, 71, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 104, 71, 0.15);
}

.icon-red {
    background: rgba(223, 25, 55, 0.08);
    color: var(--secondary);
    border: 1px solid rgba(223, 25, 55, 0.15);
}

.icon-white {
    background: rgba(107, 114, 128, 0.08);
    color: #374151;
    border: 1px solid rgba(107, 114, 128, 0.15);
}

.kpi-info h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.kpi-value-container {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Sections headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.section-header h2 i {
    color: var(--primary);
}

.badge {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--text-secondary);
}

/* Chart Trend */
.chart-section {
    padding: 24px;
}

.chart-container {
    position: relative;
    height: 340px;
    width: 100%;
}

/* Custom Scrollbars */
.table-container::-webkit-scrollbar,
.checks-table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-thumb,
.checks-table-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.checks-table-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Data Table Section */
.table-section {
    padding: 24px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
    background: #ffffff;
}

.data-table th,
.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-primary);
}

.data-table th {
    background: #f9fafb;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

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

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

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

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-purple {
    color: var(--primary);
    font-weight: 700;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 104, 71, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    box-shadow: 0 0 15px var(--primary-glow);
}

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

.spinner-container p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Keyframes pulse */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(0.9); }
}

/* Seccion Detalle de Facturas */
.checks-table-container {
    max-height: 480px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.check-row-header {
    cursor: pointer;
    background: #ffffff;
    transition: var(--transition);
}

.check-row-header:hover {
    background: #f9fafb !important;
}

.check-row-header.expanded-row {
    background: rgba(0, 104, 71, 0.05) !important;
}

.check-row-header.expanded-row i {
    transform: rotate(180deg);
    color: var(--primary);
}

.check-badge {
    background: rgba(0, 104, 71, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 104, 71, 0.2);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.check-combo {
    font-size: 11.5px;
    color: var(--secondary);
    background: rgba(223, 25, 55, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(223, 25, 55, 0.12);
    font-weight: 600;
}

.check-details-row {
    background: #f9fafb !important;
    border-left: 4px solid var(--primary);
}

.check-details-wrapper {
    padding: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

.check-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.check-items-table th,
.check-items-table td {
    padding: 8px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-primary);
}

.check-items-table th {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f3f4f6;
}

.check-items-table tbody tr:last-child td {
    border-bottom: none;
}

.item-type-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
}

.item-type-badge.principal {
    background: rgba(0, 104, 71, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 104, 71, 0.2);
}

.item-type-badge.modificador {
    background: #e5e7eb;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.no-data-msg {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 13.5px;
    background: #ffffff;
}

/* Cuadrícula de 3 columnas para los KPIs intermedios */
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Cuadrícula de 2 columnas para distribución de gráficos */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }
}

.ranking-section {
    padding: 24px;
}

/* Navigation Tabs */
.app-tabs {
    display: flex;
    gap: 12px;
    border-bottom: 2px solid rgba(0, 104, 71, 0.1);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border-radius: 8px;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(0, 104, 71, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 4px 6px -1px var(--primary-glow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Systematic Specific CSS */
.kpis-sistematica {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .kpis-sistematica {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kpis-sistematica {
        grid-template-columns: 1fr;
    }
}

.meta-slider-group {
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.meta-slider-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.meta-slider-group input {
    width: 60px;
    text-align: center;
    padding: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

/* Expandable systematic table styles */
.data-table tr.category-row {
    background-color: rgba(0, 104, 71, 0.03);
    cursor: pointer;
    font-weight: 700;
}

.data-table tr.category-row:hover {
    background-color: rgba(0, 104, 71, 0.08);
}

.data-table tr.agent-subrow {
    background-color: #ffffff;
}

.data-table tr.agent-subrow td:first-child {
    padding-left: 32px;
}

/* Semaphoric rules */
.cell-green {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.cell-red {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.cell-yellow {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.cell-pastel-green {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.cell-pastel-yellow {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.cell-pastel-red {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

/* Login styling */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #0c3e23 0%, #001f11 100%);
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    text-align: center;
    backdrop-filter: blur(10px);
}

.login-logo h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    color: var(--primary);
    margin: 8px 0 4px 0;
    font-weight: 800;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-form .filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 104, 71, 0.1);
}

.login-error {
    text-align: left;
    margin-bottom: 8px;
}

/* Logout button in header */
.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    height: 32px;
}

.logout-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

/* ==========================================================================
   ESTILOS DE TÍTULOS CLAROS, SUBTÍTULOS EXPLICATIVOS Y FUENTES DE INFORMACIÓN
   ========================================================================== */
.section-header h2, .chart-header h2, .table-header h2, .section-title {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
    font-size: 17px !important;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px !important;
}

.section-subtitle, .card-subtitle, .chart-subtitle, .table-subtitle {
    font-family: 'Inter', sans-serif !important;
    font-size: 12.5px !important;
    font-weight: 400 !important;
    color: #64748b !important;
    margin-top: 2px !important;
    margin-bottom: 14px !important;
    line-height: 1.4 !important;
}

/* Etiqueta de Fuente de Datos al pie de cada tarjeta o tabla */
.card-source-footer {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    background: rgba(0, 104, 71, 0.06) !important;
    border: 1px solid rgba(0, 104, 71, 0.14) !important;
    border-radius: 6px !important;
    padding: 5px 12px !important;
    margin-top: 14px !important;
    width: fit-content !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
}

.card-source-footer i {
    font-size: 12px !important;
}

.card-source-footer.excel-source {
    background: rgba(16, 124, 65, 0.07) !important;
    border-color: rgba(16, 124, 65, 0.18) !important;
    color: #107c41 !important;
}

.card-source-footer.biable-source {
    background: rgba(37, 99, 235, 0.07) !important;
    border-color: rgba(37, 99, 235, 0.18) !important;
    color: #2563eb !important;
}


