/* =========================================================
   Qimah Custom Header
   Logo and Actions OUTSIDE, Menu INSIDE glass bar
========================================================= */

/* Base Header - White glassy */
.qimah-header {
    position: sticky;
    top: 0;
    z-index: 10001;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(8px) saturate(200%);
    backdrop-filter: blur(8px) saturate(200%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Homepage: Pull hero up under header so header overlays it */
.home #id-hero-main,
.page-template-homepage #id-hero-main {
    margin-top: -80px;
    padding-top: 72px;
}

/* Main header layout */
.qimah-header-inner {
    display: flex;
    flex-direction: row-reverse; /* RTL: Logo right, actions left */
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    gap: 24px;
}

/* Logo (OUTSIDE glass bar, far right in RTL) */
.qimah-logo {
    flex-shrink: 0;
}

.qimah-logo a {
    display: flex;
    align-items: center;
}

.qimah-logo img {
    height: 48px;
    width: auto;
}

/* Logo switching based on theme */
.qimah-logo-link {
    position: relative;
}

/* Default: show dark logo (header is white/glassy) */
.qimah-logo-light {
    display: block;
}

.qimah-logo-dark {
    display: none;
}

/* Dark mode: swap to white logo */
html[data-theme="dark"] .qimah-logo-light {
    display: none;
}

html[data-theme="dark"] .qimah-logo-dark {
    display: block;
}

/* Glass Bar - Contains only menu items */
.qimah-nav-glass {
    flex: 1;
    display: flex;
    justify-content: center;
}

.qimah-nav-glass .qimah-nav-desktop {
    position: relative;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Desktop Navigation inside glass bar */
.qimah-menu {
    display: flex;
    flex-direction: row-reverse; /* RTL menu order */
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.qimah-menu > li > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--q-text, #1f302c);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 18px;
    border-radius: 999px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.qimah-menu > li > a:hover,
.qimah-menu > li > a:focus {
    background: rgba(30, 102, 73, 0.1);
    color: var(--q-green, #1e6649);
}

/* Active/Current menu item - green background like Tuwaiq's purple */
.qimah-menu > li.current-menu-item > a,
.qimah-menu > li.current-menu-parent > a,
.qimah-menu > li.current-menu-ancestor > a {
    background: var(--q-green, #1e6649);
    color: #fff;
}

.qimah-menu > li.current-menu-item > a:hover,
.qimah-menu > li.current-menu-parent > a:hover {
    background: var(--q-green-hover, #16533b);
    color: #fff;
}

/* Dropdown Arrow */
.qimah-dropdown-arrow {
    display: inline-flex;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.qimah-dropdown-arrow svg {
    width: 10px;
    height: 6px;
}

.qimah-has-submenu:hover .qimah-dropdown-arrow,
.qimah-has-submenu:focus-within .qimah-dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Submenu */
.qimah-has-submenu {
    position: relative;
}

.qimah-submenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 220px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 8px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.qimah-has-submenu:hover > .qimah-submenu,
.qimah-has-submenu:focus-within > .qimah-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.qimah-submenu li {
    margin: 0;
}

.qimah-submenu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--q-text, #1f302c);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: 10px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.qimah-submenu li a:hover,
.qimah-submenu li a:focus {
    background: rgba(30, 102, 73, 0.08);
    color: var(--q-green, #1e6649);
}

/* Header Actions (OUTSIDE glass bar, far left in RTL) */
.qimah-header-actions {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* My Account Button - Dark style for white header */
.qimah-btn-account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: transparent;
    color: var(--q-green, #1e6649) !important;
    font-weight: 700;
    font-size: 15px;
    border-radius: 999px;
    border: 2px solid var(--q-green, #1e6649);
    text-decoration: none;
    transition: all 0.25s ease;
}

.qimah-btn-account:hover,
.qimah-btn-account:focus {
    background: var(--q-green, #1e6649);
    color: #fff !important;
    box-shadow: 0 6px 20px rgba(30, 102, 73, 0.25);
}

/* Logged-in account button with avatar */
.qimah-btn-account--logged-in {
    padding: 6px 18px 6px 6px;
    background: rgba(30, 102, 73, 0.08);
    border-color: transparent;
}

.qimah-btn-account--logged-in:hover {
    background: rgba(30, 102, 73, 0.15);
    border-color: transparent;
    color: var(--q-green, #1e6649) !important;
    box-shadow: 0 6px 20px rgba(30, 102, 73, 0.15);
}

.qimah-account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(30, 102, 73, 0.2);
}

.qimah-account-greeting {
    font-weight: 600;
    font-size: 14px;
}

/* Theme toggle - Dark style for white header */
.qimah-header-actions .q-theme-toggle {
    background: rgba(30, 102, 73, 0.1);
    border-color: rgba(30, 102, 73, 0.2);
    color: var(--q-green, #1e6649);
}

.qimah-header-actions .q-theme-toggle:hover {
    background: rgba(30, 102, 73, 0.15);
}

/* Desktop: burger is fully gone */
@media (min-width: 1025px) {
    .qimah-menu-toggle {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }
}

@media (max-width: 1024px) {

  /* Hide desktop glass nav on mobile */
  .qimah-nav-glass {
    display: none !important;
  }

  /* Hide account button on mobile - it's in the mobile menu instead */
  .qimah-btn-account {
    display: none !important;
  }

  /* Turn header inner into a 3-slot grid */
  .qimah-header-inner {
    display: grid !important;
    grid-template-columns: auto 1fr auto; /* burger | logo | actions */
    grid-template-rows: 1fr;
    align-items: center;
    gap: 12px;
  }

  /* Force everything into row 1 explicitly */
  .qimah-menu-toggle {
    display: inline-flex !important;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    margin: 0 !important;
    position: relative;
    z-index: 10000; /* Above overlay */
  }

  .qimah-logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    margin: 0 !important;
    position: relative;
    z-index: 10000; /* Above overlay */
  }

  .qimah-header-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    display: inline-flex;
    flex-direction: row;
    gap: 10px;
    margin: 0 !important;
    position: relative;
    z-index: 10000; /* Above overlay */
  }

  /* Make tap targets consistent */
  .qimah-menu-toggle,
  .qimah-header-actions .q-theme-toggle {
    height: 44px;
  }
}


/* Hamburger button styles - MOBILE ONLY */
@media (max-width: 1024px) {
    .qimah-menu-toggle,
    .qimah-menu-toggle:focus,
    .qimah-menu-toggle:active,
    .qimah-menu-toggle:hover,
    .qimah-menu-toggle[aria-expanded="false"],
    .qimah-menu-toggle[aria-expanded="true"] {
        width: 44px;
        height: 44px;
        padding: 12px;
        background: #1e6649 !important;
        background-color: #1e6649 !important;
        border: 1px solid #1e6649 !important;
        border-radius: 12px;
        cursor: pointer;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        outline: none !important;
        box-shadow: none !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .qimah-menu-toggle .hamburger-line,
    .qimah-menu-toggle:focus .hamburger-line,
    .qimah-menu-toggle:active .hamburger-line,
    .qimah-menu-toggle[aria-expanded="false"] .hamburger-line,
    .qimah-menu-toggle[aria-expanded="true"] .hamburger-line {
        width: 20px;
        height: 2px;
        background: #fff !important;
        background-color: #fff !important;
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    /* X transformation when open */
    .qimah-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .qimah-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .qimah-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* Mobile Navigation Overlay - Fullscreen with liquid glass effect */
.qimah-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.33);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Account for WordPress admin bar */
.admin-bar .qimah-mobile-overlay {
    top: 32px;
    height: calc(100% - 32px);
}

@media screen and (max-width: 782px) {
    .admin-bar .qimah-mobile-overlay {
        top: 46px;
        height: calc(100% - 46px);
    }
}

.qimah-mobile-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.qimah-nav-mobile {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 100px 24px 32px;
    overflow-y: auto;
}

.qimah-mobile-menu-content {
    flex: 1;
}

.qimah-mobile-menu-footer {
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: auto;
}

/* Mobile Account Button (pill style at bottom) */
.qimah-mobile-account-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 32px;
    background: var(--q-green, #1e6649);
    color: #fff !important;
    font-weight: 700;
    font-size: 16px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(30, 102, 73, 0.3);
}

.qimah-mobile-account-btn:hover {
    background: var(--q-green-hover, #16533b);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(30, 102, 73, 0.4);
}

.qimah-mobile-account-btn--logged-in {
    background: rgba(30, 102, 73, 0.1);
    color: var(--q-green, #1e6649) !important;
    box-shadow: none;
    border: 2px solid var(--q-green, #1e6649);
}

.qimah-mobile-account-btn--logged-in:hover {
    background: var(--q-green, #1e6649);
    color: #fff !important;
}

.qimah-mobile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid currentColor;
}

.qimah-menu-mobile {
    list-style: none;
    margin: 0;
    padding: 0;
}

.qimah-menu-mobile > li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.qimah-menu-mobile > li:last-child {
    border-bottom: none;
}

.qimah-menu-mobile > li > a {
    display: block;
    padding: 14px 16px;
    color: var(--q-text, #1f302c);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border-radius: 10px;
}

.qimah-menu-mobile > li > a:hover {
    background: rgba(30, 102, 73, 0.08);
}

.qimah-menu-mobile > li.current-menu-item > a {
    background: var(--q-green, #1e6649);
    color: #fff;
}

/* Mobile Submenu */
.qimah-menu-mobile .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    /* Faster close transition */
    transition: max-height 0.25s ease-in, opacity 0.15s ease-in, padding 0.25s ease-in;
}

.qimah-menu-mobile .submenu-open > .sub-menu {
    max-height: 500px;
    opacity: 1;
    padding: 8px 0;
    /* Slower open transition */
    transition: max-height 0.5s ease-out, opacity 0.4s ease-out, padding 0.5s ease-out;
}

.qimah-menu-mobile .sub-menu li a {
    display: block;
    padding: 14px 16px 14px 24px;
    color: var(--q-text, #1f302c);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 10px;
    background: rgba(30, 102, 73, 0.06);
    margin-bottom: 6px;
    border-right: 3px solid var(--q-green, #1e6649);
}

.qimah-menu-mobile .sub-menu li a:hover {
    color: var(--q-green, #1e6649);
    background: rgba(30, 102, 73, 0.12);
}

/* Mobile Submenu Toggle Button */
.qimah-menu-mobile .menu-item-has-children {
    position: relative;
}

.qimah-menu-mobile .menu-item-has-children > a {
    padding-left: 50px;
}

.qimah-submenu-toggle {
    position: absolute;
    left: 8px;
    top: 10px;
    width: 36px;
    height: 36px;
    background: rgba(30, 102, 73, 0.08);
    border: none;
    border-radius: 8px;
    color: var(--q-green, #1e6649);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.qimah-submenu-toggle:hover {
    background: rgba(30, 102, 73, 0.15);
}

.qimah-submenu-toggle svg {
    width: 14px;
    height: 10px;
    min-width: 14px;
    min-height: 10px;
    display: block;
    transition: transform 0.2s ease;
}

.qimah-submenu-toggle svg path {
    stroke: currentColor;
    stroke-width: 2;
}

.submenu-open > .qimah-submenu-toggle svg {
    transform: rotate(180deg);
}

/* Prevent body scroll when mobile menu is open */
body.qimah-menu-open {
    overflow: hidden;
}

/* =========================================================
   Dark Mode Adjustments
========================================================= */
html[data-theme="dark"] .qimah-header {
    background: rgba(7, 24, 18, 0.8);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .qimah-nav-glass .qimah-nav-desktop {
    background: rgba(30, 40, 35, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .qimah-menu > li > a {
    color: var(--q-text, #eaf3f0);
}

html[data-theme="dark"] .qimah-menu > li > a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

html[data-theme="dark"] .qimah-submenu {
    background: rgba(30, 40, 35, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .qimah-submenu li a {
    color: var(--q-text, #eaf3f0);
}

html[data-theme="dark"] .qimah-submenu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

html[data-theme="dark"] .qimah-btn-account {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff !important;
}

html[data-theme="dark"] .qimah-btn-account:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

html[data-theme="dark"] .qimah-header-actions .q-theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

html[data-theme="dark"] .qimah-mobile-overlay {
    background: rgba(7, 24, 18, 0.5);
}

html[data-theme="dark"] .qimah-mobile-menu-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .qimah-mobile-account-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    box-shadow: none;
}

html[data-theme="dark"] .qimah-mobile-account-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

html[data-theme="dark"] .qimah-mobile-account-btn--logged-in {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.3);
}

html[data-theme="dark"] .qimah-mobile-account-btn--logged-in:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff !important;
}

/* Dark mode for logged-in desktop button */
html[data-theme="dark"] .qimah-btn-account--logged-in {
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
    color: #fff !important;
}

html[data-theme="dark"] .qimah-btn-account--logged-in:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff !important;
}

html[data-theme="dark"] .qimah-account-avatar {
    border-color: rgba(255, 255, 255, 0.3);
}

html[data-theme="dark"] .qimah-menu-mobile > li > a {
    color: var(--q-text, #eaf3f0);
}

html[data-theme="dark"] .qimah-menu-mobile .sub-menu li a {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-right-color: rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .qimah-menu-mobile .sub-menu li a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Dark mode: keep burger green with white lines */
html[data-theme="dark"] .qimah-menu-toggle {
    background: var(--q-green, #1e6649);
    border-color: var(--q-green, #1e6649);
}

html[data-theme="dark"] .qimah-menu-toggle .hamburger-line {
    background: #fff;
}

html[data-theme="dark"] .hamburger-line {
    background: #fff;
}

/* =========================================================
   Responsive Breakpoints
========================================================= */

@media (max-width: 1024px) {
    .qimah-nav-glass {
        display: none !important;
    }

    .qimah-menu-toggle {
        display: flex !important;
    }

    /* Mobile layout: Hamburger LEFT, Logo CENTER, Actions RIGHT */
    .qimah-header-inner {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
    }

    .qimah-menu-toggle {
        grid-column: 1;
        justify-self: start;
    }

    .qimah-logo {
        grid-column: 2;
        justify-self: center;
    }

    .qimah-header-actions {
        grid-column: 3;
        justify-self: end;
        flex-direction: row;
    }
}

@media (max-width: 600px) {
    .qimah-header {
        padding: 12px 16px;
    }

    .qimah-header-inner {
        gap: 8px;
    }

    .qimah-btn-account {
        padding: 10px 16px;
        font-size: 14px;
    }

    .qimah-logo img {
        height: 36px;
    }

    .qimah-menu-toggle[aria-expanded] {
        width: 40px;
        height: 40px;
        padding: 10px;
    }

    .hamburger-line {
        width: 18px;
    }
}

@media (max-width: 420px) {
    .qimah-header-actions {
        gap: 8px;
    }

    .qimah-btn-account {
        padding: 8px 12px;
        font-size: 13px;
    }

    .qimah-header-actions .q-theme-toggle {
        width: 38px;
        height: 38px;
    }
}

/* =========================================================
   Account Dropdown Menu
========================================================= */

.qimah-account-dropdown {
    position: relative;
}

/* Account button as dropdown trigger - full button reset */
.qimah-account-dropdown .qimah-btn-account {
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(30, 102, 73, 0.08);
    border: 2px solid transparent;
    color: var(--q-green, #1e6649) !important;
}

/* Dropdown arrow */
.qimah-account-dropdown .qimah-dropdown-arrow {
    font-size: 10px;
    margin-right: 4px;
    opacity: 0.7;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.qimah-account-dropdown.is-open .qimah-dropdown-arrow,
.qimah-account-dropdown:hover .qimah-dropdown-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown Menu Container - Glassmorphic like header nav */
.qimah-account-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    min-width: 280px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

/* Show on hover or when open class is added */
.qimah-account-dropdown:hover .qimah-account-menu,
.qimah-account-dropdown.is-open .qimah-account-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Menu Items */
.qimah-account-menu-items {
    list-style: none;
    margin: 0;
    padding: 8px;
}

.qimah-account-menu-items li {
    margin: 0;
}

.qimah-account-menu-items li a {
    display: block;
    padding: 12px 16px;
    color: var(--q-text, #1f302c);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.qimah-account-menu-items li a:hover {
    background: rgba(30, 102, 73, 0.08);
    color: var(--q-green, #1e6649);
}

/* Active menu item */
.qimah-account-menu-items li.is-active a {
    background: rgba(30, 102, 73, 0.1);
    color: var(--q-green, #1e6649);
}

/* Logout Footer */
.qimah-account-menu-footer {
    padding: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.qimah-account-menu-footer .qimah-logout-link {
    display: block;
    padding: 12px 16px;
    color: #dc3545 !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-radius: 10px;
    transition: all 0.15s ease;
    text-align: center;
}

.qimah-account-menu-footer .qimah-logout-link:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333 !important;
}

/* =========================================================
   Account Dropdown - Dark Mode
========================================================= */

html[data-theme="dark"] .qimah-account-dropdown .qimah-btn-account {
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
    color: #fff !important;
}

html[data-theme="dark"] .qimah-account-dropdown .qimah-btn-account:hover {
    background: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .qimah-account-menu {
    background: rgba(30, 40, 35, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .qimah-account-menu-items li a {
    color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .qimah-account-menu-items li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

html[data-theme="dark"] .qimah-account-menu-items li.is-active a {
    background: rgba(255, 255, 255, 0.1);
    color: #10b981;
}

html[data-theme="dark"] .qimah-account-menu-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .qimah-account-menu-footer .qimah-logout-link {
    color: #f87171 !important;
}

html[data-theme="dark"] .qimah-account-menu-footer .qimah-logout-link:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5 !important;
}

/* =========================================================
   Account Dropdown - Mobile (hide on mobile)
========================================================= */

@media (max-width: 1024px) {
    .qimah-account-dropdown {
        display: none !important;
    }
}

/* =========================================================
   Header Cart Icon (courses archive only, all breakpoints)
========================================================= */

.qimah-header-cart {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--q-text, #1f302c);
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
    position: relative;
    font-family: inherit;
}

.qimah-header-cart:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--q-text, #1f302c);
}

/* Count badge — small green circle, hidden when 0 */
.qimah-header-cart__count {
    position: absolute;
    top: -4px;
    inset-inline-start: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--q-green, #22c55e);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--q-bg, #fff);
    box-sizing: content-box;
}

/* Total text next to icon (e.g., "399 ر.س") */
.qimah-header-cart__total {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* Mobile: hide total text, keep icon + badge only */
@media (max-width: 1023px) {
    .qimah-header-cart__total {
        display: none;
    }
}

/* Dark mode */
html[data-theme="dark"] .qimah-header-cart {
    color: var(--q-text, #eaf3f0);
}

html[data-theme="dark"] .qimah-header-cart:hover {
    background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .qimah-header-cart__count {
    border-color: var(--q-bg, #0d1f17);
}

/* Mobile grid: expand to 4 columns ONLY when cart icon exists (archive page) */
@media (max-width: 1024px) {
    .qimah-header-inner:has(.qimah-header-cart) {
        grid-template-columns: auto 1fr auto auto; /* burger | logo | cart | actions */
    }

    .qimah-header-cart {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        align-self: center;
        z-index: 10000;
    }

    .qimah-header-inner:has(.qimah-header-cart) .qimah-header-actions {
        grid-column: 4;
    }
}

/* style.css cancels reset.css's button hover/focus paint with `color: inherit`
   (0,1,1), which outranks these toggles' own colour and shifted them to the
   body ink on focus. Pin it at (0,2,0) so focus stays a no-op. */
.qimah-menu-toggle:hover,
.qimah-menu-toggle:focus,
.qimah-submenu-toggle:hover,
.qimah-submenu-toggle:focus {
    color: var(--q-primary, #1e6649);
}
