/* ==== Lancaster Digital Theme ==== */

:root {
    --ld-orange: #FF7A00;
    --ld-navy: #0B1F3B;
    --ld-dark: #111827;
    --ld-light: #F5F5F7;
}

html, body {
    height: 100%;
    margin: 0;
}

/* ===========================================================
   FIX SCROLL: sidebar fijo + scroll solo en contenido (NUEVO)
   =========================================================== */

/* En desktop: el body NO scrollea, scrollea solo .config-content */
body {
    overflow: hidden;
}

/* === Layout de área Config === */

.config-layout {
    display: flex;
    height: 100vh; /* ? clave */
    min-height: 0; /* ? evita estiramientos raros */
}

/* SIDEBAR */

.config-sidebar {
    width: 260px;
    flex: 0 0 260px; /* ? clave: ancho fijo dentro del flex */
    height: 100vh; /* ? clave: no crece con el contenido */
    position: sticky; /* ? se mantiene visible */
    top: 0;
    background: var(--ld-navy);
    color: #ffffff;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    transition: width 0.2s ease-in-out;
}

.config-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.75rem;
}

.config-sidebar-toggle {
    border-radius: 999px;
    padding-inline: 0.5rem;
    border-color: rgba(255,255,255,0.4);
}

    .config-sidebar-toggle i {
        font-size: 1.1rem;
    }

.config-sidebar-logo {
    display: flex;
    flex-direction: column;
}

.config-sidebar-logo-text {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.config-sidebar-subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
}

/* NAVEGACIÓN */

.config-sidebar-nav .nav {
    gap: 0.25rem;
}

.config-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.75);
    transition: all 0.15s ease-in-out;
    position: relative; /* para tooltips en modo colapsado */
}

.config-nav-icon {
    width: 24px;
    display: flex;
    justify-content: center;
}

    .config-nav-icon i {
        font-size: 1.1rem;
    }

.config-nav-text {
    white-space: nowrap;
}

.config-sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.config-sidebar-nav .nav-link.active {
    background: var(--ld-orange);
    color: #111827;
    font-weight: 600;
}

/* CONTENIDO */

.config-content {
    flex: 1;
    height: 100vh; /* ? clave */
    overflow-y: auto; /* ? scroll vertical SOLO aquí */
    overflow-x: hidden;
    background: var(--ld-light);
    padding: 1.5rem;
}

/* CLAVE: evita que el flex “ensanche” la web con tablas grandes */
.config-content,
.config-content-inner {
    min-width: 0;
}

.config-content-inner {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
}

/* === Panel de usuario en sidebar Config === */

.config-user-panel {
    display: flex;
    align-items: center;
}

.config-user-avatar i {
    font-size: 1.6rem;
}

.config-user-text {
    display: flex;
    flex-direction: column;
}

/* Botón logout en modo normal */
.config-user-logout-btn {
    display: flex;
    align-items: center;
}

/* === Comportamiento en modo COLAPSADO === */

body.config-collapsed .config-user-panel {
    justify-content: center;
    padding-inline: 0.25rem;
}

body.config-collapsed .config-user-text {
    display: none;
}

body.config-collapsed .config-user-logout-btn {
    justify-content: center;
    padding-inline: 0.4rem;
}

    body.config-collapsed .config-user-logout-btn .config-user-logout-text {
        display: none;
    }

    body.config-collapsed .config-user-logout-btn i {
        margin-right: 0;
    }

/* MODO COLAPSADO */

body.config-collapsed .config-sidebar {
    width: 72px;
    flex-basis: 72px; /* ? clave: mantiene ancho en flex */
    padding-inline: 0.5rem;
}

body.config-collapsed .config-sidebar-header {
    flex-direction: column;
    align-items: center;
}

body.config-collapsed .config-sidebar-logo-text,
body.config-collapsed .config-sidebar-subtitle {
    display: none;
}

body.config-collapsed .config-sidebar-toggle {
    align-self: center;
}

body.config-collapsed .config-sidebar-nav .nav-link {
    justify-content: center;
    padding-inline: 0.4rem;
}

body.config-collapsed .config-nav-text {
    display: none;
}

body.config-collapsed .config-content {
    padding-left: 1rem;
}

/* Tooltips para opciones del sidebar en modo colapsado */

body.config-collapsed .config-sidebar-nav .nav-link::after {
    content: attr(data-label);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(8px, -50%);
    background: rgba(15, 23, 42, 0.95);
    color: #f9fafb;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.4);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 9999;
}

body.config-collapsed .config-sidebar-nav .nav-link:hover::after {
    opacity: 1;
    transform: translate(12px, -50%);
}

/* ===== Modales Lancaster (arriba, más corporativos) ===== */

.modal.modal-top .modal-dialog {
    margin-top: 1.75rem; /* separadito del borde superior */
}

.modal.modal-top .modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.modal-header {
    border-bottom: 1px solid #f1f5f9;
}

.modal-title {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Pequeño fondo gris muy suave para el body del modal */
.modal-body-bg-light {
    background: #f9fafb;
}

/* Campos del formulario dentro de modales */
.modal-body .form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #111827;
}

.modal-body .form-control,
.modal-body .form-select {
    font-size: 0.9rem;
}

/* Encabezados de sección dentro del formulario */
.form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0.4rem;
}

.form-section-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}

/* ===== Submenú Reportes (sidebar) ===== */

.config-nav-parent .config-nav-caret i {
    transition: transform 0.15s ease-in-out;
    opacity: 0.85;
}

/* rota el caret cuando está expandido */
.config-nav-parent[aria-expanded="true"] .config-nav-caret i {
    transform: rotate(180deg);
}

.config-subnav {
    margin-left: 2.05rem; /* alinea bajo el texto (después del icono) */
    padding-left: 0.35rem;
    border-left: 1px solid rgba(255,255,255,0.10);
}

.config-subnav-link {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.70);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

    .config-subnav-link:hover {
        background: rgba(255,255,255,0.08);
        color: #fff;
    }

    .config-subnav-link.active {
        background: rgba(255, 122, 0, 0.20);
        color: #fff;
        font-weight: 600;
    }

.config-subnav-sep {
    height: 1px;
    background: rgba(255,255,255,0.10);
    margin: 0.5rem 0.5rem;
    border-radius: 999px;
}

/* ===========================================================
   Flyout Reportes cuando el sidebar está colapsado (NUEVO)
   =========================================================== */

.reportes-item {
    position: relative;
}

/* Submenu como panel flotante */
body.config-collapsed .reportes-item #reportesSubmenu {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    width: 240px;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255,255,255,0.10);
    z-index: 9999;
    /* oculto por defecto */
    display: none;
}

    /* Neutraliza collapse en colapsado */
    body.config-collapsed .reportes-item #reportesSubmenu.collapse {
        height: auto !important;
        overflow: visible !important;
        transition: none !important;
    }

/* Mostrar al hover / focus / click (clase JS) */
body.config-collapsed .reportes-item:hover #reportesSubmenu,
body.config-collapsed .reportes-item:focus-within #reportesSubmenu,
body.config-collapsed .reportes-item.is-flyout-open #reportesSubmenu {
    display: block;
}

/* Dentro del flyout: mostrar textos aunque el sidebar esté colapsado */
body.config-collapsed .reportes-item #reportesSubmenu .config-nav-text {
    display: inline !important;
}

/* Ajuste nav interno (sin margin del modo normal) */
body.config-collapsed .reportes-item #reportesSubmenu .nav {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

/* Links dentro del flyout */
body.config-collapsed .reportes-item #reportesSubmenu .config-subnav-link {
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.80);
}

    body.config-collapsed .reportes-item #reportesSubmenu .config-subnav-link:hover {
        background: rgba(255,255,255,0.10);
        color: #fff;
    }

    body.config-collapsed .reportes-item #reportesSubmenu .config-subnav-link.active {
        background: var(--ld-orange);
        color: #111827;
        font-weight: 700;
    }

/* En modo colapsado: no mostrar caret del padre */
body.config-collapsed #reportesToggle .bi-chevron-down {
    display: none;
}

/* Opcional: en modo colapsado, evitar tooltip encima del flyout en el padre */
body.config-collapsed .reportes-item:hover > a.nav-link::after {
    opacity: 0;
}

/* ===========================================================
   Reporte Mensual: tabla no debe ensanchar la web (NUEVO)
   =========================================================== */

.report-monthly-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.report-monthly-table {
    width: 100%;
    table-layout: fixed; /* evita que una celda “empuje” el layout */
}

    .report-monthly-table th,
    .report-monthly-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

        /* celdas día compactas */
        .report-monthly-table th.day-col,
        .report-monthly-table td.day-col {
            width: 56px; /* ajusta 48-64 */
            text-align: center;
            padding: 0.35rem 0.25rem;
        }

        /* columna sticky izquierda (Trabajador) */
        .report-monthly-table th.sticky-left,
        .report-monthly-table td.sticky-left {
            position: sticky;
            left: 0;
            z-index: 3;
            background: #fff;
        }

        /* columna sticky derecha (Resumen) */
        .report-monthly-table th.sticky-right,
        .report-monthly-table td.sticky-right {
            position: sticky;
            right: 0;
            z-index: 3;
            background: #fff;
        }

    /* header sticky arriba */
    .report-monthly-table thead th {
        position: sticky;
        top: 0;
        z-index: 4;
    }

        /* cuando header + sticky se cruzan */
        .report-monthly-table thead th.sticky-left,
        .report-monthly-table thead th.sticky-right {
            z-index: 6;
            background: #f8f9fa; /* como table-light */
        }

    /* badges mini */
    .report-monthly-table .badge {
        font-size: 0.72rem;
        padding: 0.25rem 0.45rem;
    }

/* Responsivo: sidebar arriba en pantallas chicas */

@media (max-width: 767.98px) {
    /* ? En mobile vuelve el scroll normal del body */
    body {
        overflow: auto;
    }

    .config-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .config-sidebar {
        width: 100%;
        flex: 0 0 auto;
        height: auto;
        position: relative;
        top: auto;
        border-radius: 0;
        margin-bottom: 1rem;
    }

    .config-content {
        height: auto;
        overflow: visible;
        padding: 0.75rem;
    }

    .config-content-inner {
        border-radius: 8px;
        padding: 1rem;
    }
}
