/* ============================================================
   Sistema Pabellones — estilos globales
   Complementa Bootstrap 5
   ============================================================ */

:root {
    --pab-primary:   #1a6fa3;
    --pab-secondary: #4db8a4;
    --pab-dark:      #0d3349;
    --pab-light-bg:  #f0f4f8;
    --pab-sidebar-w: 240px;
    --pab-header-h:  60px;
}

/* ── Layout principal ── */
body {
    background: var(--pab-light-bg);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.92rem;
}

/* ── Sidebar ── */
#sidebar {
    width: var(--pab-sidebar-w);
    min-height: 100vh;
    background: var(--pab-dark);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: width .25s ease;
}

#sidebar .brand {
    min-height: var(--pab-header-h);
    display: flex;
    align-items: center;
    padding: 0 1.1rem;
    background: var(--pab-primary);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    gap: .55rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
    transition: background .2s;
}

/* Cuando hay logo, fondo blanco con borde inferior */
#sidebar .brand:has(img) {
    background: #fff;
    border-bottom: 2px solid var(--pab-primary);
    justify-content: center;
    padding: 8px 12px;
}

#sidebar .brand i { font-size: 1.3rem; }

#sidebar .nav-link {
    color: rgba(255,255,255,.75);
    padding: .28rem .8rem;
    border-radius: .4rem;
    margin: .05rem .4rem;
    transition: background .18s, color .18s;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    line-height: 1.3;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.12);
}

#sidebar .nav-section {
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.35);
    padding: .45rem .8rem .15rem;
}

/* ── Área de contenido ── */
#main-content {
    margin-left: var(--pab-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */
#topbar {
    height: var(--pab-header-h);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

#topbar .page-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--pab-dark);
    flex: 1;
}

/* ── Cards ── */
.pab-card {
    background: #fff;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    border: 1px solid rgba(0,0,0,.06);
}

.pab-card .card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    padding: .9rem 1.2rem;
    font-weight: 600;
    color: var(--pab-dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Badges de estado ── */
.badge-pendiente  { background: #fff3cd; color: #856404; }
.badge-aprobada   { background: #d1e7dd; color: #0f5132; }
.badge-rechazada  { background: #f8d7da; color: #842029; }
.badge-cancelada  { background: #e2e3e5; color: #41464b; }
.badge-completada { background: #cff4fc; color: #055160; }

/* ── Tablas ── */
.table-pab thead th {
    background: var(--pab-light-bg);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

/* ── Login ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pab-dark) 0%, var(--pab-primary) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: .8rem;
    padding: 2.4rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.8rem;
}

.login-logo i {
    font-size: 2.8rem;
    color: var(--pab-primary);
}

/* ── Calendario (FullCalendar) ── */
.fc .fc-toolbar-title { font-size: 1rem !important; }
.fc .fc-button { font-size: .82rem !important; }
.fc .fc-event { cursor: pointer; border-radius: .3rem !important; font-size: .78rem; }

/* ── Responsive: ver patch sidebar al final del archivo ── */

/* ============================================================
   Sidebar scrollable + colapsable — v2.4.1
   ============================================================ */

/* ── Sidebar como columna flex con scroll interno ───────── */
#sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: width .25s ease, transform .25s ease;
}

#sidebar .brand {
    flex-shrink: 0;
}

#sidebar .sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;          /* clave para que flex permita scroll */
    padding-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.2) transparent;
}

#sidebar .sidebar-nav::-webkit-scrollbar { width: 4px; }
#sidebar .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.25);
    border-radius: 4px;
}

/* Los submenús acordeón no deben superponerse: flujo normal */
#sidebar .sidebar-nav ul,
#sidebar .sidebar-nav li {
    position: static;
}

/* Evitar que Bootstrap .nav haga wrap lateral: forzar columna única */
#sidebar .sidebar-nav .nav {
    flex-wrap: nowrap;
    flex-direction: column;
    width: 100%;
}

/* ── Botón flotante colapsar sidebar ────────────────────── */
#sidebar-collapse-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: calc(var(--pab-sidebar-w) - 13px);
    z-index: 1101;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--pab-primary);
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left .25s ease, background .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    font-size: .72rem;
    padding: 0;
}
#sidebar-collapse-btn:hover { background: #155a87; }

/* ── Estado colapsado (desktop) ─────────────────────────── */
body.sidebar-collapsed #sidebar {
    width: 0 !important;
    transform: translateX(-100%);
}
body.sidebar-collapsed #main-content {
    margin-left: 0 !important;
}
body.sidebar-collapsed #sidebar-collapse-btn {
    left: 5px;
}

/* ── Responsive: móvil ──────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        z-index: 1050;
        height: 100vh;
        width: var(--pab-sidebar-w) !important;
        transform: translateX(-100%);
    }
    body.sidebar-open #sidebar {
        transform: translateX(0);
    }
    #main-content { margin-left: 0 !important; }
    #sidebar-collapse-btn {
        left: 8px;
        top: auto;
        bottom: 16px;
        transform: none;
    }
    body.sidebar-open #sidebar-collapse-btn {
        left: calc(var(--pab-sidebar-w) - 13px);
    }
}
