/* ============================================
   AhaMall 3-Tier Header — Design System
   ============================================ */
:root {
    --brand:       #DCA54A;
    --brand-alt:   #D98C10;
    --heading:     #0F172A;
    --text:        #4A4A4A;
    --bg-sub:      #FAF5E5;
    --bg-base:     #FFFFFF;
    --util-bg:     #1e1e1e;
    --util-text:   #cccccc;
    --util-accent: #DCA54A;
    --red:         #E53935;
    --blue:        #1A6EF5;
}

/* Hide Astra default header completely */
.ast-primary-header-bar,
.ast-mobile-header-wrap,
.ast-above-header-bar,
.ast-below-header-bar,
.site-header,
.ast-header-break-point .ast-mobile-header-wrap,
#ast-desktop-header,
#ast-mobile-header {
    display: none !important;
}
/* Our header container */
#ahm-header { font-family: 'Noto Sans KR', 'Poppins', -apple-system, sans-serif; position: relative; z-index: 999; }
.ahm-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; }

/* ============================================
   1단: 유틸리티바
   ============================================ */
.ahm-util-bar { background: var(--util-bg); height: 36px; border-radius: 0 !important; }
.ahm-util-bar .ahm-container { height: 100%; justify-content: space-between; }
.ahm-util-left,
.ahm-util-right { display: flex; align-items: center; gap: 0; }
.ahm-util-bar a { color: var(--util-text); font-size: 12px; text-decoration: none; padding: 0 12px; transition: color 0.15s; line-height: 36px; position: relative; }
.ahm-util-bar a:hover { color: var(--util-accent); }
/* 상단바: 기본 색상은 util-text, active 시 골드 */
.ahm-util-active { color: var(--util-accent) !important; font-weight: 700; }
.ahm-util-sep { width: 1px; height: 12px; background: #3a3a3a; }
.ahm-dot-badge { display: none; }

/* ============================================
   2단: 메인 헤더
   ============================================ */
.ahm-main-header { background: var(--bg-base); height: 170px; border-bottom: 2px solid var(--brand); }
.ahm-main-header .ahm-container { height: 100%; gap: 16px; }

/* Logo */
.ahm-logo { flex-shrink: 0; align-self: center; }
.ahm-logo a { display: flex; align-items: center; text-decoration: none; height: auto; }
.ahm-logo img { max-height: 130px; width: auto; object-fit: contain; }
.ahm-logo-text { font-size: 22px; font-weight: 700; color: var(--brand); letter-spacing: -0.5px; }

/* Category button */
.ahm-cat-wrap { position: relative; flex-shrink: 0; }
.ahm-cat-btn {
    display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
    background: var(--brand); color: #fff; border: none; border-radius: 6px;
    font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.15s;
    font-family: inherit; white-space: nowrap;
}
.ahm-cat-btn:hover { background: var(--brand-alt); }

/* Category dropdown */
.ahm-cat-dropdown {
    display: none; position: absolute; top: calc(100% + 14px); left: 0; width: 220px;
    background: var(--bg-base); border: 1px solid #e8d9b0; border-top: 2px solid var(--brand);
    border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); z-index: 100;
    padding: 6px 0;
}
.ahm-cat-dropdown.open { display: block; }
.ahm-cat-item {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    font-size: 13px; color: var(--heading); text-decoration: none; transition: all 0.12s;
}
.ahm-cat-item:hover { background: var(--bg-sub); color: var(--brand); }
.ahm-cat-icon { width: 20px; text-align: center; font-size: 15px; }
.ahm-cat-item svg { margin-left: auto; opacity: 0.4; }
.ahm-cat-child { padding-left: 44px; font-size: 12.5px; }

/* Search bar */
.ahm-search {
    flex: 1; display: flex; height: 44px;
    border: 2px solid var(--brand); border-radius: 8px; overflow: hidden;
}
.ahm-search input {
    flex: 1; border: none; outline: none; padding: 0 16px;
    font-size: 14px; color: var(--text); background: transparent;
    font-family: inherit;
}
.ahm-search input::placeholder { color: #aaa; }
.ahm-search button {
    width: 52px; border: none !important; background: var(--brand) !important; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.15s;
    flex-shrink: 0; padding: 0 !important; color: #fff !important;
}
.ahm-search button svg { stroke: #fff !important; }
.ahm-search button:hover { background: var(--brand-alt) !important; }

/* Header icons */
.ahm-header-icons { display: flex; gap: 6px; flex-shrink: 0; }
.ahm-icon-link {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; padding: 6px 10px; border-radius: 8px; transition: background 0.15s;
    position: relative;
}
.ahm-icon-link { color: var(--brand); }
.ahm-icon-link:hover { background: var(--bg-sub); }
.ahm-icon-link span { font-size: 10px; color: var(--text); white-space: nowrap; }
.ahm-icon-active { color: var(--brand-alt) !important; }
.ahm-icon-active svg { stroke: var(--brand-alt) !important; }
.ahm-icon-active span { color: var(--brand-alt) !important; font-weight: 600; }
.ahm-icon-active { background: var(--bg-sub); }
.ahm-cart-count {
    position: absolute; top: 0; right: 4px;
    background: var(--brand) !important; color: #fff; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; line-height: 16px; text-align: center;
    border-radius: 8px; padding: 0 4px;
}

/* Mobile toggle */
.ahm-mobile-toggle { display: none; border: none; background: none; cursor: pointer; padding: 8px; }

/* ============================================
   3단: GNB
   ============================================ */
.ahm-gnb { background: var(--bg-base); height: 40px; border-bottom: 1px solid #eee; }
.ahm-gnb .ahm-container { height: 100%; justify-content: space-between; }
.ahm-gnb-left { display: flex; list-style: none; margin: 0; padding: 0; height: 100%; }
.ahm-gnb-left li { display: flex; align-items: center; height: 100%; }
.ahm-gnb-left a {
    display: flex; align-items: center; gap: 3px; height: 100%; padding: 0 14px;
    font-size: 13.5px; font-weight: 500; color: var(--heading); text-decoration: none;
    border-bottom: 2px solid transparent; transition: all 0.15s;
}
.ahm-gnb-left a:hover,
.ahm-gnb-left a.active { color: var(--brand) !important; border-bottom-color: var(--brand); font-weight: 600; }
.ahm-gnb-hot { color: var(--red) !important; font-weight: 700 !important; }
.ahm-gnb-hot:hover { border-bottom-color: var(--red) !important; }

/* GNB dropdown */
.ahm-gnb-dropdown-wrap { position: relative; }
.ahm-gnb-dropdown {
    display: none; position: absolute; top: 100%; left: 0; min-width: 180px;
    background: var(--bg-base); border: 1px solid #e8d9b0; border-top: 2px solid var(--brand);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08); z-index: 100; padding: 4px 0;
    border-radius: 0 0 6px 6px;
}
.ahm-gnb-dropdown-wrap:hover .ahm-gnb-dropdown { display: block; }
.ahm-gnb-dropdown a {
    display: block; padding: 10px 16px; font-size: 13px; color: var(--heading);
    text-decoration: none; transition: all 0.12s;
}
.ahm-gnb-dropdown a:hover { background: var(--bg-sub); color: var(--brand); }

/* GNB right */
.ahm-gnb-right { display: flex; align-items: center; gap: 0; }
.ahm-gnb-right a { font-size: 12px; color: var(--text); text-decoration: none; padding: 0 10px; transition: color 0.15s; }
.ahm-gnb-right a:hover,
.ahm-gnb-right a.active { color: var(--brand); font-weight: 600; }
.ahm-gnb-sep { width: 1px; height: 10px; background: #ddd; }

/* ============================================
   Mobile Menu Overlay
   ============================================ */
.ahm-mobile-menu {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-base); z-index: 10000; overflow-y: auto;
    flex-direction: column;
}
.ahm-mobile-menu.open { display: flex; }
.ahm-mobile-menu-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #eee;
}
.ahm-mobile-menu-title { font-size: 18px; font-weight: 700; color: var(--heading); }
.ahm-mobile-close { border: none; background: none; cursor: pointer; padding: 4px; }
.ahm-mobile-menu-body { padding: 8px 0; }
.ahm-mobile-menu-body a {
    display: block; padding: 14px 24px; font-size: 15px; color: var(--heading);
    text-decoration: none; border-bottom: 1px solid #f0f0f0; transition: all 0.12s;
}
.ahm-mobile-menu-body a:hover,
.ahm-mobile-menu-body a.active { color: var(--brand); background: var(--bg-sub); }
.ahm-mobile-divider { height: 8px; background: #f5f5f5; }

/* ============================================
   Responsive: 768px 이하
   ============================================ */
@media (max-width: 768px) {
    .ahm-util-bar { display: none; }

    .ahm-main-header { height: 56px; }
    .ahm-main-header .ahm-container { gap: 10px; }
    .ahm-logo img { max-height: 36px; }

    .ahm-cat-wrap,
    .ahm-search,
    .ahm-header-icons { display: none; }

    .ahm-mobile-toggle { display: flex; align-items: center; margin-left: auto; }

    /* Show only cart icon on mobile */
    .ahm-header-icons { display: none; }

    /* Mobile cart icon next to hamburger */
    .ahm-main-header .ahm-container::after {
        content: none;
    }

    .ahm-gnb { display: none; }
}

/* Tablet: 769px ~ 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .ahm-cat-btn span:last-child { display: none; }
    .ahm-gnb-left a { padding: 0 10px; font-size: 13px; }
    .ahm-gnb-right { display: none; }
    .ahm-header-icons { gap: 2px; }
    .ahm-icon-link { padding: 6px 6px; }
    .ahm-icon-link span { display: none; }
}
