/* =============================================
   ISFDRNV – Estilos globales
   ============================================= */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --topbar-height: 60px;
    --brand-color: #2563eb;
}

/* ======= Layout ======= */
body.app-body {
    background-color: #f1f5f9;
    font-size: 0.875rem;
    color: #1e293b;
    margin: 0;
}

.wrapper {
    min-height: 100vh;
}

/* ======= Sidebar ======= */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    border-bottom: 1px solid #1e293b;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #f8fafc;
    letter-spacing: 0.05em;
}

.brand-subtitle {
    font-size: 0.7rem;
    color: #64748b;
}

.sidebar-user {
    border-bottom: 1px solid #1e293b;
}

.user-avatar {
    color: #64748b;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.user-role {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem 0.25rem;
    display: block;
}

.sidebar-link {
    color: #94a3b8 !important;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.825rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover) !important;
    color: #e2e8f0 !important;
}

.sidebar-link.active {
    background-color: var(--sidebar-active) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #1e293b;
}

/* ======= Main Content ======= */
.main-content {
    min-height: 100vh;
    min-width: 0;
    flex: 1;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.content-area {
    flex: 1;
}

/* ======= Cards ======= */
.card {
    border-radius: 12px;
}

/* ======= Dashboard Cards ======= */
.dashboard-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 12px;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.dashboard-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bg-primary-soft { background-color: #eff6ff; }
.bg-success-soft { background-color: #f0fdf4; }
.bg-info-soft { background-color: #f0f9ff; }
.bg-warning-soft { background-color: #fffbeb; }
.bg-danger-soft { background-color: #fff1f2; }
.bg-secondary-soft { background-color: #f8fafc; }

/* ======= Tables ======= */
.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

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

/* ======= Pre-Ingreso ======= */
.pre-ingreso-year-badge {
    background: var(--brand-color);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

/* ======= Modals ======= */
.modal-content {
    border-radius: 14px;
}

.modal-header {
    border-bottom: 1px solid #f1f5f9;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

/* ======= Login Page ======= */
body.login-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
    border-radius: 16px;
}

/* ======= Badges ======= */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ======= Buttons ======= */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-sm {
    border-radius: 6px;
}

/* ======= Form controls ======= */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #e2e8f0;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* ======= HTMX loading indicator ======= */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline;
}

/* ======= Alerts ======= */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

/* ======= Responsive Sidebar ======= */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        transform: translateX(-260px);
        transition: transform 0.28s ease;
        width: var(--sidebar-width);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1049;
        background: rgba(0, 0, 0, 0.45);
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .main-content {
        width: 100%;
    }
}

/* Botón hamburguesa inyectado por JS */
#sidebar-toggle {
    color: #1e293b;
    line-height: 1;
}
