/* -------------------------------------
   SIDEBAR
------------------------------------- */
#sidebar {
    min-width: 280px;
    max-width: 280px;
    background: #ffffff;
    color: #374151;
    transition: all .3s ease-in-out;
    z-index: 1;
    position: relative;
    border-right: 1px solid #E5E7EB;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scroll del sidebar cuando el body tiene overflow hidden (ej: planificación) */
#sidebar > .p-4 {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    margin-left: 0;
    min-width: 60px;
    max-width: 60px;
}

#sidebar.active .brand {
    justify-content: center;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0;
}

#sidebar.active .brand .brand-text {
    display: none;
}

#sidebar.active .brand .bi {
    margin-right: 0;
}

#sidebar.active .profile-card {
    display: none !important;
}

#sidebar.active .profile-card .user-info {
    display: none;
}

#sidebar.active .profile-card .avatar {
    margin-right: 0;
}

/* Controles del sidebar (toggle menu y tema) */
.sidebar-controls {
    padding: 0.25rem 0;
}

.btn-sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    color: #6B7280;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-sidebar-toggle i {
    font-size: 1.25rem;
}

.btn-sidebar-toggle:hover {
    background: #6366F1;
    border-color: #6366F1;
    color: #ffffff;
}

/* Toggle de tema compacto para sidebar */
.theme-toggle-sidebar {
    display: flex;
    align-items: center;
}

.theme-toggle-sidebar .theme-toggle-input {
    display: none;
}

.theme-toggle-sidebar .theme-toggle-label {
    width: 56px;
    height: 28px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    border: 1px solid #E5E7EB;
    background: #f1f3f5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.25s, border-color 0.25s;
}

.theme-toggle-sidebar .theme-toggle-label::after {
    content: "";
    position: absolute;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-sidebar .theme-toggle-label .sun,
.theme-toggle-sidebar .theme-toggle-label .moon {
    font-size: 0.75rem;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.theme-toggle-sidebar .theme-toggle-label .sun {
    left: 8px;
    color: #f59f00;
}

.theme-toggle-sidebar .theme-toggle-label .moon {
    right: 8px;
    color: #94a3b8;
}

.theme-toggle-sidebar .theme-toggle-input:checked + .theme-toggle-label {
    background: #2b3035;
    border-color: #3b4147;
}

.theme-toggle-sidebar .theme-toggle-input:checked + .theme-toggle-label::after {
    transform: translateX(28px);
    background: #e9ecef;
}

/* Sidebar contraído: ocultar toggle de tema y centrar botón menu */
#sidebar.active .sidebar-controls {
    justify-content: center !important;
}

#sidebar.active .theme-toggle-sidebar {
    display: none;
}

#sidebar ul.components {
    padding: 0;
    margin: 0;
}

#sidebar ul li {
    font-size: 14px;
    margin: 0;
}

#sidebar ul li > ul {
    margin-left: 16px;
    margin-top: 4px;
}

#sidebar ul li > ul li {
    font-size: 13px;
    margin: 2px 0;
}

#sidebar ul li a {
    padding: 12px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    margin: 4px 0;
    transition: all 0.2s ease;
    font-weight: 500;
}

#sidebar ul li a:hover {
    background-color: #F3F4F6;
    color: #6366F1;
    transform: translateX(4px);
}

#sidebar.active ul li a:hover {
    background-color: transparent;
}

#sidebar ul li a.active {
    background-color: #6366F1;
    color: #ffffff;
}

#sidebar ul li a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    margin-right: 12px;
    flex-shrink: 0;
}

#sidebar.active ul li a {
    justify-content: center;
    padding: 12px 0;
}

#sidebar.active ul li a i {
    margin-right: 0;
}

#sidebar.active ul li a span {
    display: none;
}

#sidebar ul li a .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Badge visible cuando el sidebar está contraído */
#sidebar.active ul li a {
    position: relative;
}

#sidebar.active ul li a .badge {
    display: flex !important;
    position: absolute;
    top: 4px;
    right: 4px;
    margin-left: 0;
    font-size: 9px;
    padding: 1px 4px;
    min-width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
}

/* Iconos específicos para cada sección del menú */
#sidebar ul li a .icon-home {
    color: #6366F1;
}

#sidebar ul li a .icon-users {
    color: #10B981;
}

#sidebar ul li a .icon-list {
    color: #F59E0B;
}

#sidebar ul li a .icon-bell {
    color: #EF4444;
}

#sidebar ul li a .icon-logout {
    color: #6B7280;
}

/* Estilos para iconos de Bootstrap Icons */
#sidebar ul li a .bi {
    font-size: 16px;
    width: 16px;
    text-align: center;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Estilos para iconos de Font Awesome */
#sidebar ul li a .fas,
#sidebar ul li a .far,
#sidebar ul li a .fab {
    font-size: 16px;
    width: 16px;
    text-align: center;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Estilos para iconos SVG */
#sidebar ul li a svg {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.15), transparent);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    text-decoration: none;
    transition: background 0.2s ease-in-out;
}

.brand .bi {
    font-size: 1.25rem;
    color: #6366F1;
    margin-right: 0.75rem;
}

.brand .brand-text {
    font-weight: 700;
    font-size: 1.125rem;
    color: #1F2937;
}

.brand:hover {
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.3), transparent);
}

.profile-card {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent);
}

.profile-card .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6366F1;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
}

.profile-card .user-info {
    line-height: 1;
}

.profile-card .user-info .name span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #222;
}

.profile-card .user-info .role span {
    font-size: 0.85rem;
    color: #6B7280;
}

/* -------------------------------------
   MEDIA QUERY: < 992px (móvil COLLAPSED por defecto)
------------------------------------- */
/*@media (max-width: 991.98px) {*/
/*    !* sidebar colapsado = ancho 60px *!*/
/*    #sidebar {*/
/*        margin-left: 0 !important;*/
/*        min-width: 60px !important;*/
/*        max-width: 60px !important;*/
/*    }*/

/*    !* al pulsar toggle (se añade #sidebar.active) abre ancho 280px *!*/
/*    #sidebar.active {*/
/*        margin-left: 0 !important;*/
/*        min-width: 280px !important;*/
/*        max-width: 280px !important;*/
/*    }*/

/*    !* ajusta el contenido para dejar hueco de 60px o 280px *!*/
/*    .wrapper #main {*/
/*        margin-left: 60px;*/
/*    }*/
/*    .wrapper.active #main {*/
/*        margin-left: 280px;*/
/*    }*/

/*    !* botón de toggle siempre visible y bien posicionado *!*/
/*    #sidebar .custom-menu {*/
/*        margin-right: -50px !important;*/
/*        top: 10px !important;*/
/*    }*/
/*}*/

/* -------------------------------------
   TOGGLE DEL SIDEBAR EN MÓVIL <768px
------------------------------------- */
/*@media (max-width: 768px) {*/
/*    #sidebar {*/
/*        margin-left: 0;*/
/*        min-width: 60px;*/
/*        max-width: 60px;*/
/*    }*/
/*    #sidebar.active {*/
/*        margin-left: 0;*/
/*        min-width: 60px;*/
/*        max-width: 60px;*/
/*    }*/
/*    .wrapper.active #main {*/
/*        margin-left: 0;*/
/*    }*/
/*}*/

/* -------------------------------------
   TOGGLE DEL SIDEBAR (eliminado .custom-menu, ahora usa .sidebar-controls)
------------------------------------- */
#sidebarCollapse {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    color: #6B7280;
    border-radius: 6px;
    padding: 6px 10px;
    transition: all 0.2s ease;
    font-size: 14px;
}

#sidebarCollapse:hover {
    background: #F9FAFB;
    color: #6366F1;
    border-color: #6366F1;
}

/* -------------------------------------
   FOOTER DEL SIDEBAR
------------------------------------- */
#sidebar .sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
}

#sidebar .sidebar-footer .user-info {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
}

#sidebar .sidebar-footer .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #6366F1;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    font-size: 14px;
}

#sidebar .sidebar-footer .user-details {
    flex: 1;
}

#sidebar .sidebar-footer .user-name {
    font-weight: 600;
    color: #222222;
    font-size: 14px;
    margin: 0;
}

#sidebar .sidebar-footer .user-role {
    color: #6B7280;
    font-size: 12px;
    margin: 0;
}

/* -------------------------------------
   SEARCH EN HEADER
------------------------------------- */
/*#header .search-form {*/
/*    position: relative;*/
/*}*/

/*#header .search-form .form-control {*/
/*    border: 1px solid #E5E7EB;*/
/*    border-radius: 20px;*/
/*    padding: 8px 16px 8px 40px;*/
/*    background: #F9FAFB;*/
/*    font-size: 14px;*/
/*}*/

/*#header .search-form .form-control:focus {*/
/*    background: #ffffff;*/
/*    border-color: #6366F1;*/
/*    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);*/
/*}*/

/*#header .search-form .search-icon {*/
/*    position: absolute;*/
/*    left: 12px;*/
/*    top: 50%;*/
/*    transform: translateY(-50%);*/
/*    color: #9CA3AF;*/
/*    font-size: 16px;*/
/*}*/


/* -------------------------------------
   UTILIDADES
------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
