/**
 * CONTA - Custom Styles
 */

/* Hide topbar */
.navbar-custom {
    display: none !important;
}

.content-page {
    margin-top: 0 !important;
    padding-top: 20px;
}

/* ============================================
   SIDEBAR STRUCTURE
   ============================================ */

.leftside-menu {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Hide Hyper's default scroll container */
.leftside-menu > .h-100,
.leftside-menu > #leftside-menu-container,
.leftside-menu > div:not(.logo-row):not(.sidebar-menu-wrap):not(.sidebar-user-box) {
    display: none !important;
}

/* Logo Row */
.logo-row {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 10px;
    flex-shrink: 0;
}

.logo-row .logo-link {
    display: flex;
    align-items: center;
}

.logo-row .logo-full {
    display: block;
}

.logo-row .logo-small {
    display: none;
}

.logo-row .logo-white {
    display: none;
}

/* Dividers */
.side-nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 15px;
    list-style: none;
}

[data-menu-color="light"] .side-nav-divider {
    background: rgba(0,0,0,0.1);
}

/* User Box */
.sidebar-user-box {
    display: flex !important;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255,255,255,0.08);
    flex: 0 0 auto !important;
}

[data-menu-color="light"] .sidebar-user-box {
    background: rgba(0,0,0,0.04);
}

/* Ensure menu wrapper fills space */
.sidebar-menu-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.sidebar-user-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    color: inherit;
    opacity: 0.7;
    font-size: 1.2rem;
}

.sidebar-logout:hover {
    opacity: 1;
}

/* ============================================
   COLLAPSED SIDEBAR
   ============================================ */

html[data-sidenav-size="condensed"] .logo-row {
    justify-content: center;
    padding: 15px 5px;
}

html[data-sidenav-size="condensed"] .logo-row .btn-toggle-menu {
    display: none;
}

html[data-sidenav-size="condensed"] .logo-row .logo-full {
    display: none !important;
}

html[data-sidenav-size="condensed"] .logo-row .logo-small {
    display: block !important;
}

html[data-sidenav-size="condensed"] .sidebar-user-box {
    justify-content: center;
    padding: 12px 5px;
}

html[data-sidenav-size="condensed"] .sidebar-user-name {
    display: none !important;
}

html[data-sidenav-size="condensed"] .side-nav-divider {
    margin: 8px 5px;
}

/* Desktop Collapse Button */
.sidebar-collapse-btn {
    flex: 0 0 auto;
    padding: 10px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

[data-menu-color="light"] .sidebar-collapse-btn {
    border-top-color: rgba(0,0,0,0.1);
}

.btn-sidebar-collapse {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 8px 0;
    font-size: 14px;
    text-align: left;
}

.btn-sidebar-collapse:hover {
    opacity: 1;
}

.btn-sidebar-collapse i {
    font-size: 1.2rem;
}

.btn-sidebar-collapse .icon-expand {
    display: none !important;
}

/* Hide top hamburger on desktop */
@media (min-width: 992px) {
    .logo-row .btn-toggle-menu {
        display: none !important;
    }
}

/* Collapsed state for collapse button */
html[data-sidenav-size="condensed"] .sidebar-collapse-btn {
    padding: 10px 5px;
    text-align: center;
}

html[data-sidenav-size="condensed"] .btn-sidebar-collapse {
    justify-content: center;
}

html[data-sidenav-size="condensed"] .btn-sidebar-collapse span {
    display: none;
}

html[data-sidenav-size="condensed"] .btn-sidebar-collapse .icon-collapse {
    display: none !important;
}

html[data-sidenav-size="condensed"] .btn-sidebar-collapse .icon-expand {
    display: inline-block !important;
}

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

@media (max-width: 991.98px) {
    .leftside-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        width: 260px !important;
    }

    .leftside-menu.show {
        transform: translateX(0);
        background: #313a46 !important;
    }

    /* Hide desktop controls on mobile, use white logo */
    .leftside-menu .btn-toggle-menu,
    .leftside-menu .sidebar-collapse-btn {
        display: none !important;
    }

    .leftside-menu .logo-full {
        display: none !important;
    }

    .leftside-menu .logo-white {
        display: block !important;
    }

    /* Lighter text/icons for dark background */
    .leftside-menu .side-nav-link {
        color: rgba(255,255,255,0.85) !important;
    }

    .leftside-menu .side-nav-link i {
        color: rgba(255,255,255,0.7) !important;
    }

    .leftside-menu .side-nav-link:hover,
    .leftside-menu .side-nav-link.active {
        color: #fff !important;
    }

    .leftside-menu .side-nav-link:hover i,
    .leftside-menu .side-nav-link.active i {
        color: #fff !important;
    }

    .leftside-menu .sidebar-user-name {
        color: rgba(255,255,255,0.85) !important;
    }

    .leftside-menu .sidebar-logout {
        color: rgba(255,255,255,0.7) !important;
    }

    .content-page {
        margin-left: 0 !important;
    }

    /* Mobile hamburger in page title - inline with title */
    .page-title-box {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px;
        flex-wrap: nowrap !important;
    }

    .page-title-box .page-title {
        margin: 0;
        flex: 1;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.5rem;
        padding: 0;
        cursor: pointer;
        color: inherit;
        opacity: 0.8;
        flex-shrink: 0;
        width: 32px;
        height: 32px;
    }

    .mobile-menu-btn:hover {
        opacity: 1;
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

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

@media (min-width: 992px) {
    .mobile-menu-btn {
        display: none !important;
    }
}

/* Desktop-only items */
@media (max-width: 991.98px) {
    .desktop-only {
        display: none !important;
    }
}

/* Hide Hyper default toggle buttons */
.button-sm-hover,
.button-close-fullsidebar,
.button-toggle-menu {
    display: none !important;
}
