/* ═══════════════════════════════════════════════════════════════
   header.css  –  Sastu Sahitya web header + global layout resets
   Breakpoints used (mobile-first):
     xs  < 640 px   (phones)
     sm  ≥ 640 px   (large phones / small tablets)
     md  ≥ 768 px   (tablets — desktop nav appears)
     lg  ≥ 1024 px  (laptops — location chip appears)
     xl  ≥ 1280 px  (desktops — full spacing)
   ═══════════════════════════════════════════════════════════════ */

/* ── Global: prevent any child from blowing out the viewport ── */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
*, *::before, *::after {
    box-sizing: border-box;
}
img, video, iframe, svg {
    max-width: 100%;
}

/* ── Wrapper ─────────────────────────────────────────────────── */
#web-header {
    background: #fff;
    box-shadow: 0 1px 8px rgba(0,0,0,.08);
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
}
#web-header .header-container {
    max-width: 80rem;      /* 1280 px */
    margin: 0 auto;
    padding: 0 .75rem;
}
@media (min-width: 640px)  { #web-header .header-container { padding: 0 1rem; } }
@media (min-width: 1024px) { #web-header .header-container { padding: 0 1.5rem; } }

/* ── Row 1: Logo / Search / Actions ─────────────────────────── */
.header-row1 {
    display: flex;
    align-items: center;
    gap: .5rem;
    height: 56px;
}
@media (min-width: 640px) {
    .header-row1 { gap: .75rem; height: 64px; }
}

/* Logo */
.header-logo img {
    height: 36px;
    width: auto;
    display: block;
}
@media (min-width: 640px) { .header-logo img { height: 44px; } }
@media (min-width: 768px) { .header-logo img { height: 52px; } }

/* Search wrapper */
.header-search {
    flex: 1;
    min-width: 0;
    display: none;           /* hidden on xs; shown sm+ */
}
@media (min-width: 640px) { .header-search { display: flex; } }

/* Search form inner */
.header-search-form {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    overflow: visible;
    transition: box-shadow .2s, border-color .2s;
}
.header-search-form:focus-within {
    border-color: #be123c;
    box-shadow: 0 0 0 2px rgba(190,18,60,.15);
}

/* Scope button */
.header-scope-btn {
    display: flex;
    align-items: center;
    gap: .25rem;
    height: 100%;
    padding: 0 .75rem;
    background: #f9fafb;
    border: none;
    border-right: 1px solid #e5e7eb;
    border-radius: .5rem 0 0 .5rem;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    min-width: 68px;
    transition: background .15s;
}
@media (min-width: 640px) {
    .header-scope-btn { font-size: .875rem; min-width: 90px; padding: 0 .875rem; }
}
.header-scope-btn:hover { background: #f3f4f6; }

/* Scope dropdown panel */
.header-scope-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 170px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .875rem;
    box-shadow: 0 12px 32px rgba(15,23,42,.12);
    padding: .35rem;
    z-index: 400;
}

/* Search text input */
.header-search-input {
    flex: 1;
    min-width: 0;
    padding: .625rem .625rem .625rem 2.25rem;
    border: none;
    background: transparent;
    font-family: 'Mukta', Arial, sans-serif;
    font-size: .875rem;
    color: #111827;
}
.header-search-input:focus { outline: none; }
.header-search-input::placeholder { color: #9ca3af; }

/* Location chip (lg+) */
.header-location {
    display: none;
    flex-shrink: 0;
}
@media (min-width: 1024px) { .header-location { display: flex; } }

.header-location-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    white-space: nowrap;
}
.header-location-btn:hover {
    border-color: rgba(190,18,60,.5);
    background: rgba(254,242,242,.4);
}
.header-location-icon {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2D0075 0%, #AD1840 100%);
}

/* Login / account (md+) */
.header-account { display: none; flex-shrink: 0; }
@media (min-width: 768px) { .header-account { display: flex; align-items: center; } }

.header-login-btn {
    white-space: nowrap;
    background: #be123c;
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    padding: .5rem 1rem;
    border-radius: .5rem;
    border: 1px solid transparent;
    transition: all .25s;
    text-decoration: none;
    display: inline-block;
}
.header-login-btn:hover {
    background: #fff;
    color: #be123c;
    border-color: #be123c;
}

/* Mobile actions (xs/sm) */
.header-mobile-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}
@media (min-width: 768px) { .header-mobile-actions { display: none; } }

.header-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    background: none;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.header-hamburger:hover { border-color: rgba(190,18,60,.4); color: #be123c; }

/* ── Mobile search row (xs only, below logo row) ─────────────── */
.header-mobile-search {
    padding-bottom: .5rem;
}
@media (min-width: 640px) { .header-mobile-search { display: none; } }

/* ── Row 2: Desktop nav bar (md+) ───────────────────────────── */
#sns_menu {
    display: none;
    border-top: 1px solid #e8ebf3;
    border-bottom: 1px solid #e8ebf3;
    background: #fff;
}
@media (min-width: 768px) { #sns_menu { display: block; } }

#sns_menu .sns_mainmenu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 1rem;
}
@media (min-width: 1280px) { #sns_menu .sns_mainmenu { min-height: 52px; } }

/* Nav list */
#sns_menu .mainnav {
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -ms-overflow-style: none;
    scrollbar-width: none;
    list-style: none;
    margin: 0; padding: 0;
}
#sns_menu .mainnav::-webkit-scrollbar { display: none; }
@media (min-width: 1280px) { #sns_menu .mainnav { gap: 1.35rem; } }

/* Nav link / button */
#sns_menu .menu-title-lv0 {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem 0;
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: #1f2937;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s;
}
@media (min-width: 1280px) { #sns_menu .menu-title-lv0 { font-size: .96rem; } }
#sns_menu .menu-title-lv0:hover,
#sns_menu .menu-title-lv0.is-active { color: #be123c; }

/* ── Right icon cluster ──────────────────────────────────────── */
#sns_menu .sns_menu_right {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #4b5563;
    flex-shrink: 0;
}
@media (min-width: 1280px) { #sns_menu .sns_menu_right { gap: .9rem; } }

#sns_menu .sns_menu_right .divider {
    width: 1px; height: 20px; background: #d6d9e2;
}
#sns_menu .sns_menu_right .mini-cart-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #4b5563;
    font-size: .95rem;
    text-decoration: none;
}
#sns_menu .sns_menu_right .mini-cart-link:hover { color: #be123c; }

.cart-items-text { display: none; }
@media (min-width: 1280px) { .cart-items-text { display: inline; } }

#sns_menu .sns_menu_right .menu-icon-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    color: #4b5563;
    text-decoration: none;
    transition: background .2s, color .2s;
}
#sns_menu .sns_menu_right .menu-icon-link:hover { background: #fee2e2; color: #be123c; }

#sns_menu .sns_menu_right .icon-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    border-radius: 50%;
    font-size: .67rem; font-weight: 700;
    background: #ef4444; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1;
}

/* ── Dropdown (shared) ──────────────────────────────────────── */
#sns_menu .has-submenu { position: relative; }

#sns_menu .wrap_submenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .65rem;
    box-shadow: 0 16px 34px rgba(15,23,42,.12);
    padding: .45rem;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
    z-index: 300;
}
#sns_menu .wrap_submenu.dropdown-right { left: auto; right: 0; }

#sns_menu .has-submenu:hover > .wrap_submenu,
#sns_menu .has-submenu.is-open  > .wrap_submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#sns_menu .wrap_submenu .menu-title-lv1 {
    display: flex;
    align-items: center;
    gap: .55rem;
    border-radius: .45rem;
    padding: .55rem .7rem;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
}
#sns_menu .wrap_submenu .menu-title-lv1:hover { background: #f3f4f6; color: #be123c; }

/* ── Mobile slide-down menu ─────────────────────────────────── */
#mobile-hamburger-menu {
    display: none;
    border-top: 1px solid #f3f4f6;
    background: #fff;
    max-height: calc(100svh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) {
    #mobile-hamburger-menu { max-height: calc(100svh - 64px); }
}
#mobile-hamburger-menu.is-open { display: block; }
@media (min-width: 768px) {
    #mobile-hamburger-menu,
    #mobile-hamburger-menu.is-open { display: none !important; }
}

.mobile-menu-section-label {
    padding: 0 .5rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9ca3af;
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    border-radius: .5rem;
    padding: .625rem .75rem;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.mobile-nav-link:hover,
.mobile-nav-link.is-active { background: #fef2f2; color: #be123c; }

.mobile-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem;
}
