
:root {
    --bg-main: #F4F6F9;
    --bg-card: #ffffff;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border-color: #cbd5e1;
    --border-light: #f1f5f9;
    --border-medium: #e2e8f0;
    --bg-sidebar: #E9F0F8;
    --primary-color: #4F46E5;
}

body.dark-mode {
    --bg-main: #0f172a;
    --bg-card: #1E293B;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-light: #1E293B;
    --border-medium: #475569;
    --bg-sidebar: #0f172a;
    --primary-color: #6366f1;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #F4F6F9;
    color: #1E293B;
    -webkit-font-smoothing: antialiased;
}

.dashboard-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar (Light minimalist look consistent with dashboard) */
.sidebar {
    width: 280px;
    background-color: #E9F0F8;
    color: #1E293B;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #cbd5e1;
}

.sidebar-header {
    padding: 24px 20px;
    background-color: #E9F0F8;
    border-bottom: 1px solid #cbd5e1;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #10b981; /* Emerald/Green theme for pricing/store check */
    letter-spacing: -0.5px;
}

.sidebar-header p {
    font-size: 11px;
    font-weight: 600;
    color: #64748B;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-section {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.filter-section h3 {
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 700;
    color: #1E293B;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
}

.filter-group select, 
.filter-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #ffffff;
    color: #1E293B;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.filter-group select:focus, 
.filter-group input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn-filter, 
.btn-reset {
    width: 100%;
    padding: 10px 14px;
    margin-top: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-filter {
    background-color: #10b981;
    color: white;
}

.btn-filter:hover {
    background-color: #059669;
}

.btn-reset {
    background-color: #ef4444;
    color: white;
    margin-top: 8px;
}

.btn-reset:hover {
    background-color: #dc2626;
}

/* Contenido Principal */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    margin-bottom: 24px;
    border: 1px solid #f1f5f9;
}

.topbar h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1E293B;
    letter-spacing: -0.5px;
}

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

.btn {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-success {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.btn-success:hover {
    background-color: #dcfce7;
    border-color: #86efac;
}

.btn-secondary {
    background-color: #f8fafc;
    color: #334155;
    border-color: #e2e8f0;
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-pdf {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.btn-pdf:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

/* Carrusel de KPIs (Móvil) / Fila (Escritorio) */
.kpi-carousel-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    overflow: hidden;
}

.kpi-carousel-viewport {
    width: 100%;
}

.kpi-carousel-track {
    display: flex;
    gap: 20px;
}

.kpi-carousel-slide {
    display: contents; /* En escritorio, todos los cards actúan como hermanos */
}

/* Tarjetas Minimalistas Premium */
.kpi-card {
    flex: 1;
    background-color: #ffffff;
    padding: 24px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #f8fafc;
}

.kpi-card h3 {
    font-size: 11px;
    font-weight: 700;
    color: #64748B;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card p {
    font-size: 28px;
    font-weight: 800;
    color: #1E293B;
    line-height: 1.1;
    text-shadow: none !important;
}

.kpi-card small {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 500;
}

.kpi-card.interactive {
    cursor: pointer;
}

.kpi-card.interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    border-color: #e2e8f0;
}

/* Colores de acento minimalistas (sin fondos pesados) */
.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(1) h3 { color: #64748b; }
.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(1) p { color: #475569; }

.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(2) h3 { color: #3b82f6; }
.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(2) p { color: #2563eb; }

.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(3) h3 { color: #10b981; }
.kpi-carousel-slide:nth-child(1) .kpi-card:nth-child(3) p { color: #059669; }

.kpi-carousel-slide:nth-child(2) .kpi-card:nth-child(1) h3 { color: #f59e0b; }
.kpi-carousel-slide:nth-child(2) .kpi-card:nth-child(1) p { color: #d97706; }

.kpi-carousel-slide:nth-child(2) .kpi-card:nth-child(2) h3 { color: #8b5cf6; }
.kpi-carousel-slide:nth-child(2) .kpi-card:nth-child(2) p { color: #7c3aed; }

/* Ocultar paginación en escritorio */
.kpi-carousel-dots {
    display: none;
}

/* Grid del Contenido de Store Check */
.store-check-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: start;
}

.box-shadow {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

.table-section, 
.chart-section {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
}

.table-header, 
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.table-header h3, 
.chart-header h3 {
    color: #1E293B;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.search-box input {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    width: 200px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.chart-selector select {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    color: #1E293B;
    font-family: inherit;
}

.table-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, 
.data-table td {
    padding: 6px 8px; /* Compact padding */
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    text-shadow: none !important;
}

.data-table th {
    background-color: #2C3E50;
    color: #ffffff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 11px; /* Compact font size */
    color: #334155;
}

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

.canvas-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* Perfil de Usuario en Sidebar */
.sidebar-profile {
    padding: 20px;
    background-color: #E9F0F8;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-profile-name {
    color: #1E293B;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    word-break: break-all;
}

.sidebar-profile-company {
    color: #10b981;
    font-size: 11px;
    font-weight: 600;
    word-break: break-all;
}

/* Menú Hamburguesa en Móviles */
.storecheck-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 3998;
    background-color: #ffffff;
    color: #10b981;
    border: 1px solid #e2e8f0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.storecheck-menu-btn:hover {
    background-color: #f8fafc;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(2px);
    z-index: 3997;
}

/* Modales del Store Check (SaaS Clean Look) */
.modal-check {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 15px;
    box-sizing: border-box;
}

.modal-check-content {
    background-color: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 1050px;
    max-height: 92vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05), 0 10px 10px -5px rgba(0,0,0,0.02);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12px;
}

.modal-check-content h2,
.modal-check-content h3 {
    text-shadow: none !important;
}

.modal-check-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 18px;
    font-weight: 400;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
}

.modal-check-close:hover {
    color: #ef4444;
}

/* Responsividad para Celulares */
@media (max-width: 768px) {
    .dashboard-wrapper {
        display: block;
        height: auto;
        overflow: visible;
    }
    
    .sidebar {
        position: fixed;
        left: -285px;
        top: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        z-index: 4000;
        box-shadow: 10px 0 25px -5px rgba(0,0,0,0.05);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .storecheck-menu-btn {
        display: flex;
    }

    .main-content {
        padding: 12px;
        padding-top: 70px;
        padding-bottom: 110px;
        overflow-x: hidden;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .sidebar {
        padding-bottom: 20px;
    }

    .bottom-nav {
        display: flex;
    }

    .topbar {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        align-items: center;
        padding: 16px 12px;
    }

    .topbar h1 {
        font-size: 16px;
    }
    
    /* --- CARRUSEL MÓVIL (STORE CHECK) --- */
    .kpi-carousel-viewport {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; 
    }
    .kpi-carousel-viewport::-webkit-scrollbar {
        display: none;
    }

    .kpi-carousel-track {
        display: flex;
        flex-wrap: nowrap;
        gap: 0;
    }

    .kpi-carousel-slide {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        flex: 0 0 100%;
        scroll-snap-align: start;
        padding: 4px 2px;
        box-sizing: border-box;
    }

    /* Centrar última tarjeta (ej. Productos Monitoreados si no cuadra o Visitas Totales) */
    .kpi-carousel-slide .kpi-card:nth-child(odd):last-child {
        grid-column: span 2;
    }

    .kpi-card {
        padding: 18px 12px;
        min-height: 85px;
    }

    .kpi-card h3 {
        font-size: 11px;
    }

    .kpi-card p {
        font-size: 22px;
    }

    .kpi-carousel-dots {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 12px;
    }

    .kpi-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #cbd5e1;
        transition: background-color 0.3s ease;
    }

    .kpi-dot.active {
        background-color: #4F46E5;
        width: 20px;
        border-radius: 4px;
    }

    .kpi-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 15px 10px;
    }

    .kpi-card h3 {
        font-size: 10px;
    }

    .kpi-card p {
        font-size: 22px;
    }

    .store-check-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .table-section, 
    .chart-section {
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .table-header, 
    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
    }

    .search-box {
        width: 100%;
        margin-left: 0 !important;
    }

    .search-box input {
        width: 100%;
        box-sizing: border-box;
    }

    .canvas-container {
        height: 280px;
    }

    .modal-check-content {
        padding: 15px !important;
        width: 95% !important;
    }

    .sidebar {
        padding-bottom: 100px;
    }

    .bottom-nav {
        display: flex;
    }
}

/* --- BOTTOM NAVIGATION BAR (MÓVIL iOS STYLE) --- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.08);
    z-index: 5000;
    justify-content: space-around;
    align-items: flex-start;
    padding: 12px 10px 30px 10px;
    border-radius: 24px 24px 0 0;
    border: none;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    gap: 6px;
    position: relative;
    padding-top: 10px;
    flex: 1;
    filter: grayscale(100%) opacity(0.6);
    transition: all 0.3s ease;
}

.bottom-nav .nav-item .nav-icon {
    font-size: 22px;
}

.bottom-nav .nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 4px;
    border-radius: 0 0 4px 4px;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.bottom-nav .nav-item.active {
    color: #38bdf8;
    filter: none;
}

.bottom-nav .nav-item.active .nav-label {
    color: #38bdf8;
    font-weight: 600;
}

.bottom-nav .nav-item.active::before {
    background-color: #38bdf8;
}

.ios-home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    background-color: #000000;
    border-radius: 100px;
}

.dark-mode .bottom-nav {
    background-color: #1e293b;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.4);
}

.dark-mode .ios-home-indicator {
    background-color: #ffffff;
}

.dark-mode .bottom-nav .nav-item {
    color: #64748b;
}

.dark-mode .bottom-nav .nav-item.active .nav-label {
    color: #38bdf8;
}

@media (max-width: 1024px) {
    .bottom-nav {
        display: flex;
    }
}
