/**
 * Mobile header + sidebar navigation polish (public site + dashboard)
 */

/* ══════════════════════════════════════════════════════
   Public site header (-type-4)
   ══════════════════════════════════════════════════════ */
@media (max-width: 1199px) {
    .header.-type-4 {
        z-index: 150;
        padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
    }

    .header.-type-4 .header__container {
        padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 8px !important;
    }

    .header.-type-4 .header-right__icons > div {
        display: block !important;
    }

    .header.-type-4 .header-right__icons button[data-el-toggle=".js-mobile-menu-toggle"] {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
        background: rgba(106, 27, 154, 0.08);
        transition: background 0.2s ease;
    }

    .header.-type-4 .header-right__icons button[data-el-toggle=".js-mobile-menu-toggle"]:hover {
        background: rgba(106, 27, 154, 0.14);
    }

    .header.-type-4 .header-right__icons .icon-mobile-menu {
        font-size: 20px;
        color: var(--eman-purple);
    }

    .header.-type-4 .eman-header-actions {
        gap: 6px;
    }

    .header.-type-4 .eman-lesson-search-wrap {
        display: none;
    }

    /* Drawer */
    .header.-type-4 .header-menu {
        width: min(300px, 92vw) !important;
        max-width: min(300px, calc(100vw - 24px)) !important;
        z-index: 200 !important;
        height: 100dvh !important;
        height: 100vh !important;
        box-shadow: 4px 0 32px rgba(15, 23, 42, 0.18);
    }

    html[dir="rtl"] .header.-type-4 .header-menu {
        left: auto !important;
        right: 0 !important;
        box-shadow: -4px 0 32px rgba(15, 23, 42, 0.18);
    }

    html[dir="ltr"] .header.-type-4 .header-menu {
        left: 0 !important;
        right: auto !important;
    }

    .header.-type-4 .header-menu .header-menu__content {
        background: var(--eman-bg, #fff);
        padding-top: max(12px, env(safe-area-inset-top, 0px));
    }

    .header.-type-4 .header-menu.-is-el-visible .header-menu-bg {
        z-index: 199 !important;
        background-color: rgba(15, 19, 25, 0.55) !important;
        backdrop-filter: blur(3px);
    }

    .header.-type-4 .header-menu.-is-el-visible .header-menu-close {
        z-index: 210 !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .header.-type-4 .header-menu-close .size-40 {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: var(--eman-bg, #fff) !important;
        box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
        border: 1px solid var(--eman-border-light, #e0e0e0);
    }

    .header.-type-4 .mobile-user-links {
        display: flex !important;
        flex-direction: column;
        padding: 12px 14px 16px !important;
        border-bottom: 1px solid var(--eman-border-light, #e0e0e0);
        background: var(--eman-bg-subtle, #f8f9fe);
    }

    .header.-type-4 .mobile-user-links a {
        display: flex !important;
        align-items: center;
        gap: 12px;
        min-height: 48px !important;
        padding: 10px 12px !important;
        margin-bottom: 4px;
        border-radius: 10px !important;
        border-bottom: none !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        color: var(--eman-text-dark, #333) !important;
        transition: background 0.15s ease;
    }

    .header.-type-4 .mobile-user-links a:hover {
        background: rgba(106, 27, 154, 0.08);
        color: var(--eman-purple) !important;
    }

    .header.-type-4 .mobile-user-links a .lucide-icon {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        color: var(--eman-purple);
    }

    .header.-type-4 .header-menu .menu__nav li > a {
        border-radius: 10px !important;
    }

    .header.-type-4 .header-menu .menu__nav li > a .lucide-icon {
        width: 18px;
        height: 18px;
        color: var(--eman-purple);
    }
}

@media (max-width: 767px) {
    .header.-type-4 .header__container .row {
        gap: 8px;
    }

    .header.-type-4 .eman-header__logo img {
        height: 34px;
    }

    .header.-type-4 .profile-pill {
        margin-inline-start: 4px;
    }

    .header.-type-4 .header-right__buttons .eman-lang-switcher-wrap {
        display: none;
    }

    .header.-type-4 .header-menu {
        width: min(300px, 94vw) !important;
        max-width: calc(100vw - 16px) !important;
    }
}

/* Public header — dark mode drawer */
@media (max-width: 1199px) {
    html.-dark-mode .header.-type-4 .header-menu .header-menu__content {
        background: var(--eman-bg, #181f2c);
    }

    html.-dark-mode .header.-type-4 .mobile-user-links {
        background: var(--eman-bg-subtle, #222a38);
        border-bottom-color: var(--eman-border-light, #2d3748);
    }

    html.-dark-mode .header.-type-4 .mobile-user-links a {
        color: var(--eman-text-dark, #eef1f6) !important;
    }

    html.-dark-mode .header.-type-4 .mobile-user-links a:hover {
        background: rgba(106, 27, 154, 0.18);
        color: var(--eman-purple-light, #d4a5e0) !important;
    }

    html.-dark-mode .header.-type-4 .header-menu-close .size-40 {
        background: var(--eman-bg, #181f2c) !important;
        border-color: var(--eman-border-light, #2d3748);
    }

    html.-dark-mode .header.-type-4 .header-menu .menu__nav li > a {
        color: var(--eman-text-light, #c5cdd9) !important;
    }

    html.-dark-mode .header.-type-4 .header-menu .menu__nav li.is-active > a,
    html.-dark-mode .header.-type-4 .header-menu .menu__nav li > a:hover {
        background: rgba(106, 27, 154, 0.18);
        color: var(--eman-purple-light, #d4a5e0) !important;
    }
}

/* ══════════════════════════════════════════════════════
   Dashboard header + sidebar
   ══════════════════════════════════════════════════════ */
@media (max-width: 991px) {
    .header.-dashboard {
        z-index: 130;
        padding-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px));
    }

    .header.-dashboard .header__container {
        gap: 8px;
    }

    .header.-dashboard .header__container > .d-flex:first-child {
        min-width: 0;
        flex: 1 1 auto;
        gap: 8px;
    }

    .header.-dashboard .mobile-menu-trigger {
        flex-shrink: 0;
        border-radius: 12px;
        background: rgba(106, 27, 154, 0.08);
        color: var(--eman-purple);
    }

    .header.-dashboard .mobile-menu-trigger:hover {
        background: rgba(106, 27, 154, 0.14);
    }

    .header.-dashboard .header-actions {
        flex-shrink: 0;
        gap: 2px;
    }

    .header.-dashboard .header-actions .eman-lesson-search-wrap {
        display: none;
    }

    .header.-dashboard .header-actions .js-darkmode-toggle {
        display: flex;
    }

    /* Sidebar drawer */
    .eman-dashboard .dashboard__sidebar.eman-dash-sidebar {
        top: var(--eman-dash-header-h, 64px) !important;
        bottom: 0 !important;
        height: auto !important;
        max-height: none !important;
        width: min(300px, 92vw) !important;
        padding: 0 !important;
        border-inline-end: 1px solid var(--color-border-primary) !important;
        border-radius: 0 16px 16px 0;
        box-shadow: 8px 0 40px rgba(15, 23, 42, 0.2);
        z-index: 140 !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

    html[dir="rtl"] .eman-dashboard .dashboard__sidebar.eman-dash-sidebar {
        border-radius: 16px 0 0 16px;
        box-shadow: -8px 0 40px rgba(15, 23, 42, 0.2);
    }

    .eman-dash-sidebar__inner {
        min-height: 100%;
        padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .eman-dash-sidebar__close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin-inline-start: auto;
        margin-bottom: 8px;
        border: 0;
        border-radius: 12px;
        background: var(--color-bg-main);
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
    }

    .eman-dash-sidebar__close:hover {
        background: rgba(106, 27, 154, 0.1);
        color: var(--eman-purple);
    }

    .eman-dash-sidebar__close .lucide-icon,
    .eman-dash-sidebar__close svg {
        width: 22px;
        height: 22px;
    }

    .eman-dash-sidebar__topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 4px;
        padding: 4px 2px 0;
    }

    .eman-dash-sidebar__topbar-label {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--color-text-secondary);
    }

    .eman-dash-sidebar__link {
        min-height: 48px;
        padding: 12px 14px !important;
        border-radius: 12px !important;
        font-size: 0.95rem;
    }

    .eman-dash-sidebar__icon {
        width: 36px !important;
        height: 36px !important;
    }

    .eman-dashboard .dashboard.-home-9:not(.-is-sidebar-hidden) .dashboard__main::after,
    .eman-dashboard .js-dashboard-home-9:not(.-is-sidebar-hidden) .dashboard__main::after {
        z-index: 125 !important;
        background-color: rgba(15, 19, 25, 0.5) !important;
        backdrop-filter: blur(2px);
    }
}

@media (min-width: 992px) {
    .eman-dash-sidebar__close,
    .eman-dash-sidebar__topbar {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .header.-dashboard {
        height: 64px;
    }

    .header.-dashboard .header-actions .action-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    .header.-dashboard .header-actions .eman-lang-switcher-wrap {
        display: none;
    }
}

@media (max-width: 575px) {
    .header.-dashboard .header-actions .eman-dash-alerts-wrap {
        display: flex;
    }

    .header.-dashboard .profile-pill img {
        width: 32px;
        height: 32px;
    }
}

/* Dashboard dark mode — mobile drawer */
@media (max-width: 991px) {
    html.-dark-mode .header.-dashboard .mobile-menu-trigger {
        background: rgba(106, 27, 154, 0.2);
        color: var(--eman-purple-light, #d4a5e0);
    }

    html.-dark-mode .eman-dashboard .dashboard__sidebar.eman-dash-sidebar {
        background: var(--eman-bg, #181f2c) !important;
        border-color: var(--eman-border-light, #2d3748) !important;
    }

    html.-dark-mode .eman-dash-sidebar__close {
        background: var(--eman-bg-subtle, #222a38);
        color: var(--eman-text-light, #c5cdd9);
    }
}
