html, body {
    height: 100%;
    margin: 0;
}

html {
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/*html {
  position: relative;
  min-height: 100%;
}*/

body {
    display: flex;
    flex-direction: column;
    margin-bottom: 60px;
    font-family: 'Open Sans', sans-serif;
}

header {
    flex-shrink: 0;
}

.footer {
    position: sticky;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    /*line-height: 60px;*/
}

/* Overlay de BlockUI */
div.blockUI.blockOverlay {
    background-color: rgba(0, 0, 0, 0.3) !important;
    z-index: 2000 !important;
    cursor: wait;
}

/* Mensaje centrado de BlockUI */
div.blockUI.blockMsg {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    position: fixed !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto !important;
    z-index: 1100 !important;
    cursor: wait;
    text-align: center;
}

/* Contenedor interno del spinner */
.blockui-content {
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    width: 300px;
    margin: 0 auto;
}


/* ====== Layout Interno ====== */

.layout-wrapper {
    display: flex;
    /*min-height: 100vh;*/
    /*overflow: hidden;*/
    flex-grow: 1;
}

/* ==== Menú lateral moderno con badges ==== */
.sidebar {
    background-color: #f8f9fa;
    width: 260px;
    /*height: 100vh;*/
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    overflow-x: hidden;
}

    .sidebar::-webkit-scrollbar {
        width: 8px;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 4px;
    }

        .sidebar::-webkit-scrollbar-thumb:hover {
            background-color: #999;
        }

    .sidebar.collapsed {
        width: 80px;
    }

    .sidebar .menu-toggle {
        background: none;
        border: none;
        color: #0d6efd;
        font-size: 1.2rem;
        padding: 1rem;
        text-align: center;
    }

    .sidebar .menu-toggle .fas {
        display: none;
    }

    .sidebar .nav-link {
        color: #333;
        padding: 0.75rem 1rem;
        display: flex;
        align-items: center;
        gap: 0.8rem;
        position: relative;
        border-radius: 0.375rem;
        transition: background-color 0.2s ease;
    }

        .sidebar .nav-link:hover {
            background-color: #e9ecef;
        }

        .sidebar .nav-link i {
            font-size: 1.2rem;
            width: 24px;
            text-align: center;
        }

    .sidebar .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.55em;
    }

    /* Estilos de agrupación y colapso */
    .sidebar .menu-section {
        margin-bottom: 1rem;
    }

    .sidebar .menu-title {
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .sidebar hr {
        margin: 0.5rem 0;
        border-color: #ddd;
    }

    /* Oculta títulos y separadores al colapsar */
    .sidebar.collapsed .menu-toggle .fas {
        display: block;
    }

    .sidebar.collapsed .main-title,
    .sidebar.collapsed .menu-title,
    .sidebar.collapsed hr {
        display: none;
    }

    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 0.75rem 0;
    }
        .sidebar.collapsed .nav-link span:not(.badge) {
            display: none;
        }

    /* Los badges se mantienen visibles */
    .sidebar.collapsed .badge {
        position: absolute;
        top: 6px;
        right: 14px;
    }

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    font-size: 0.85rem;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

/* ====== Contenido principal ====== */
.content-area {
    flex-grow: 1;
    /*flex: 1;*/
    display: flex;
    flex-direction: column;
    background-color: #fff;
    overflow: auto;
}

.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* ====== Header ====== */
header {
    flex-shrink: 0;
}

/* Transición de entrada/salida */
.slide-fade-enter-active,
.slide-fade-leave-active {
    transition: all 0.25s ease;
}

.slide-fade-enter-from {
    opacity: 0;
    transform: translateY(-10px);
}

.slide-fade-leave-to {
    opacity: 0;
    transform: translateY(-10px);
}

/* Asegura que el popup no mueva el contenido del navbar */
.notificaciones-popup {
    will-change: transform, opacity;
    background-color: #fff;
    border-radius: 0.5rem;
}


/* --- Estilo base para Select2 al estilo de Bootstrap 5 --- */
.select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
    height: calc(2.375rem + 2px); /* igual que .form-select */
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding-left: 0;
        color: #212529;
    }

    .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color: #6c757d;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 100%;
        top: 0;
        right: 0.75rem;
        width: 1.75rem;
    }

        /* Flecha de estilo Bootstrap */
        .select2-container--default .select2-selection--single .select2-selection__arrow b {
            border-color: #212529 transparent transparent transparent;
            border-style: solid;
            border-width: 0.45em 0.45em 0 0.45em;
            height: 0;
            left: 50%;
            margin-left: -0.45em;
            margin-top: -0.25em;
            position: absolute;
            top: 50%;
            width: 0;
        }

/* Focus */
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

/* Dropdown */
.select2-container .select2-dropdown {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    z-index: 1055; /* sobre modales, si es necesario */
}

/* Opciones al pasar el cursor */
.select2-results__option--highlighted {
    background-color: #0d6efd !important;
    color: white;
}
