/* ============================================
   SIDEBAR MÉDICO PROFESIONAL - TECSAS3 v3.0
   Inspirado en GE Healthcare y Siemens Healthineers
   Optimizado con persistencia de estado y UX mejorada
   ============================================ */

:root {
    /* Paleta TecsaS3 */
    --primary-color-rgb: 166, 218, 247;
    --secondary-color-rgb: 108, 175, 221;
    --tertiary-color-rgb: 69, 139, 186;
    --quaternary-color-rgb: 19, 77, 109;
    --quinternary-color-rgb: 4, 42, 58;
    --primary-color: #A6DAF7;
    --secondary-color: #6CAFDD;
    --tertiary-color: #458BBA;
    --quaternary-color: #134D6D;
    --quinternary-color: #042A3A;

    /* Sidebar específico */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --sidebar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-bg: linear-gradient(180deg, rgba(19, 77, 109, 0.98) 0%, rgba(4, 42, 58, 0.98) 100%);
    --sidebar-border: rgba(166, 218, 247, 0.2);
}

html {
    height: -webkit-fill-available;
}

main {
    height: 100vh;
    height: -webkit-fill-available;
    max-height: 100vh;
}

/* ============================================
   CONTENEDOR PRINCIPAL DEL SIDEBAR
   ============================================ */
#sidebar {
    position: fixed;
    top: 100px;
    left: 15px;
    width: var(--sidebar-width);
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                0 2px 8px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--sidebar-transition);
    z-index: 900;
    padding: 20px 0;
}

/* ============================================
   AJUSTE DEL SIDEBAR SEGÚN ESTADO DEL NAVBAR
   ============================================ */
body.navbar-is-collapsed #sidebar {
    top: 30px;
    height: calc(100vh - 50px);
    max-height: calc(100vh - 50px);
}

body:not(.navbar-is-collapsed) #sidebar {
    top: 100px;
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
}

html, body {
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    overflow-y: auto;
    overflow-x: hidden;
}

#main-content {
    margin-left: 295px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#content-wrapper {
    flex: 1;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

/* ============================================
   SCROLLBAR MEJORADA
   ============================================ */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(166, 218, 247, 0.3);
    border-radius: 10px;
    transition: background 0.3s ease;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(166, 218, 247, 0.5);
}

/* ============================================
   BOTONES PRINCIPALES DE SECCIÓN (CARDS)
   ============================================ */
#sidebar .card {
    padding: 0;
    background: linear-gradient(135deg,
        rgba(166, 218, 247, 0.25) 0%,
        rgba(108, 175, 221, 0.2) 100%) !important;
    border-radius: 12px;
    border: 1px solid rgba(166, 218, 247, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: var(--sidebar-transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Borde izquierdo de acento */
#sidebar .card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    opacity: 0.8;
    transition: all 0.3s ease;
}

#sidebar .card-body {
    padding: 14px 16px;
    background: transparent;
    border-radius: 12px;
    transition: var(--sidebar-transition);
    position: relative;
    z-index: 1;
}

/* Efecto hover en cards */
#sidebar .card:hover {
    background: linear-gradient(135deg,
        rgba(166, 218, 247, 0.35) 0%,
        rgba(108, 175, 221, 0.3) 100%) !important;
    transform: translateX(5px);
    border-color: rgba(166, 218, 247, 0.5) !important;
    box-shadow: 0 4px 16px rgba(166, 218, 247, 0.25),
                0 2px 8px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#sidebar .card:hover::before {
    width: 5px;
    opacity: 1;
    box-shadow: 0 0 10px rgba(166, 218, 247, 0.5);
}

/* Texto en los botones principales */
#sidebar .card .sidebar-heading {
    color: #ffffff !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#sidebar .card .sidebar-heading span {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
}

#sidebar .card .sidebar-heading i {
    color: var(--primary-color) !important;
    filter: brightness(1.2) drop-shadow(0 0 2px rgba(166, 218, 247, 0.4));
}

/* Estados hover con contraste */
#sidebar .card:hover .sidebar-heading {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

#sidebar .card:hover .sidebar-heading span {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.4px;
}

#sidebar .card:hover .sidebar-heading i {
    color: #ffffff !important;
    filter: brightness(1.4) drop-shadow(0 0 4px rgba(166, 218, 247, 0.6));
}

/* ============================================
   ESTILOS PARA SECCIONES DEL SIDEBAR (sidebar.html)
   ============================================ */

/* Brand/Header del sidebar */
#sidebar-container .sidebar-brand {
    padding: 1rem 0.75rem;
}

#sidebar-container .sidebar-brand-icon {
    padding: 0.5rem;
    background: linear-gradient(135deg, #134D6D 0%, #458BBA 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(19, 77, 109, 0.3);
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebar-container .sidebar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#sidebar-container .sidebar-brand-text {
    margin-top: 0.5rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
}

#sidebar-container .sidebar-brand-text span {
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    font-size: 0.7rem;
}

#sidebar-container .sidebar-divider {
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #134D6D, transparent);
    opacity: 0.3;
    margin: 1rem auto 0;
}

/* Secciones principales (sidebar-section-card) */
#sidebar-container .sidebar-section-card {
    background: linear-gradient(135deg, #134D6D 0%, #458BBA 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(19, 77, 109, 0.25);
}

#sidebar-container .sidebar-section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(19, 77, 109, 0.35);
}

#sidebar-container .sidebar-section-card .card-body {
    padding: 0.75rem 1rem;
}

#sidebar-container .sidebar-section-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

#sidebar-container .sidebar-section-icon {
    color: rgba(255, 255, 255, 0.9);
}

#sidebar-container .sidebar-section-arrow {
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.3s ease;
}

#sidebar-container .sidebar-section-card[aria-expanded="true"] .sidebar-section-arrow {
    transform: rotate(180deg);
}

/* ============================================
   BOTONES DE NAVEGACIÓN (COLAPSABLES)
   ============================================ */
.dropdown-toggle {
    outline: 0;
}

.btn-toggle {
    width: 100%;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    border: none;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: var(--sidebar-transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-toggle:hover,
.btn-toggle:focus {
    background: rgba(166, 218, 247, 0.1);
    color: #ffffff;
    transform: translateX(4px);
    box-shadow: inset 0 0 0 1px rgba(166, 218, 247, 0.2);
}

.btn-toggle[aria-expanded="true"] {
    background: rgba(166, 218, 247, 0.15);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(166, 218, 247, 0.2);
}

/* Arrow indicator */
.btn-toggle::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.btn-toggle[aria-expanded="true"]::after {
    transform: rotate(90deg);
}

/* Iconos dentro de botones toggle */
.btn-toggle i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(166, 218, 247, 0.1);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: var(--sidebar-transition);
}

.btn-toggle:hover i {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--quaternary-color);
    transform: scale(1.1);
}

/* ============================================
   ENLACES DE NAVEGACIÓN (NAVLINK)
   ============================================ */
.nav-link {
    color: rgba(122, 208, 227, 0.95) !important;
    text-decoration: none !important;
    transition: var(--sidebar-transition);
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    background: transparent !important;
    position: relative;
}

.nav-link:hover,
.nav-link:focus {
    color: #ffffff !important;
    background: rgba(166, 218, 247, 0.8) !important;
    transform: translateX(4px);
}

/* Estado activo - EFECTO DESTACADO */
.nav-link.active {
    background: linear-gradient(135deg,
        rgba(166, 218, 247, 0.25) 0%,
        rgba(108, 175, 221, 0.2) 100%) !important;
    color: var(--secondary-color) !important;
    font-weight: 600;
    padding-left: 16px !important;
    box-shadow:
        0 2px 8px rgba(166, 218, 247, 0.2),
        inset 0 0 0 1px rgba(166, 218, 247, 0.1);
    position: relative;
    animation: activeGlow 2s ease-in-out infinite;
}

/* Indicador izquierdo para activo */
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(166, 218, 247, 0.6);
}

/* Mini card en estado activo */
.nav-link.active .sidebar-mini-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 2px 8px rgba(166, 218, 247, 0.4);
}

.nav-link.active .sidebar-mini-card i {
    color: var(--quaternary-color) !important;
}

/* Animación de brillo para activo */
@keyframes activeGlow {
    0%, 100% {
        box-shadow:
            0 2px 8px rgba(166, 218, 247, 0.2),
            inset 0 0 0 1px rgba(166, 218, 247, 0.1);
    }
    50% {
        box-shadow:
            0 2px 12px rgba(166, 218, 247, 0.3),
            inset 0 0 0 1px rgba(166, 218, 247, 0.2);
    }
}

.nav-link.disabled {
    color: rgba(255, 255, 255, 0.4) !important;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   SUBMENÚS (DESPLEGABLES)
   ============================================ */
.btn-toggle-nav {
    list-style: none;
    padding: 8px 0 8px 20px;
    margin: 0;
}

.btn-toggle-nav li {
    margin-bottom: 4px;
}

.btn-toggle-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--sidebar-transition);
    position: relative;
    background: transparent;
}

.btn-toggle-nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.btn-toggle-nav a:hover::before {
    width: 8px;
}

.btn-toggle-nav a:hover,
.btn-toggle-nav a:focus {
    background: rgba(166, 218, 247, 0.1);
    color: #ffffff;
    padding-left: 16px;
}

/* Estado activo en submenús */
.btn-toggle-nav a.active {
    background: linear-gradient(135deg, rgba(166, 218, 247, 0.2) 0%, rgba(108, 175, 221, 0.15) 100%);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(166, 218, 247, 0.15);
    padding-left: 16px;
}

.btn-toggle-nav a.active::before {
    width: 4px;
    height: 60%;
}

/* Links dentro de submenús */
.btn-toggle-nav a .nav-link {
    color: inherit !important;
}

/* ============================================
   ICONOS Y MINI CARDS
   ============================================ */
.icon-spacing {
    margin-right: 8px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.sidebar-mini-card {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(166, 218, 247, 0.08);
    border-radius: 6px;
    transition: var(--sidebar-transition);
    flex-shrink: 0;
}

.btn-toggle-nav a:hover .sidebar-mini-card {
    background: rgba(166, 218, 247, 0.2);
    transform: scale(1.1);
}

.sidebar-mini-card i {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.btn-toggle-nav a:hover .sidebar-mini-card i {
    color: var(--secondary-color);
}

/* ============================================
   SIDEBAR HEADING
   ============================================ */
.sidebar-heading {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.3px;
    transition: var(--sidebar-transition);
    cursor: pointer;
}

.sidebar-heading:hover {
    color: #ffffff;
    transform: scale(1.02);
}

.sidebar-heading i {
    color: var(--primary-color);
    transition: var(--sidebar-transition);
}

.sidebar-heading:hover i {
    color: var(--secondary-color);
    transform: rotate(-10deg) scale(1.1);
}

/* ============================================
   DIVIDERS
   ============================================ */
.sidebar-divider {
    height: 1px;
    margin: 20px 20px;
    background: linear-gradient(90deg, transparent 0%, rgba(166, 218, 247, 0.3) 50%, transparent 100%);
    border: none;
}

/* ============================================
   LINK BODY EMPHASIS
   ============================================ */
.link-body-emphasis {
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
    transition: var(--sidebar-transition);
}

.link-body-emphasis:hover,
.link-body-emphasis:focus {
    color: #ffffff !important;
    background: rgba(166, 218, 247, 0.1);
}

.link-body-emphasis.disabled {
    color: rgba(255, 255, 255, 0.4) !important;
    pointer-events: none;
    cursor: not-allowed;
}

/* ============================================
   PROFILE SECTION
   ============================================ */
#profile-sublist,
#developer-sublist {
    padding-left: 20px;
}

#profile-sublist .btn-toggle-nav a,
#developer-sublist .btn-toggle-nav a,
#mensajeria-collapse .btn-toggle-nav a {
    color: rgba(255, 255, 255, 0.85);
    background: transparent;
}

#profile-sublist .btn-toggle-nav a:hover,
#developer-sublist .btn-toggle-nav a:hover,
#mensajeria-collapse .btn-toggle-nav a:hover {
    background: rgba(166, 218, 247, 0.1);
    color: #ffffff;
    padding-left: 16px;
}

/* ============================================
   SECTIONS CON ICONOS
   ============================================ */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #ffffff;
}

.sidebar-nav-item i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(166, 218, 247, 0.1);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--primary-color);
}

/* ============================================
   ANIMACIONES Y EFECTOS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.collapse.show {
    animation: fadeIn 0.4s ease-out;
}

.sidebar-section {
    animation: slideIn 0.4s ease-out backwards;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Desktop Large (>1200px) */
@media (min-width: 1200px) {
    #sidebar {
        width: var(--sidebar-width);
    }
}

/* Tablet (768px - 1200px) */
@media (max-width: 1200px) and (min-width: 768px) {
    #sidebar {
        width: 240px;
    }

    .sidebar-brand-text {
        font-size: 1.2rem;
    }

    .btn-toggle {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    .btn-toggle-nav a {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    /* Ajustes para sidebar.html */
    #sidebar-container .sidebar-brand {
        padding: 0.75rem 0.5rem;
    }

    #sidebar-container .sidebar-brand-icon {
        width: 50px;
        height: 50px;
        border-radius: 10px;
        padding: 0.4rem;
    }

    #sidebar-container .sidebar-brand-text {
        font-size: 0.7rem;
    }

    #sidebar-container .sidebar-brand-text span {
        font-size: 0.65rem;
    }

    #sidebar-container .sidebar-section-card .card-body {
        padding: 0.625rem 0.75rem;
    }

    #sidebar-container .sidebar-section-title {
        font-size: 0.8rem;
    }

    #sidebar-container .sidebar-section-icon {
        font-size: 0.9rem !important;
    }

    #sidebar-container .btn-toggle {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    #sidebar-container .nav-link {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    #sidebar-container .sidebar-mini-card {
        width: 22px;
        height: 22px;
    }

    #sidebar-container .icon-spacing {
        width: 18px;
        font-size: 0.8rem;
    }

    #sidebar-container .sidebar-divider {
        margin: 0.75rem auto 0;
    }
}

/* Mobile Large (576px - 768px) */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        left: 0;
        width: 280px;
        transition: transform 0.3s ease;
        top: 70px;
    }

    #sidebar.sidebar-open {
        transform: translateX(0);
        left: 15px;
    }

    /* Ajuste cuando navbar colapsado en mobile */
    body.navbar-is-collapsed #sidebar {
        top: 30px;
        height: calc(100vh - 50px);
        max-height: calc(100vh - 50px);
    }

    #main-content {
        margin-left: 0;
        margin-top: 70px;
    }

    .btn-toggle {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .btn-toggle-nav a {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .sidebar-brand-icon {
        width: 38px;
        height: 38px;
        font-size: 1.4rem;
    }

    .sidebar-brand-text {
        font-size: 1.2rem;
    }

    /* Ajustes para sidebar.html */
    #sidebar-container {
        padding: 0.5rem !important;
    }

    #sidebar-container .sidebar-brand {
        padding: 0.5rem 0.375rem;
    }

    #sidebar-container .sidebar-brand-icon {
        width: 82px;
        height: 82px;
        border-radius: 8px;
        padding: 0.3rem;
    }

    #sidebar-container .sidebar-brand-text {
        font-size: 0.65rem;
    }

    #sidebar-container .sidebar-brand-text span {
        font-size: 0.6rem;
        letter-spacing: 1px;
    }

    #sidebar-container .sidebar-section-card {
        border-radius: 8px;
    }

    #sidebar-container .sidebar-section-card .card-body {
        padding: 0.5rem 0.625rem;
    }

    #sidebar-container .sidebar-section-title {
        font-size: 0.75rem;
        font-weight: 500;
    }

    #sidebar-container .sidebar-section-icon {
        font-size: 0.85rem !important;
    }

    #sidebar-container .sidebar-section-arrow {
        font-size: 0.7rem !important;
    }

    #sidebar-container .btn-toggle {
        padding: 0.45rem 0.625rem;
        font-size: 0.75rem;
        border-radius: 5px;
    }

    #sidebar-container .nav-link {
        padding: 0.4rem 0.625rem;
        font-size: 0.75rem;
        border-radius: 5px;
    }

    #sidebar-container .sidebar-mini-card {
        width: 20px;
        height: 20px;
        border-radius: 5px;
    }

    #sidebar-container .icon-spacing {
        width: 16px;
        font-size: 0.75rem;
        margin-right: 0.35rem;
    }

    #sidebar-container ul.list-unstyled.ps-0 > li {
        margin-bottom: 0.25rem;
    }

    #sidebar-container .sidebar-divider {
        margin: 0.5rem auto 0;
        height: 1px;
    }
}

/* Mobile Small (<576px) */
@media (max-width: 576px) {
    #sidebar {
        width: calc(100vw - 30px);
        left: 15px;
        right: 15px;
        top: 70px;
        height: calc(100vh - 90px);
    }

    /* Ajuste cuando navbar colapsado en mobile pequeño */
    body.navbar-is-collapsed #sidebar {
        top: 25px;
        height: calc(100vh - 45px);
        max-height: calc(100vh - 45px);
    }

    .sidebar-brand-text {
        font-size: 1.1rem;
    }

    .btn-toggle {
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    .btn-toggle i {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .sidebar-mini-card {
        width: 24px;
        height: 24px;
    }

    .sidebar-mini-card i {
        font-size: 0.8rem;
    }
}

/* Altura pequeña */
@media (max-height: 600px) {
    #sidebar {
        padding: 10px 0;
    }

    .sidebar-brand {
        padding: 10px 15px 15px;
        margin-bottom: 15px;
    }

    .sidebar-brand-icon {
        width: 35px;
        height: 35px;
        font-size: 1.4rem;
    }

    .sidebar-brand-text {
        font-size: 1.1rem;
    }

    .btn-toggle {
        padding: 8px 12px;
    }

    .btn-toggle i {
        width: 28px;
        height: 28px;
    }

    .btn-toggle-nav a {
        padding: 6px 10px;
    }

    .card-body {
        padding: 10px 12px !important;
    }
}

/* ============================================
   ADAPTACIÓN AL ESTADO DEL NAVBAR (sidebar.html)
   ============================================ */
/* Cuando navbar está colapsado - sidebar toma todo el espacio */
body.navbar-is-collapsed #sidebar-container {
    margin-top: 0 !important;
    padding-top: 0.5rem !important;
}

body.navbar-is-collapsed .sidebar-content {
    padding-top: 0 !important;
}

body.navbar-is-collapsed #sidebar-container .sidebar-brand {
    padding-top: 0.5rem !important;
}

/* Cuando navbar está colapsado - remover margin-top del contenido */
body.navbar-is-collapsed .content-area {
    margin-top: 0 !important;
    padding-top: 1rem !important;
}

body.navbar-is-collapsed #main-content {
    padding-top: 0 !important;
}

/* Ajuste del contenido del sidebar según estado navbar */
body.navbar-is-collapsed .sidebar-main-content {
    padding-top: 0.5rem !important;
}

body.navbar-is-expanded .sidebar-main-content {
    padding-top: 0 !important;
}

/* ============================================
   TOGGLES DE BOOTSTRAP
   ============================================ */
[data-bs-toggle="collapse"] {
    cursor: pointer;
}

/* ============================================
   SCROLLAREA
   ============================================ */
.scrollarea {
    overflow-y: auto;
}

/* ============================================
   BI (Bootstrap Icons)
   ============================================ */
.bi {
    vertical-align: -0.125em;
    fill: currentColor;
}

/* ============================================
   UTILIDADES ADICIONALES
   ============================================ */

/* Ocultar elemento */
.d-none {
    display: none !important;
}

/* Transiciones suaves para todos los elementos del sidebar */
#sidebar *,
#sidebar *::before,
#sidebar *::after {
    box-sizing: border-box;
}

/* Focus states para accesibilidad */
#sidebar a:focus-visible,
#sidebar button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Selection color */
#sidebar ::selection {
    background: rgba(166, 218, 247, 0.3);
    color: #ffffff;
}

/* Espaciado entre elementos del sidebar */
#sidebar-container ul.list-unstyled.ps-0 > li {
    margin-bottom: 0.35rem;
}

/* Estilos para sub-secciones (btn-toggle) en sidebar.html */
#sidebar-container .btn-toggle {
    width: 100%;
    padding: 0.6rem 0.875rem;
    justify-content: flex-start;
    border-radius: 6px;
    margin-bottom: 0.2rem;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

#sidebar-container .btn-toggle:hover {
    background-color: rgba(19, 77, 109, 0.08);
    padding-left: 1rem;
}

#sidebar-container .btn-toggle::after {
    margin-left: auto;
    transition: transform 0.3s ease;
}

#sidebar-container .btn-toggle:not(.collapsed)::after {
    transform: rotate(90deg);
}

/* ============================================
   ESTILOS ESPECIALES PARA SIDEBAR-ACTIVE-LINK
   (Generados dinámicamente por JS)
   ============================================ */
.sidebar-active-link {
    background: linear-gradient(135deg,
        rgba(166, 218, 247, 0.25) 0%,
        rgba(108, 175, 221, 0.2) 100%) !important;
    color: #A6DAF7 !important;
    font-weight: 600;
    border-left: 3px solid transparent;
    padding-left: 16px !important;
    box-shadow:
        0 2px 8px rgba(166, 218, 247, 0.2),
        inset 0 0 0 1px rgba(166, 218, 247, 0.1);
    position: relative;
}

.sidebar-active-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #A6DAF7 0%, #6CAFDD 100%);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(166, 218, 247, 0.6);
}

.sidebar-active-link .sidebar-mini-card {
    background: linear-gradient(135deg, #A6DAF7 0%, #6CAFDD 100%);
    color: #134D6D !important;
    box-shadow: 0 2px 8px rgba(166, 218, 247, 0.4);
}

.sidebar-active-link .sidebar-mini-card i {
    color: #134D6D !important;
}

/* Efecto de brillo para activo */
.sidebar-active-link {
    animation: activeGlow 2s ease-in-out infinite;
}

/* Indicador activo izquierdo */
.active-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: linear-gradient(180deg, #A6DAF7 0%, #6CAFDD 100%);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(166, 218, 247, 0.5);
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 4px;
        opacity: 1;
    }
}

/* Ripple effect */
.ripple-effect {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}
