/* ===== SIDEBAR ===== */

.app-sidebar {
    --ddgi-offcanvas-width: min(22rem, 88vw);
}

.app-sidebar-body {
    display: block;
    padding: 0 1rem 1.5rem;
}

aside.border-end {
    min-height: calc(100vh - 5.5rem);
}

.navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #c8102e;
}

@media (min-width: 992px) {
    .app-sidebar-body {
        padding: 0;
    }
}

@media (max-width: 991.98px) {
    aside.border-end {
        min-height: 100vh;
        border-right: 0 !important;
    }

    .app-main {
        max-width: 100%;
    }

    .app-main-row {
        display: block;
    }

    .app-content {
        width: 100%;
    }

    .app-sidebar .position-sticky {
        position: static !important;
        top: auto !important;
    }

    .sidebar-user-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: .5rem !important;
    }
}

.sidebar-section-toggle.btn,
.sidebar-section-toggle.btn:hover,
.sidebar-section-toggle.btn:focus,
.sidebar-section-toggle.btn:active,
.sidebar-section-toggle.btn:focus-visible {
    --bs-btn-color: #6c757d;
    --bs-btn-hover-color: #6c757d;
    --bs-btn-active-color: #6c757d;
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: transparent;
    --bs-btn-active-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-border-color: transparent;

    border: 0;
    border-bottom: 1px solid #d9d9d9;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.75rem 0;
    color: #6c757d !important;
}

.sidebar-section-toggle.btn span {
    color: #6c757d !important;
    font-weight: 600;
}

.sidebar-section-chevron {
    color: #6c757d !important;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.sidebar-section-toggle[aria-expanded="true"] .sidebar-section-chevron {
    transform: rotate(0deg);
}

.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-chevron {
    transform: rotate(-90deg);
}

/* ===== ENLACES DEL MENÚ ===== */

.sidebar-link {
    border: 0 !important;
    background: transparent !important;
    color: #2f3542 !important;
    font-weight: 500;
    border-radius: 0.6rem !important;
    margin-bottom: 0.25rem;
    padding: 0.85rem 1rem !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    color: inherit !important;
}

.sidebar-link:hover,
.sidebar-link:focus {
    background: #f5f6f8 !important;
    color: #2f3542 !important;
}

.sidebar-link-active,
.sidebar-link.active,
.sidebar-link.active:hover,
.sidebar-link.active:focus {
    background: #c8102e !important;
    color: #ffffff !important;
    font-weight: 600;
    border-color: transparent !important;
}

.sidebar-link-active i,
.sidebar-link.active i {
    color: #ffffff !important;
}

/* ===== BLOQUE USUARIO INFERIOR ===== */

.sidebar-user-toggle.btn,
.sidebar-user-toggle.btn:hover,
.sidebar-user-toggle.btn:focus,
.sidebar-user-toggle.btn:active,
.sidebar-user-toggle.btn:focus-visible {
    --bs-btn-color: #2f3542;
    --bs-btn-hover-color: #2f3542;
    --bs-btn-active-color: #2f3542;
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: transparent;
    --bs-btn-active-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-border-color: transparent;

    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0.75rem 0;
    color: #2f3542 !important;
    width: 100%;
}

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #d9d9d9;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: #2f3542;
    font-weight: 600;
}

.sidebar-user-email {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.25;
    white-space: normal;
}

/* ===== DROPDOWN USUARIO ===== */

.dropdown-menu.sidebar-user-menu {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0;
}

.dropdown-menu.sidebar-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2f3542;
    font-weight: 500;
}

.dropdown-menu.sidebar-user-menu .dropdown-item:hover,
.dropdown-menu.sidebar-user-menu .dropdown-item:focus {
    background: #f5f6f8;
    color: #1f2937;
}

.dropdown-menu.sidebar-user-menu .dropdown-item.text-danger {
    color: #b42318 !important;
}

.dropdown-menu.sidebar-user-menu .dropdown-item.text-danger:hover,
.dropdown-menu.sidebar-user-menu .dropdown-item.text-danger:focus {
    background: #fef3f2;
    color: #b42318 !important;
}


/* Fix mínimo para que no se desborde el bloque de perfil */
.sidebar-user-toggle {
    overflow: hidden;
}

.sidebar-user-toggle > span {
    min-width: 0;
    flex: 1 1 auto;
    max-width: 100%;
    align-items: center !important;
}

.sidebar-user-toggle > span > span:last-child {
    min-width: 0;
    max-width: calc(100% - 3.25rem);
}

.sidebar-user-name,
.sidebar-user-email {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sidebar-user-toggle .bx-chevron-down {
    flex-shrink: 0;
}
