/* Premium Glassmorphic Dark-Mode Stylesheet for AduanaAI */

/* Root design system variables using precise HSL tailored colors */
:root {
    --bg-main: 224 71% 4%;
    --glass-bg: 220 40% 6% / 0.55;
    --glass-border: 220 50% 90% / 0.08;
    --glass-border-focus: 245 80% 65% / 0.4;
    --primary-glow: 244 75% 60%;
    --secondary-glow: 270 80% 55%;
    --text-muted: 215 20% 65%;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Custom modern scrollbar for seamless glassmorphic feel */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* Layout overrides */
body {
    font-family: 'Inter', sans-serif;
    background-color: rgb(2 6 23);
    overflow: hidden;
}

h1, h2, h3, h4, .font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* Perfect Glassmorphism Cards */
.glass-card {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    border-radius: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.08);
    transform: translateY(-2px);
}

/* Custom interactive navigation buttons */
.nav-btn {
    color: rgb(148, 163, 184);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}

.nav-btn:hover {
    color: rgb(241, 245, 249);
    background: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.05));
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 20px -2px rgba(99, 102, 241, 0.15);
}

.nav-btn.active i {
    color: rgb(129, 140, 248);
}

/* Interactive focus glow-ring style */
input:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2), 0 0 15px 0 rgba(99, 102, 241, 0.1);
}

/* Custom Chat Bubble shapes */
.chat-bubble-user {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-top-right-radius: 0.25rem !important;
}

.chat-bubble-ai {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 0.25rem !important;
}

/* Pulsing accent indicators */
.status-indicator-ping {
    position: relative;
    display: inline-flex;
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background-color: rgb(129, 140, 248);
}

/* Table styles */
.data-table-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease;
}

.data-table-row:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Dynamic glow elements */
.glow-accent {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

.glow-blue {
    background: rgb(59, 130, 246);
    top: 10%;
    left: 20%;
}

.glow-purple {
    background: rgb(168, 85, 247);
    bottom: 10%;
    right: 20%;
}

/* Loading animations */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-loader {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ========================================================
   ADMIN CONTROL PANEL & TOGGLES
   ======================================================== */
.admin-floating-panel {
    position: fixed;
    top: 0;
    right: -340px; /* Hide offscreen */
    width: 320px;
    height: 100vh;
    z-index: 100;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6), 0 0 20px 0 rgba(99, 102, 241, 0.15);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-floating-panel.open {
    transform: translateX(-340px);
}

.admin-header {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.05));
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom premium switch button style */
.switch-control {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #f1f5f9;
    transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

input:checked + .switch-slider {
    background: linear-gradient(135deg, rgb(99, 102, 241), rgb(168, 85, 247));
}

input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* Paywall premium overlay and popup modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.paywall-modal {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px 0 rgba(168, 85, 247, 0.2);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 460px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .paywall-modal {
    transform: scale(1);
}

.premium-tag {
    background: linear-gradient(90deg, #eab308, #ca8a04);
    box-shadow: 0 2px 10px rgba(234, 179, 8, 0.3);
}

.premium-card-glow {
    position: relative;
}

.premium-card-glow::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #eab308, #a855f7, #6366f1, #ec4899);
    z-index: -1;
    border-radius: 1.25rem;
    filter: blur(10px);
    opacity: 0.15;
    transition: opacity 0.3s ease;
}

.premium-card-glow:hover::after {
    opacity: 0.35;
}

/* Logistics and Brokerage UI Tags */
.tier-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tier-aaa {
    background-color: rgba(236, 72, 153, 0.15);
    color: rgb(244, 114, 182);
    border: 1px solid rgba(236, 72, 153, 0.25);
}

.tier-aa {
    background-color: rgba(168, 85, 247, 0.15);
    color: rgb(192, 132, 252);
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.tier-a {
    background-color: rgba(99, 102, 241, 0.15);
    color: rgb(129, 140, 248);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* ========================================================
   SMART REPORTS SPLIT-PANE UI
   ======================================================== */
.reports-nav-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(148, 163, 184);
    background: transparent;
    border: 1px solid transparent;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
}

.reports-nav-btn:hover {
    color: rgb(241, 245, 249);
    background: rgba(255, 255, 255, 0.03);
}

.reports-nav-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(99, 102, 241, 0.05));
    border-color: rgba(168, 85, 247, 0.25);
    box-shadow: 0 4px 20px -2px rgba(168, 85, 247, 0.15);
}

.reports-nav-btn.active i {
    color: rgb(192, 132, 252);
    filter: drop-shadow(0 0 4px rgba(192, 132, 252, 0.4));
}

/* ========================================================
   ESTILOS DE IMPRESIÓN (PDF)
   ======================================================== */
#print-section {
    display: none;
}

@media print {
    /* Ocultar absolutamente todo en la pantalla */
    body > * {
        display: none !important;
    }
    
    /* Mostrar únicamente el contenedor de impresión */
    #print-section {
        display: block !important;
        visibility: visible !important;
    }
    #print-section * {
        visibility: visible !important;
    }

    #print-section {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        color: #000000 !important;
        padding: 20px !important;
        font-family: 'Inter', sans-serif !important;
    }

    /* Ocultar elementos de UI no deseados dentro de la sección a imprimir */
    #print-section button, 
    #print-section .no-print,
    #print-section i,
    #print-section svg {
        display: none !important;
    }

    /* Darle un estilo limpio de tabla para impresión */
    #print-section table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 15px !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    #print-section th, #print-section td {
        border: 1px solid #dddddd !important;
        padding: 8px !important;
        text-align: left !important;
        color: #000000 !important;
        background: #ffffff !important;
        font-size: 11px !important;
    }

    #print-section th {
        background-color: #f2f2f2 !important;
        font-weight: bold !important;
    }

    #print-section h3, #print-section h4 {
        color: #000000 !important;
        font-family: 'Outfit', sans-serif !important;
        margin-bottom: 8px !important;
        font-size: 16px !important;
    }
    
    #print-section p {
        color: #222222 !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
        margin-bottom: 15px !important;
    }
}

/* Mobile bottom navigation and responsive UI layout */
@media (max-width: 767px) {
    .mobile-nav-btn {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        color: rgb(148, 163, 184); /* slate-400 */
        font-weight: 500;
        transition: all 0.2s ease;
    }
    
    .mobile-nav-btn.active {
        color: rgb(168, 85, 247) !important; /* purple-500 */
        font-weight: 700;
        transform: translateY(-2px);
    }
    
    .mobile-nav-btn.active i {
        filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.5));
    }
    
    #view-assistant, #view-smartReports, #view-summary {
        margin-bottom: 2rem;
    }
    
    /* Scrollbar-thin utility */
    .scrollbar-thin::-webkit-scrollbar {
        height: 3px;
        width: 3px;
    }
    .scrollbar-thin::-webkit-scrollbar-thumb {
        background: rgba(99, 102, 241, 0.4);
    }
}

/* Premium internal subtabs inside smartReports */
.subtab-btn {
    color: rgb(148, 163, 184);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
}

.subtab-btn:hover {
    color: rgb(241, 245, 249);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.subtab-btn.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2)) !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
    box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

#subtab-btn-copilot {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border: 1px solid transparent;
}
#subtab-btn-copilot:not(.active) {
    opacity: 0.65;
}
#subtab-btn-copilot:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}
#subtab-btn-copilot.active {
    opacity: 1;
    background: rgba(99, 102, 241, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* --- ASISTENTE UNIFICADO & ENTRADA UNIFICADA --- */
#view-assistant:not(.hidden) {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
}

@media (min-width: 768px) {
    #view-assistant:not(.hidden) {
        top: 4rem;
        left: 1.5rem;
        right: 1.5rem;
        bottom: 1.5rem;
    }
}

@media (max-width: 767px) {
    #view-assistant:not(.hidden) {
        top: 1rem;
        left: 1rem;
        right: 1rem;
        bottom: 5rem; /* Evita que el input del chat se solape con la navegación inferior */
    }
}

#subview-copilot:not(.hidden), #subview-classify:not(.hidden), #subview-ncm-direct:not(.hidden), #subview-importers:not(.hidden) {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#chat-log, #classify-chat-log, #ncm-results-container, #importers-results-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#subview-copilot h2, #subview-classify h3 {
    padding-right: 5rem;
}

#unified-assistant-form {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-top: 0.5rem;
}

#unified-assistant-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#unified-assistant-form:focus-within {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.15), 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Ajustes responsivos para celulares (max-width: 767px) */
@media (max-width: 767px) {


    .admin-floating-panel {
        width: 100%;
        right: -100%;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .admin-floating-panel.open {
        transform: translateX(-100%);
    }
}

/* ========================================================
   GLOBAL INTERACTIVE NCM & TARIFF DRAWER
   ======================================================== */
.interactive-ncm {
    color: rgb(52, 211, 153) !important; /* emerald-400 */
    text-decoration: underline dotted rgb(52, 211, 153) !important;
    text-underline-offset: 4px;
    cursor: pointer;
    font-family: monospace;
    font-weight: 600;
    padding: 0.05rem 0.2rem;
    border-radius: 0.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}
.interactive-ncm:hover {
    color: rgb(110, 231, 183) !important; /* emerald-300 */
    background-color: rgba(52, 211, 153, 0.1) !important;
    text-decoration: underline solid rgb(110, 231, 183) !important;
}

#global-tariff-drawer {
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#drawer-tariff-content::-webkit-scrollbar {
    width: 4px;
}
#drawer-tariff-content::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 2px;
}

@media (max-width: 767px) {
    #global-tariff-drawer {
        inset: auto 0 0 0 !important;
        height: 80vh !important;
        max-width: 100% !important;
        border-left: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 1.5rem 1.5rem 0 0 !important;
        transform: translateY(100%) !important;
    }
    #global-tariff-drawer.drawer-open {
        transform: translateY(0) !important;
    }

}


/* ========================================================
   SIDEBAR COLLAPSED (GEMINI STYLE)
   ======================================================== */
@media (min-width: 768px) {
    aside.sidebar-collapsed {
        width: 5rem !important; /* 80px */
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    }

    aside.sidebar-collapsed nav p,
    aside.sidebar-collapsed nav span,
    aside.sidebar-collapsed #user-display-name,
    aside.sidebar-collapsed #user-display-role,
    aside.sidebar-collapsed aside div p,
    aside.sidebar-collapsed aside div span,
    aside.sidebar-collapsed .sidebar-logo-container {
        display: none !important;
    }

    aside.sidebar-collapsed .border-t {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    aside.sidebar-collapsed .nav-btn {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        height: 2.75rem;
    }

    aside.sidebar-collapsed .nav-btn i,
    aside.sidebar-collapsed .nav-btn img {
        margin-right: 0 !important;
        font-size: 1.25rem !important;
    }
    
    aside.sidebar-collapsed #btn-logout {
        display: none !important;
    }

    aside.sidebar-collapsed .border-t + div {
        justify-content: center !important;
    }
    
    aside {
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    }
}

/* ========================================================
   RIGHT FILTER FLOATING TAB
   ======================================================== */
#copilot-filter-floating-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-right: none;
    border-radius: 0.75rem 0 0 0.75rem;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.2s ease;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.3);
}

#copilot-filter-floating-tab:hover {
    background: rgba(168, 85, 247, 0.35);
    padding-right: 0.75rem;
}

