/* CourseBond marketplace header
   Udemy-style top nav (logo / categories / search / auth-aware icons)
   plus a sticky category bar. Tokens are inherited from style.css :root.
   Loaded after coursebond-overrides.css so it always wins.
   ============================================================ */

/* Hide Blocksy's default header whenever the marketplace shell is active. */
body.cb-marketplace-shell > .ct-header,
body.cb-marketplace-shell .ct-header { display: none !important; }

/* Reduce Blocksy top spacing now that we own the header. */
body.cb-marketplace-shell .site-content { padding-top: 0 !important; }

/* ============================================================
   Header bar
   ============================================================ */
.cb-mh {
    background: #fff;
    border-bottom: 1px solid var(--cb-border);
    position: sticky;
    top: 0;
    z-index: 90;
    font-family: var(--cb-font);
}
.cb-mh__inner {
    max-width: var(--cb-content-max);
    margin-inline: auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Logo */
.cb-mh__logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--cb-purple);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}
.cb-mh__logo-mark { width: 28px; height: 28px; }
.cb-mh__logo-text { line-height: 1; }
.cb-mh__logo:hover { color: var(--cb-purple-hover); }

/* Categories trigger */
.cb-mh__explore {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    color: var(--cb-text);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 4px;
    flex-shrink: 0;
}
.cb-mh__explore:hover,
.cb-mh__explore[aria-expanded="true"] {
    background: var(--cb-bg);
    color: var(--cb-purple);
}
.cb-mh__chev { width: 12px; height: 8px; transition: transform 0.15s; }
.cb-mh__explore[aria-expanded="true"] .cb-mh__chev { transform: rotate(180deg); }

/* Search */
.cb-mh__search {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--cb-bg);
    border: 1px solid var(--cb-border);
    border-radius: 999px;
    padding: 0 6px 0 14px;
    height: 44px;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    min-width: 200px;
}
.cb-mh__search:focus-within {
    border-color: var(--cb-purple);
    box-shadow: 0 0 0 3px rgba(107,47,179,0.12);
    background: #fff;
}
.cb-mh__search-icon {
    width: 18px;
    height: 18px;
    color: var(--cb-text-light);
    flex-shrink: 0;
}
.cb-mh__search-input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 0 10px;
    font: inherit;
    font-size: 14px;
    color: var(--cb-text);
    min-width: 0;
}
.cb-mh__search-input::placeholder { color: var(--cb-text-light); }
.cb-mh__search-submit {
    background: var(--cb-purple);
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    height: 32px;
}
.cb-mh__search-submit:hover { background: var(--cb-purple-hover); }

/* Inline nav links */
.cb-mh__link {
    color: var(--cb-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 6px;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 4px;
}
.cb-mh__link:hover { color: var(--cb-purple); }

/* Icon buttons (wishlist / cart / notifications) */
.cb-mh__icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--cb-text);
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.cb-mh__icon-btn:hover {
    background: var(--cb-bg);
    color: var(--cb-purple);
}
.cb-mh__icon-btn svg { width: 20px; height: 20px; }
.cb-mh__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--cb-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    box-shadow: 0 0 0 2px #fff;
}

/* Avatar + dropdown */
.cb-mh__avatar-wrap { position: relative; flex-shrink: 0; }
.cb-mh__avatar {
    border: 0;
    background: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    padding: 0;
    display: block;
    transition: box-shadow 0.15s;
}
.cb-mh__avatar:hover,
.cb-mh__avatar[aria-expanded="true"] {
    box-shadow: 0 0 0 2px var(--cb-purple);
}
.cb-mh__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.cb-mh__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    z-index: 95;
    overflow: hidden;
}
.cb-mh__menu[hidden] { display: none; }
.cb-mh__menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--cb-border);
}
.cb-mh__menu-head img { width: 48px; height: 48px; border-radius: 50%; }
.cb-mh__menu-head strong {
    display: block;
    font-size: 14px;
    color: var(--cb-text);
    margin-bottom: 2px;
}
.cb-mh__menu-head span {
    display: block;
    font-size: 12px;
    color: var(--cb-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}
.cb-mh__menu-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}
.cb-mh__menu-list li a {
    display: block;
    padding: 10px 16px;
    color: var(--cb-text);
    font-size: 14px;
    text-decoration: none;
}
.cb-mh__menu-list li a:hover {
    background: var(--cb-purple-soft);
    color: var(--cb-purple);
}
.cb-mh__menu-sep {
    height: 1px;
    background: var(--cb-border);
    margin: 6px 0;
}

/* Auth buttons */
.cb-mh__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border: 1.5px solid transparent;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}
.cb-mh__btn--ghost {
    color: var(--cb-purple);
    border-color: var(--cb-purple);
    background: #fff;
}
.cb-mh__btn--ghost:hover {
    background: rgba(107,47,179,0.08);
    color: var(--cb-purple);
}
.cb-mh__btn--solid {
    color: #fff;
    background: var(--cb-purple);
    border-color: var(--cb-purple);
}
.cb-mh__btn--solid:hover {
    background: var(--cb-purple-hover);
    border-color: var(--cb-purple-hover);
    color: #fff;
}

/* ============================================================
   Mega menu (Categories dropdown)
   ============================================================ */
.cb-mh-mega {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--cb-border);
    box-shadow: 0 16px 32px rgba(0,0,0,0.08);
    z-index: 89;
}
.cb-mh-mega[hidden] { display: none; }
.cb-mh-mega__inner {
    max-width: var(--cb-content-max);
    margin-inline: auto;
    padding: 16px 24px 24px;
}
.cb-mh-mega__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 4px;
}
.cb-mh-mega__list a {
    display: block;
    padding: 12px 14px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--cb-text);
    transition: background 0.15s;
}
.cb-mh-mega__list a:hover {
    background: var(--cb-purple-soft);
}
.cb-mh-mega__name {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: var(--cb-text);
    margin-bottom: 2px;
}
.cb-mh-mega__list a:hover .cb-mh-mega__name { color: var(--cb-purple); }
.cb-mh-mega__desc {
    display: block;
    font-size: 12px;
    color: var(--cb-text-light);
    line-height: 1.4;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    display: -webkit-box;
}
.cb-mh-mega__all a {
    color: var(--cb-purple);
    font-weight: 700;
}

/* ============================================================
   Category bar (under header)
   ============================================================ */
.cb-cat-bar {
    background: #fff;
    border-bottom: 1px solid var(--cb-border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    position: sticky;
    top: 68px; /* falls under sticky header */
    z-index: 88;
}
.cb-cat-bar::-webkit-scrollbar { display: none; }
.cb-cat-bar__inner {
    max-width: var(--cb-content-max);
    margin-inline: auto;
    padding: 0 24px;
    display: flex;
    gap: 0;
    white-space: nowrap;
}
.cb-cat-bar__item {
    display: inline-flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--cb-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.cb-cat-bar__item:hover,
.cb-cat-bar__item.is-active {
    color: var(--cb-purple);
    border-bottom-color: var(--cb-purple);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
    .cb-mh__link--teach { display: none; }
}
@media (max-width: 980px) {
    .cb-mh__inner { gap: 10px; padding: 10px 16px; }
    .cb-mh__explore,
    .cb-mh__link { display: none; }
    .cb-mh-mega__list { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 720px) {
    .cb-mh__logo-text { display: none; }
    .cb-mh__search { height: 40px; }
    .cb-mh__search-submit { display: none; }
    .cb-mh-mega__list { grid-template-columns: repeat(2, 1fr); }
    .cb-cat-bar { top: 60px; }
}
@media (max-width: 540px) {
    .cb-cat-bar__item { padding: 12px 12px; font-size: 13px; }
    .cb-mh-mega__list { grid-template-columns: 1fr; }
    .cb-mh__menu { width: calc(100vw - 24px); right: -8px; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    .cb-mh, .cb-cat-bar { display: none !important; }
}
