/* ==========================================================================
   Sistema de Sorteo — Estilos base
   Basado en el diseño UI de Pagos4 (Inter Universidad)
   ========================================================================== */

/* ===================================================================
   VARIABLES INSTITUCIONALES
   =================================================================== */
:root {
    /* === Institucionales === */
    --inter-blue-primary:          #2d5593;
    --inter-blue-primary-hover:    #436498;
    --inter-blue-primary-dark:     #24457a;
    --inter-blue-dark:             #1f3668;
    --inter-blue-darker:           #0d1a33;
    --inter-orange:                #e96621;
    --inter-orange-hover:          #e8753a;
    --inter-orange-dark:           #c9571c;

    /* === Sidebar === */
    --inter-sidebar-bg:            #111622;
    --inter-sidebar-header-bg:     #0b0e16;
    --inter-sidebar-active-bg:     #1f3668;
    --inter-sidebar-active-border: #e96621;
    --inter-sidebar-text:          #b8c7ce;
    --inter-sidebar-text-active:   #ffffff;

    /* === Layout === */
    --inter-navbar-bg:             #ffffff;
    --inter-bg-content:            #f4f6f9;
    --inter-card-bg:               #ffffff;
    --inter-border-color:          #e9ecef;

    /* === Tablas === */
    --table-header-bg:             #f8f9fc;
    --table-header-color:          #4e73df;
    --table-border:                #e3e6f0;

    /* === Colores planos comunes === */
    --text-body:                   #2C2C2C;
    --text-muted:                  #8A8F98;
    --text-table:                  #495057;

    /* === Login (glassmorphism) === */
    --login-bg-overlay:            rgba(8, 20, 42, 0.82);
    --glass-bg:                    rgba(255, 255, 255, 0.06);
    --glass-border:                rgba(255, 255, 255, 0.12);
    --glass-blur:                  blur(14px);
    --input-focus-border:          rgba(255, 255, 255, 0.4);
    --btn-gradient:                linear-gradient(90deg, #1f6fd8, #104ba3);
    --btn-gradient-hover:          linear-gradient(90deg, #2a81ed, #155cb7);
}


/* ===================================================================
   TIPOGRAFÍA
   =================================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--inter-bg-content);
    color: var(--text-body);
}


/* ===================================================================
   SIDEBAR LAYOUT (wrapper flex)
   =================================================================== */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
    overflow-x: hidden;
}


/* ===================================================================
   SIDEBAR
   =================================================================== */
.sidebar {
    min-width: 260px;
    max-width: 260px;
    background: var(--inter-sidebar-bg);
    color: #fff;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1030;
    display: flex;
    flex-direction: column;
}

/* En desktop, colapsamos usando margin-left negativo */
@media (min-width: 769px) {
    .sidebar.collapsed {
        margin-left: -260px;
    }
}

/* Header / Branding */
.sidebar-header {
    padding: 1.25rem 1.5rem;
    background: var(--inter-sidebar-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Profile box */
.sidebar-profile {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-profile .user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile .user-rol {
    font-size: 0.75rem;
}

/* Navegación */
.sidebar-nav {
    padding: 0.75rem 0;
    list-style: none;
    margin-bottom: 0;
    overflow-y: auto;
    flex: 1;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav .nav-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0.6rem 1.5rem 0.3rem;
    color: #6c7b88;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav .nav-item {
    position: relative;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--inter-sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.92rem;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.sidebar-nav .nav-item.active > .nav-link {
    background-color: var(--inter-sidebar-active-bg);
    color: var(--inter-sidebar-text-active);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(45, 85, 147, 0.25);
}

.sidebar-nav .nav-link i {
    width: 22px;
    margin-right: 0.75rem;
    font-size: 1.05rem;
    text-align: center;
}

/* Submenú colapsable */
.sidebar-nav .collapse-menu {
    list-style: none;
    padding-left: 0;
    background-color: rgba(0, 0, 0, 0.15);
}

.sidebar-nav .collapse-menu .nav-link {
    padding: 0.55rem 1.5rem 0.55rem 2.75rem;
    font-size: 0.85rem;
}

.sidebar-nav .collapse-menu .nav-item.active > .nav-link {
    background-color: rgba(31, 54, 104, 0.25);
    color: var(--inter-blue-primary);
    border-left: 3px solid var(--inter-sidebar-active-border);
}

/* Flecha de submenú: rota al expandir */
.submenu-arrow {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
}

.nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}


/* ===================================================================
   PAGE CONTENT (lado derecho del wrapper)
   =================================================================== */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--inter-bg-content);
}


/* ===================================================================
   NAVBAR SUPERIOR
   =================================================================== */
.navbar-top {
    background: var(--inter-navbar-bg);
    border-bottom: 1px solid var(--inter-border-color);
}

.navbar-toggler-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 1.2rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.navbar-toggler-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #000;
}

.vertical-divider {
    color: #dee2e6;
}


/* ===================================================================
   LOGIN — GLASSMORPHISM PREMIUM
   =================================================================== */
.login-wrapper {
    background: url('../img/background.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    position: relative;
}

.login-overlay {
    background-color: var(--login-bg-overlay);
    position: absolute;
    inset: 0;
    z-index: 1;
}

.login-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 28px;
    padding: 3.5rem 2.5rem 2.5rem 2.5rem;
    color: #ffffff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 440px;
}

.glass-card .login-logo-img {
    max-height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.glass-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.glass-input-group i.input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
}

.glass-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    padding: 1rem 1rem 1rem 3.2rem !important;
    width: 100%;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: var(--input-focus-border) !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

/* Password toggle dentro del input */
.glass-input-group .password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    z-index: 5;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.glass-input-group .password-toggle:hover {
    color: #ffffff;
}

.glass-btn {
    background: var(--btn-gradient);
    border: none;
    border-radius: 14px;
    color: #ffffff;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(31, 111, 216, 0.3);
    cursor: pointer;
}

.glass-btn:hover {
    background: var(--btn-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 111, 216, 0.45);
    color: #ffffff;
}

.glass-btn:active {
    transform: translateY(0);
}

.glass-btn:disabled {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.glass-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 2rem 0 1.5rem 0;
}

.glass-link {
    color: #3b8cf6;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.glass-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* Modal dentro del login (olvidé contraseña, etc.) */
.login-modal .modal-content {
    background: rgba(8, 20, 42, 0.95);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.login-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #ffffff;
}

.login-modal .modal-body {
    color: #ffffff;
}

.login-modal .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

.login-modal .btn-close {
    filter: brightness(0) invert(1);
}

/* Mobile */
@media (max-width: 480px) {
    .glass-card {
        padding: 2.5rem 1.75rem 2rem;
        border-radius: 24px;
        margin: 15px;
    }
}


/* ===================================================================
   CARDS
   =================================================================== */
.card {
    border: 1px solid var(--inter-border-color);
    border-radius: 0.35rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid var(--inter-border-color);
}

/* Tarjetas KPI (dashboard) */
.kpi-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    height: 100%;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transform: translateY(-2px);
}

.kpi-card-body {
    padding: 1.5rem;
    position: relative;
    animation: fadeInUp 0.4s ease both;
}

.kpi-icon-box {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
    padding-right: 50px;
}

.kpi-amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-body);
    line-height: 1.2;
    padding-right: 50px;
}

/* Chart card */
.chart-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.chart-card-body {
    padding: 1.5rem;
}

.chart-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

/* Colores de iconos KPI */
.bg-soft-red { background: #F8DADA; }
.bg-soft-inter-blue { background: #dce6f5; }
.bg-soft-green { background: #D8F2DF; }
.bg-soft-yellow { background: #F8F1C7; }

.icon-red { color: #D32F2F; }
.icon-inter-blue { color: var(--inter-blue-primary); }
.icon-green { color: #3FB264; }
.icon-yellow { color: #D39B28; }


/* ===================================================================
   TABLAS
   =================================================================== */
.table-responsive {
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
    border: 1px solid var(--table-border);
}

.table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--table-border);
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}


/* ===================================================================
   FORMULARIOS
   =================================================================== */
.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bs-secondary-bg);
    opacity: 1;
}

.form-label.fw-semibold {
    font-weight: 600;
}


/* ===================================================================
   MODALES
   =================================================================== */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid var(--inter-border-color);
    background-color: var(--table-header-bg);
}

.modal-footer {
    border-top: 1px solid var(--inter-border-color);
    background-color: var(--table-header-bg);
}

/* Modal de sesión por expirar */
.modal-session .modal-header {
    background: var(--bs-warning);
}


/* ===================================================================
   TOAST / NOTIFICACIONES
   =================================================================== */
.toast-container {
    z-index: 1055;
}


/* ===================================================================
   BOTONES PERSONALIZADOS
   =================================================================== */
.btn-export {
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    color: var(--inter-blue-primary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: #f8f7ff;
    border-color: var(--inter-blue-primary);
    color: var(--inter-blue-primary-dark);
    box-shadow: 0 2px 8px rgba(45, 85, 147, 0.15);
}


/* ===================================================================
   LOADER OVERLAY
   =================================================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

.dashboard-loader-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.25s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(97, 97, 97, 0.49);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.loader-text {
    color: #fff;
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}


/* ===================================================================
   EMPTY STATE
   =================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}


/* ===================================================================
   UTILIDADES
   =================================================================== */
.filter-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}


/* ===================================================================
   UTILITY EXTENSIONS
   =================================================================== */
.min-width-0 {
    min-width: 0;
}


/* ===================================================================
   ANIMACIONES
   =================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===================================================================
   RESPONSIVIDAD Y COMPORTAMIENTO MÓVIL
   =================================================================== */

/* Backdrop del Sidebar */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1025;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    /* El sidebar flota sobre el contenido en móviles y se desplaza usando transform */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        z-index: 1035;
        box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.25);
        margin-left: 0 !important;
        transform: translateX(0); /* Estado expandido */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.collapsed {
        transform: translateX(-100%); /* Estado oculto */
        margin-left: 0 !important;
        min-width: 260px !important;
        max-width: 260px !important;
        width: 260px !important;
    }

    #page-content-wrapper {
        width: 100%;
        min-width: 100%;
    }

    /* Evitar que se desborde el contenido */
    #wrapper {
        position: relative;
        overflow-x: hidden;
    }
    
    /* Adaptación de tablas y cards */
    .container-fluid {
        padding: 1rem !important;
    }
}


/* Segmented Control para OCR en modal */
.ocr-segmented-control {
    background: #e9ecef;
    padding: 3px;
    border-radius: 30px;
    display: inline-flex;
    border: 1px solid #dee2e6;
}

.ocr-segmented-control .nav-link {
    border-radius: 30px;
    border: none;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    background: transparent;
    transition: all 0.2s ease-in-out;
}

.ocr-segmented-control .nav-link.active {
    background: #ffffff;
    color: var(--bs-primary) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

