/* ==========================================================================
   MADE EASY Publications — redesigned site header
   --------------------------------------------------------------------------
   Loaded on every page from eBook/layout/header.php. Everything is scoped
   under .nhh so it cannot leak into style.css / screens.css territory.
   Responsive: 1200 / 1024 / 900 / 700 / 560 / 420 breakpoints.
   ========================================================================== */

/* Single source of truth for the site's side gutter. The exam menu bar's own
   width comes from this (.nhh__inner below), so any band that has to line up
   with the menu — e.g. the home page hero slider in newhome.css — reads the
   same variable instead of repeating the value. Declared on :root because this
   file loads on every page, so the variable is always defined. */
:root { --me-gutter: clamp(12px, 2vw, 34px); }

.nhh {
    --nhh-bg: #eaf2fd;
    --nhh-navy: #1e5799;
    --nhh-navy-2: #17497f;
    --nhh-active: #3b93e0;
    --nhh-icon: #2b7fd4;
    --nhh-orange: #f0932b;
    --nhh-orange-2: #e07d12;
    --nhh-ink: #16233c;
    --nhh-border: #2b6cb0;

    width: 100%;
    background: var(--nhh-bg);
    padding: 16px 0 0;
    font-family: "Open Sans", "Segoe UI", Arial, sans-serif;
    box-sizing: border-box;
}

.nhh *,
.nhh *:before,
.nhh *:after { box-sizing: border-box; }

.nhh ul { list-style: none; margin: 0; padding: 0; }
.nhh li { float: none; }
.nhh a { text-decoration: none; }
.nhh img { display: block; border: 0; max-width: 100%; }
.nhh button { font-family: inherit; cursor: pointer; border: 0; background: none; }

.nhh__inner {
    width: 100%;
    padding: 0 var(--me-gutter);
}

/* ---------- row 1 : logo + utility + search ------------------------------ */

.nhh__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 16px;
}

.nhh__logo { flex: 0 0 auto; display: block; }
.nhh__logo img { width: 100%; max-width: 330px; height: auto; }

.nhh__right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    padding-top: 4px;
}

.nhh__util {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 22px;
}
.nhh__util-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.nhh__ico {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: var(--nhh-icon);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nhh__ico svg { width: 14px; height: 14px; }

.nhh .nhh__util-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--nhh-ink);
    letter-spacing: .2px;
    white-space: nowrap;
    transition: color .18s ease;
}
.nhh .nhh__util-link:hover { color: var(--nhh-navy); }

/* notification bubble keeps its old JS panel, only the trigger is restyled */
.nhh .notification { position: static; display: inline-flex; align-items: center; gap: 4px; }
.nhh .notificoncount {
    background: #e02b26;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 9px;
}

/* ---------- search ------------------------------------------------------- */

.nhh__search { width: 100%; max-width: 620px; }
.nhh__search form {
    display: flex;
    align-items: stretch;
    width: 100%;
    background: #fff;
    border: 1.5px solid var(--nhh-border);
    border-radius: 8px;
    overflow: hidden;
}
.nhh__search input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    border: 0;
    outline: none;
    padding: 0 14px;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--nhh-ink);
    text-align: center;
    background: #fff;
    float: none;
}
.nhh__search input[type="text"]::placeholder { color: #7c8ba3; }
.nhh .nhh__search-btn {
    flex: 0 0 auto;
    width: 58px;
    background: var(--nhh-navy-2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease;
}
.nhh .nhh__search-btn:hover { background: #123b69; }
.nhh__search-btn svg { width: 21px; height: 21px; }

/* ---------- row 2 : exam nav bar ---------------------------------------- */

.nhh__nav {
    display: flex;
    align-items: stretch;
    background: linear-gradient(180deg, #2361a6 0%, var(--nhh-navy) 45%, var(--nhh-navy-2) 100%);
    border-radius: 10px;
    min-height: 52px;
    position: relative;
}

.nhh__tabs {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    min-width: 0;
}
.nhh__tabs > li { display: flex; }

.nhh .nhh__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 100%;
    min-height: 52px;
    padding: 0 clamp(12px, 1.6vw, 28px);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, .18);
    transition: background .18s ease;
}
.nhh .nhh__tab:hover { background: rgba(255, 255, 255, .12); }
.nhh .nhh__tab.is-active { background: var(--nhh-active); }
.nhh__tabs > li:first-child .nhh__tab { border-radius: 10px 0 0 10px; }

.nhh__caret {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    flex: 0 0 auto;
}
.nhh__caret:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    margin: -2px 0 0 -4px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--nhh-navy);
}

/* ---------- "More" dropdown --------------------------------------------- */

/* Anchored to the nav bar (not the More tab) so it can never run off-screen. */
.nhh__more { position: static; }
.nhh__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 200;
    margin-top: 6px;
    width: min(720px, calc(100vw - 24px));
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d8e4f5;
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(20, 33, 61, .18);
    padding: 16px 18px;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 18px;
}
.nhh__more.is-open .nhh__dropdown { display: grid; }
/* the category column holds the long list, so let it wrap into two */
.nhh__dd-group--cats > ul { columns: 2; column-gap: 14px; }
.nhh__dd-group--cats > ul > li { break-inside: avoid; }

.nhh__dd-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #7c8ba3;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid #eef3fa;
}
.nhh__dropdown ul { display: block; }
.nhh__dropdown li {
    display: block;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
}
.nhh__dropdown li a {
    display: block;
    padding: 7px 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--nhh-ink);
    border-radius: 6px;
    line-height: 1.35;
    text-transform: none;
    background: none;
    width: auto;
    height: auto;
}
.nhh__dropdown li a:hover { background: #eef5ff; color: var(--nhh-navy); }

/* The injected category list carries the legacy sidebar classes
   (.catgrylist / .catgrylist_new / .categrylist_copy) which set their own font,
   borders, indents and backgrounds — neutralise all of it here. */
.nhh__dropdown #categoryList,
.nhh__dropdown #categoryList li,
.nhh__dropdown #categoryList li a {
    font-family: inherit;
    box-shadow: none;
    border: 0;
    outline: 0;
    text-indent: 0;
    text-transform: none;
    background: none;
    min-height: 0;
    line-height: 1.35;
}
.nhh__dropdown #categoryList { margin: 0; padding: 0; width: auto; }
.nhh__dropdown #categoryList li a {
    display: block;
    padding: 7px 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--nhh-ink);
    border-radius: 6px;
}
.nhh__dropdown #categoryList li a:hover { background: #eef5ff; color: var(--nhh-navy); }
.nhh__dropdown #categoryList .newimg,
.nhh__dropdown #categoryList .newimg1 { display: inline-block; vertical-align: middle; }

/* ---------- cart -------------------------------------------------------- */

.nhh .nhh__cart {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px;
    padding: 0 16px;
    min-height: 42px;
    background: linear-gradient(180deg, #f6a13c 0%, var(--nhh-orange) 55%, var(--nhh-orange-2) 100%);
    border-radius: 8px;
    color: #fff;
    transition: filter .18s ease;
}
.nhh .nhh__cart:hover { filter: brightness(1.06); }
.nhh__cart-ico { position: relative; display: inline-flex; align-items: center; }
.nhh__cart-ico svg { width: 24px; height: 24px; }
.nhh__cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #16233c;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}
.nhh__cart-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .5px;
}
.nhh__cart-text strong { font-size: 14px; font-weight: 800; }

/* ---------- burger (small screens only) --------------------------------- */

.nhh .nhh__burger {
    display: none;
    flex: 0 0 auto;
    width: 52px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-right: 1px solid rgba(255, 255, 255, .18);
    border-radius: 10px 0 0 10px;
}
.nhh__burger i {
    display: block;
    width: 21px;
    height: 2.5px;
    border-radius: 2px;
    background: #fff;
}

/* ======================================================================== */
/*  RESPONSIVE                                                              */
/* ======================================================================== */

@media (max-width: 1200px) {
    .nhh .nhh__tab { font-size: 14px; }
    .nhh__logo img { max-width: 290px; }
}

@media (max-width: 1024px) {
    .nhh__util { gap: 16px; }
    .nhh .nhh__util-link { font-size: 13px; }
    .nhh__logo img { max-width: 250px; }
    .nhh .nhh__tab { padding: 0 14px; font-size: 13.5px; }
    .nhh__dropdown { min-width: 460px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* tabs collapse into a stacked panel */
@media (max-width: 900px) {
    .nhh { padding-top: 10px; }
    .nhh__top { flex-wrap: wrap; gap: 12px; padding-bottom: 12px; }
    .nhh__logo { order: 1; }
    .nhh__right { order: 2; width: 100%; align-items: stretch; padding-top: 0; }
    .nhh__util { justify-content: flex-start; gap: 14px; }
    .nhh__search { max-width: none; }

    .nhh .nhh__burger { display: flex; }
    .nhh__nav { min-height: 48px; }

    .nhh__tabs {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 190;
        margin-top: 4px;
        flex-direction: column;
        background: #fff;
        border: 1px solid #d8e4f5;
        border-radius: 10px;
        box-shadow: 0 14px 38px rgba(20, 33, 61, .18);
        padding: 6px;
        max-height: 72vh;
        overflow-y: auto;
    }
    .nhh__tabs.is-open { display: flex; }
    .nhh__tabs > li { display: block; }
    .nhh .nhh__tab {
        justify-content: flex-start;
        width: 100%;
        min-height: 42px;
        height: auto;
        padding: 0 12px;
        color: var(--nhh-ink);
        border-right: 0;
        border-radius: 6px;
        border-bottom: 1px solid #f1f5fb;
    }
    .nhh__tabs > li:first-child .nhh__tab { border-radius: 6px; }
    .nhh .nhh__tab:hover { background: #eef5ff; color: var(--nhh-navy); }
    .nhh .nhh__tab.is-active { background: var(--nhh-active); color: #fff; }
    .nhh__caret { background: var(--nhh-navy); }
    .nhh__caret:after { border-top-color: #fff; }
    .nhh__tabs > li:last-child .nhh__tab { border-bottom: 0; }

    .nhh__more { position: static; }
    .nhh__dropdown {
        position: static;
        min-width: 0;
        max-width: none;
        margin: 0 0 6px;
        box-shadow: none;
        border: 0;
        border-radius: 6px;
        background: #f7fafe;
        padding: 8px 10px;
        grid-template-columns: minmax(0, 1fr);
    }
    .nhh .nhh__cart { margin-left: auto; }
}

@media (max-width: 700px) {
    .nhh__logo img { max-width: 210px; }
    .nhh__util { gap: 12px; row-gap: 8px; }
    .nhh .nhh__util-link { font-size: 12.5px; }
    .nhh__ico { width: 20px; height: 20px; }
    .nhh__ico svg { width: 12px; height: 12px; }
}

@media (max-width: 560px) {
    /* narrow the gutter via the variable, not .nhh__inner's padding, so
       everything keyed to the menu width narrows with it */
    :root { --me-gutter: 12px; }
    .nhh__logo img { max-width: 180px; }
    .nhh__search input[type="text"] { height: 40px; font-size: 14px; text-align: left; }
    .nhh .nhh__search-btn { width: 48px; }
    .nhh .nhh__cart { padding: 0 10px; gap: 7px; }
    .nhh__cart-text { font-size: 10.5px; }
    .nhh__cart-text strong { font-size: 13px; }
    .nhh__cart-ico svg { width: 21px; height: 21px; }
}

@media (max-width: 420px) {
    .nhh__util { gap: 10px; }
    .nhh .nhh__util-link { font-size: 11.5px; }
    .nhh__logo img { max-width: 158px; }
    .nhh__cart-text span,
    .nhh__cart-text { letter-spacing: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .nhh * { transition: none !important; }
}
