/* ===============================
   NEW DASHBOARD SIDEBAR
================================ */

.ah-dashboard-sidebar {
    width: 280px;
    height: calc(100vh - 92px);
    position: fixed;
    top: 92px;
    left: 0;
    z-index: 9999;
    background: #000000;
    color: #fff;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .18);
    transition: width .25s ease, transform .25s ease;
    overflow-x: visible;
    overflow-y: hidden;
}

.ah-dashboard-sidebar *,
.ah-dashboard-sidebar *::before,
.ah-dashboard-sidebar *::after {
    box-sizing: border-box;
}

/* BOTÓN HAMBURGUESA MOBILE */

.ah-mobile-sidebar-trigger {
    display: none;
    position: fixed;
    top: 112px;
    left: 16px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 14px;
    background: #11101d;
    color: #fff;
    font-size: 20px;
    z-index: 99998;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0,0,0,.18);
    cursor: pointer;
}

.ah-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99997;
    opacity: 0;
    visibility: hidden;
    transition: .25s ease;
}

.ah-sidebar-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* HEADER */

.ah-sidebar-header {
    height: 82px;
    padding: 18px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ah-sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    overflow: hidden;
}

.ah-sidebar-brand img {
    width: 145px;
    max-height: 58px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.ah-sidebar-toggle,
.ah-sidebar-mobile-close {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #1f1d33;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s ease;
}

.ah-sidebar-toggle:hover,
.ah-sidebar-mobile-close:hover {
    background: #cd1218;
}

.ah-sidebar-mobile-close {
    display: none;
}

/* NAV */

.ah-sidebar-nav {
    height: calc(100% - 82px);
    padding: 10px 14px 18px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ah-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.ah-sidebar-section {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.ah-sidebar-section:last-child {
    border-bottom: none;
}

.ah-sidebar-title {
    display: block;
    padding: 8px 14px;
    color: rgba(255, 255, 255, .42);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* LINKS */

.ah-sidebar-link {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    margin: 4px 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, .72);
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.ah-sidebar-link i {
    width: 22px;
    min-width: 22px;
    text-align: center;
    font-size: 17px;
}

.ah-sidebar-link span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ah-sidebar-link:hover,
.ah-sidebar-link.is-active,
.ah-sidebar-group.is-active > .ah-sidebar-link {
    background: #1f1d33;
    color: #fff;
}

.ah-sidebar-link.is-active::before,
.ah-sidebar-group.is-active > .ah-sidebar-link::before {
    content: "";
    width: 4px;
    height: 26px;
    background: #cd1218;
    border-radius: 999px;
    position: absolute;
    left: -6px;
}

/* BADGES */

.ah-sidebar-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    margin-left: auto;
    border-radius: 999px;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ah-sidebar-badge.is-red {
    background: #cd1218;
}

.ah-sidebar-badge.is-blue {
    background: #2563eb;
}

.ah-sidebar-badge.is-green {
    background: #16a34a;
}

.ah-sidebar-badge.is-yellow {
    background: #d97706;
}

/* SUBMENU */

.ah-sidebar-group {
    position: relative;
}

.ah-sidebar-group-btn {
    font-family: inherit;
}

.ah-sidebar-arrow {
    margin-left: auto;
    transition: transform .2s ease;
}

.ah-sidebar-group.is-open .ah-sidebar-arrow {
    transform: rotate(180deg);
}

.ah-sidebar-submenu {
    display: none;
    padding: 4px 0 8px 50px;
}

.ah-sidebar-group.is-open .ah-sidebar-submenu {
    display: block;
}

.ah-sidebar-submenu a {
    min-height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .55);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: .2s ease;
}

.ah-sidebar-submenu a:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

/* LOGOUT */

.ah-sidebar-logout {
    font-family: inherit;
}

/* ===============================
   COLLAPSED DESKTOP
================================ */

.ah-dashboard-sidebar.is-collapsed {
    width: 72px;
    overflow-x: visible;
    overflow-y: hidden;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-header {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-brand {
    display: none;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-toggle {
    width: 42px;
    height: 42px;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-toggle i {
    transform: rotate(180deg);
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-title,
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-link span,
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-arrow,
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-badge {
    display: none;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-nav {
    height: calc(100% - 82px);
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-section {
    border-bottom: none;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-link {
    width: 56px;
    height: 56px;
    min-height: 56px;
    padding: 0;
    margin: 8px 0;
    justify-content: center;
    border-radius: 14px;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-link i {
    margin: 0;
    font-size: 18px;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-submenu {
    display: none !important;
}

/* TOOLTIP CONTRAÍDO */

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-link::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 86px;
    top: var(--tooltip-top, 0px);
    transform: translateY(-50%);
    min-width: 150px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #1f1d33;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 12px 28px rgba(0,0,0,.22);
    z-index: 999999;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* No tooltip normal en botones con submenu */
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-group .ah-sidebar-group-btn::after {
    display: none;
}

/* Puente invisible para que no se cierre el submenu */
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-group::after {
    content: "";
    position: fixed;
    left: 72px;
    top: var(--flyout-top, 0px);
    width: 24px;
    height: 56px;
    z-index: 999998;
}

/* Flyout submenu contraído */
.ah-dashboard-sidebar.is-collapsed .ah-sidebar-group:hover .ah-sidebar-submenu {
    display: block !important;
    position: fixed;
    left: 86px;
    top: var(--flyout-top, 0px);
    width: 230px;
    padding: 12px;
    border-radius: 12px;
    background: #1f1d33;
    box-shadow: 0 12px 28px rgba(0,0,0,.25);
    z-index: 999999;
    pointer-events: auto;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-group:hover .ah-sidebar-submenu::before {
    content: "Mis spots";
    display: block;
    padding: 4px 10px 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-submenu a {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    color: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-submenu a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.ah-dashboard-sidebar.is-collapsed .ah-sidebar-submenu .ah-sidebar-badge {
    display: inline-flex;
}

/* ===============================
   CONTENIDO / ESPACIOS DESKTOP
================================ */

body {
    padding-left: 0 !important;
}

@media (min-width: 992px) {
    .dashboard-content,
    .user-dashboard-content,
    .dashboard-main,
    #dashboard {
        margin-left: 150px !important;
        width: calc(100% - 155px) !important;
        padding-left: 0 !important;
        transition: margin-left .25s ease, width .25s ease;
    }

    body.ah-sidebar-collapsed-body .dashboard-content,
    body.ah-sidebar-collapsed-body .user-dashboard-content,
    body.ah-sidebar-collapsed-body .dashboard-main,
    body.ah-sidebar-collapsed-body #dashboard {
        margin-left: 48px !important;
        width: calc(100% - 40px) !important;
        padding-left: 0 !important;
    }

    .dashboard-content .row,
    .user-dashboard-content .row,
    .dashboard-main .row,
    #dashboard .row {
        margin-left: 0 !important;
    }

    .dashboard-content .container,
    .dashboard-content .container-fluid,
    .user-dashboard-content .container,
    .user-dashboard-content .container-fluid,
    .dashboard-main .container,
    .dashboard-main .container-fluid,
    #dashboard .container,
    #dashboard .container-fluid {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
}

/* ===============================
   MOBILE SIDEBAR
================================ */

@media (max-width: 991px) {
    .ah-mobile-sidebar-trigger {
        display: flex;
    }

    .ah-sidebar-overlay {
        display: block;
    }

    .ah-dashboard-sidebar {
        width: 285px;
        max-width: 86vw;
        height: calc(100vh - 96px);
        top: 96px;
        transform: translateX(-105%);
        z-index: 99999;
        border-radius: 0 22px 22px 0;
        overflow-x: hidden;
        overflow-y: hidden;
    }

    .ah-dashboard-sidebar.is-mobile-open {
        transform: translateX(0);
    }

    .ah-dashboard-sidebar.is-collapsed {
        width: 285px;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-brand,
    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-title,
    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-link span,
    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-arrow,
    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-badge {
        display: flex;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-title {
        display: block;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-link {
        width: 100%;
        height: auto;
        min-height: 48px;
        padding: 0 14px;
        margin: 4px 0;
        justify-content: flex-start;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-submenu {
        display: none !important;
        position: static;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-group.is-open .ah-sidebar-submenu {
        display: block !important;
    }

    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-link::after,
    .ah-dashboard-sidebar.is-collapsed .ah-sidebar-group::after {
        display: none !important;
    }

    .ah-sidebar-toggle {
        display: none;
    }

    .ah-sidebar-mobile-close {
        display: flex;
    }

    .ah-sidebar-nav {
        height: calc(100% - 82px);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .ah-sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .dashboard-content,
    .user-dashboard-content,
    .dashboard-main,
    #dashboard {
        margin-left: 0 !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding: 35px 5px 5px 5px !important;
    }

    body,
    body.ah-sidebar-collapsed-body {
        padding-left: 0 !important;
    }

    body.ah-sidebar-mobile-open-body {
        overflow: hidden;
    }
}

@media (max-width: 520px) {
    .ah-mobile-sidebar-trigger {
        top: 106px;
        left: 12px;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 18px;
    }

    .ah-dashboard-sidebar {
        width: 275px;
        max-width: 88vw;
    }

    .ah-sidebar-brand img {
        width: 132px;
    }
}
