:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --bg-light: #f8f9fa;
    --font-display: 'Outfit', sans-serif;
    --font-main: 'Inter', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
}

h1, h2, h3, h4, .font-display {
    font-family: var(--font-display);
}

.sidebar {
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    .sidebar {
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .sidebar .position-sticky {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }
}

.nav-link {
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link.active {
    box-shadow: 0 4px 6px rgba(13, 110, 253, 0.2);
}

.card {
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.initial-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid var(--bg-light);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.backdrop-blur {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bg-slide {
    transition: opacity 1s ease-in-out !important;
}

.bg-slide.active {
    opacity: 1 !important;
}

.bg-slide:not(.active) {
    opacity: 0 !important;
}

.landing-wrapper {
    background: transparent;
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.overlay {
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.5) 100%);
}

#contact-section {
    position: relative;
    z-index: 10;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}



/* Estilos de Impresión v3 - Fix Extra Pages */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    html, body {
        width: 210mm;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        overflow: visible !important;
    }

    .no-print, 
    .sidebar, 
    .navbar, 
    nav,
    .btn, 
    button,
    #report-back-btn,
    .no-print-area,
    .modal-header,
    .modal-footer {
        display: none !important;
    }
    
    #app, .main-content, .container-fluid, .p-4, .bg-light, .min-vh-100 {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        min-height: 0 !important;
        background: none !important;
    }
    
    .d-flex.flex-column.gap-5 {
        gap: 0 !important;
    }
    
    .report-sheet {
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        display: block !important;
        position: relative !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        page-break-after: always !important;
    }

    /* Prevent blank page at the end */
    .report-sheet:last-child {
        page-break-after: auto !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* --- MODO APP (STANDALONE) --- */
/* Forzamos el diseño mediante una clase en el body inyectada por JS */
body.is-app-mode {
    overflow-x: hidden;
}

body.is-app-mode #sidebarMenu {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    flex: 0 0 80px !important;
    padding: 15px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    left: 0 !important;
    position: fixed !important;
    z-index: 1050 !important;
}

body.is-app-mode .nav-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 60px !important;
    height: 60px !important;
    padding: 0 !important;
    margin: 10px 0 !important;
    border-radius: 15px !important;
    background: #f8f9fa !important;
    color: #555 !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
}

body.is-app-mode .nav-link i, 
body.is-app-mode .nav-link svg {
    width: 28px !important;
    height: 28px !important;
}

body.is-app-mode .nav-link.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4) !important;
}

/* Ocultar ruidos visuales */
body.is-app-mode .text-uppercase,
body.is-app-mode hr,
body.is-app-mode #sidebar-widget,
body.is-app-mode .p-4.border-bottom .x-small,
body.is-app-mode .nav-link span:not(.badge) {
    display: none !important;
}

body.is-app-mode .sidebar .p-4.border-bottom {
    padding: 0 !important;
    border: none !important;
    margin-bottom: 20px !important;
}

body.is-app-mode .sidebar img {
    height: 40px !important;
    width: 40px !important;
}

/* FIX DEFINITIVO DE POSICIONAMIENTO */
body.is-app-mode main.main-content {
    margin-left: 80px !important;
    padding-left: 30px !important;
    padding-right: 30px !important;
    width: calc(100% - 80px) !important;
    max-width: none !important;
    flex: 0 0 calc(100% - 80px) !important;
}

/* Ocultar Sidebar solo en el Dashboard de la App */
body.is-app-mode.on-dashboard #sidebarMenu {
    display: none !important;
}
body.is-app-mode.on-dashboard main.main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Visual Board Grid */
.visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.visual-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1.1 / 1;
    border-radius: 32px;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
    border: 2px solid rgba(255,255,255,0.5);
}

.visual-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.08);
}

.visual-tile:active {
    transform: scale(0.95);
}

.tile-icon {
    margin-bottom: 12px;
    padding: 15px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
}

.tile-icon svg {
    width: 40px;
    height: 40px;
}

.tile-name {
    font-weight: 800;
    font-size: 1rem;
    text-align: center;
    padding: 0 10px;
}

/* Floating Home Button */
.app-home-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: #0d6efd;
    color: white !important;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(13, 110, 253, 0.4);
    transition: all 0.3s;
}

.app-home-btn:active {
    transform: scale(0.9);
}

.app-home-btn svg {
    width: 30px;
    height: 30px;
}

body.is-app-mode.on-dashboard .app-home-btn {
    display: none !important;
}

body:not(.is-app-mode) .app-home-btn {
    display: none !important;
}

/* Hide Sidebar COMPLETELY in App Mode */
body.is-app-mode #sidebarMenu {
    display: none !important;
}

body.is-app-mode main.main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding-top: 20px !important;
}

/* Show home button ONLY when NOT on dashboard in App Mode */
body.is-app-mode:not(.on-dashboard) .app-home-btn {
    display: flex !important;
}
