/* Estilos Globales del Dashboard */

/* Personalización de scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Clase utilitaria para el estilo de botones de la guía */
.btn-brand-primary {
    background-color: #024468;
    color: white;
    font-weight: 500;
    border-radius: 0.375rem;
}

/* Estilos de Paginación Moderna */
.pagination-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 9999px;
    border: 1px solid #024468;
    background-color: transparent;
    color: #024468;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.dark .pagination-btn {
    border-color: #eaaa0a;
    color: #eaaa0a;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f0f7ff;
    transform: translateY(-1px);
}

.dark .pagination-btn:hover:not(:disabled) {
    background-color: rgba(234, 170, 10, 0.1);
}

.pagination-btn:disabled {
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
}

.dark .pagination-btn:disabled {
    border-color: #334155;
    color: #475569;
}

.pagination-btn-active {
    background-color: #024468 !important;
    color: white !important;
    border-color: #024468 !important;
    box-shadow: 0 4px 6px -1px rgba(2, 68, 104, 0.2);
}

.dark .pagination-btn-active {
    background-color: #eaaa0a !important;
    color: #024468 !important;
    border-color: #eaaa0a !important;
    box-shadow: 0 4px 6px -1px rgba(234, 170, 10, 0.2);
}

.pagination-btn-nav {
    padding: 0 1.25rem;
    border-radius: 9999px;
    font-weight: 600;
}

.pagination-dots {
    color: #024468;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
}

.dark .pagination-dots {
    color: #eaaa0a;
}

/* Sorting Styles */
.sort-header {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

.sort-header:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
    color: #024468 !important;
}

.dark .sort-header:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #eaaa0a !important;
}

.sort-icon {
    opacity: 0.3;
    transition: all 0.2s;
    display: inline-flex;
    margin-left: 0.5rem;
}

.sort-header:hover .sort-icon,
.sort-header.active .sort-icon {
    opacity: 1;
}

.sort-header.active .sort-icon {
    color: #eaaa0a;
}

/* Collapsible Filters */
#filters-content {
    transition: all 0.3s ease-in-out;
    max-height: 1000px;
    overflow: hidden;
    opacity: 1;
}

#filters-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.filter-header-btn i {
    transition: transform 0.3s ease;
}

.filter-header-btn.collapsed i:last-child {
    transform: rotate(-90deg);
}

/* Filter Bar Styles */
.filter-panel {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 500px;
    overflow-y: auto;
    overflow-x: visible;
    opacity: 1;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    min-height: 2.5rem;
    line-height: 1;
}

.filter-toggle__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.filter-toggle__track {
    width: 2.9rem;
    height: 1.6rem;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5f5 100%);
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    padding: 0.15rem;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15);
    box-sizing: border-box;
    position: relative;
    flex-shrink: 0;
}

.filter-toggle__thumb {
    width: 1.15rem;
    height: 1.15rem;
    background: #ffffff;
    border-radius: 9999px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
    transform: translateX(0);
    display: block;
}

.filter-toggle__label {
    font-size: 0.875rem;
    color: #475569;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.filter-toggle__input:checked + .filter-toggle__track {
    background: linear-gradient(180deg, #0b5c86 0%, #024468 100%);
    border-color: #024468;
    box-shadow: inset 0 1px 2px rgba(2, 68, 104, 0.4);
}

.filter-toggle__input:checked + .filter-toggle__track .filter-toggle__thumb {
    transform: translateX(1.25rem);
}

.filter-toggle__input:focus-visible + .filter-toggle__track {
    box-shadow: 0 0 0 3px rgba(2, 68, 104, 0.25);
}

.filter-toggle:hover .filter-toggle__track {
    background: linear-gradient(180deg, #dbeafe 0%, #cbd5f5 100%);
}

.filter-toggle:hover .filter-toggle__input:checked + .filter-toggle__track {
    background: linear-gradient(180deg, #1373a5 0%, #024468 100%);
}

.dark .filter-toggle__track {
    background: linear-gradient(180deg, #293548 0%, #172036 100%);
    border-color: #475569;
    box-shadow: inset 0 1px 2px rgba(2, 6, 23, 0.6);
}

.dark .filter-toggle__thumb {
    background: #e2e8f0;
    box-shadow: 0 2px 6px rgba(2, 6, 23, 0.6);
}

.dark .filter-toggle__label {
    color: #cbd5f5;
}

.dark .filter-toggle__input:checked + .filter-toggle__track {
    background: linear-gradient(180deg, #f1c453 0%, #eaaa0a 100%);
    border-color: #eaaa0a;
    box-shadow: inset 0 1px 2px rgba(234, 170, 10, 0.45);
}

.dark .filter-toggle__input:focus-visible + .filter-toggle__track {
    box-shadow: 0 0 0 3px rgba(234, 170, 10, 0.35);
}

.toggle-pill {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.55rem;
    border-radius: 9999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    transition: all 0.2s ease;
}

.toggle-pill:hover {
    transform: translateY(-1px);
}

.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
}

.matrix-head th {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.matrix-body .matrix-row:hover {
    background: rgba(2, 68, 104, 0.04);
}

.dark .matrix-body .matrix-row:hover {
    background: rgba(234, 170, 10, 0.08);
}

.matrix-cell {
    border-left: 1px solid rgba(148, 163, 184, 0.12);
}

.matrix-total-cell {
    background: rgba(2, 68, 104, 0.04);
}

.dark .matrix-total-cell {
    background: rgba(234, 170, 10, 0.08);
}

.matrix-value {
    font-weight: 700;
}

.matrix-mode-count .matrix-value-canon {
    display: none;
}

.matrix-mode-canon .matrix-value-count {
    display: none;
}

.filter-panel.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    transition: all 0.2s;
}

.dark .filter-chip {
    background-color: rgba(2, 68, 104, 0.2);
    color: #7dd3fc;
    border-color: rgba(2, 68, 104, 0.3);
}

.filter-chip:hover {
    background-color: #bae6fd;
}

.dark .filter-chip:hover {
    background-color: rgba(2, 68, 104, 0.3);
}

.filter-chip-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.filter-chip-remove:hover {
    opacity: 1;
}

/* Multiselect (Custom) */
.multiselect {
    position: relative;
}

.multiselect-panel {
    position: absolute !important;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    padding: 0.85rem;
    z-index: 80;
}

.dark .multiselect-panel {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
}

.multiselect-search {
    margin-bottom: 0.65rem;
}

.multiselect-search input {
    border-radius: 0.6rem;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.dark .multiselect-search input {
    background: rgba(15, 23, 42, 0.6);
    border-color: #334155;
}

.multiselect-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.multiselect-action-btn {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.multiselect-action-btn:hover {
    background: #e2e8f0;
}

.dark .multiselect-action-btn:hover {
    background: rgba(51, 65, 85, 0.8);
}

.multiselect-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(2, 68, 104, 0.2);
}

.dark .multiselect-action-btn {
    background: rgba(30, 41, 59, 0.6);
    color: #e2e8f0;
    border-color: #334155;
}

.dark .multiselect-action-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(234, 170, 10, 0.35);
}

.multiselect-options {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-right: 0.25rem;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #0f172a;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 0.6rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.multiselect-option-label {
    flex: 1;
}

.dark .multiselect-option {
    color: #e2e8f0;
}

.multiselect-option:hover {
    background: #f1f5f9;
}

.dark .multiselect-option:hover {
    background: rgba(51, 65, 85, 0.6);
}

.multiselect-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #024468;
}

.dark .multiselect-checkbox {
    accent-color: #eaaa0a;
}

@media (min-width: 768px) {
    .filter-panel {
        overflow: visible;
    }
}

/* Sidebar Styles */
.sidebar-expanded {
    width: 16rem;
}

.sidebar-collapsed {
    width: 5rem;
}

.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-footer-text {
    display: none;
}

.sidebar-collapsed .logo-container {
    justify-content: center;
}

/* KPI Card Hover Effects */
.kpi-card {
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .kpi-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Glassmorphism & Modern UI */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Table Responsive Styles */
.sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: inherit;
}

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
}

.dark .mobile-drawer {
    background: #0f172a;
}

.mobile-drawer.active {
    transform: translateY(0);
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sparkline Container */
.sparkline-container {
    height: 30px;
    width: 100%;
}

/* Table Card View (Mobile) */
@media (max-width: 768px) {
    .table-mobile-card {
        display: block;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        padding: 1rem;
        margin-bottom: 1rem;
        background: white;
    }
    .dark .table-mobile-card {
        background: #1e293b;
        border-color: #334155;
    }
}

/* Table Row Hover */
.table-row-hover {
    transition: background-color 0.2s ease;
}

.table-row-hover:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

.dark .table-row-hover:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Custom Scrollbar for Filter Panel */
.filter-panel::-webkit-scrollbar {
    width: 6px;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.filter-panel::-webkit-scrollbar-track {
    background: transparent;
}

.filter-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark .filter-panel::-webkit-scrollbar-thumb {
    background: #475569;
}
