/* ===============================
   RESET & BASE STYLES
================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===============================
   BRAND VARIABLES (EIRVAN SYSTEM)
================================ */
:root {
    --primary: #111111;        /* Carbon Black */
    --secondary: #F5F5F2;      /* Bone White */
    --accent: #2F3E34;         /* Deep Forest Green */
    --accent-hover: rgba(47, 62, 52, 0.08); /* Untuk hover state */
    --border-opacity: rgba(17, 17, 17, 0.08); /* Border transparan */
    --transition: all 0.3s ease;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.1);
    --header-height-desktop: 69px; /* 14px + 40px + 14px + 1px border */
    --header-height-mobile: 60px;
}

/* ===============================
   FONT SYSTEM (INTER ONLY)
================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--secondary);
    color: var(--primary);
    line-height: 1.6;
}

/* Heading/Menu menggunakan SemiBold (600) */
h1, h2, h3, h4, h5, h6,
.sw-menu .menu-text a,
.mobile-menu-item a {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Body menggunakan Regular (400) */
body, input, button {
    font-weight: 400;
}

/* ===============================
   HEADER (PUTIH / DEFAULT)
================================ */
.sw-header {
    background: var(--secondary);
    width: 100%;
    z-index: 9999;
    border-bottom: 1px solid var(--border-opacity);
    /* FIX: fixed di semua ukuran layar */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

/* FIX: offset body agar konten tidak ketutupan header di desktop */
body {
    padding-top: var(--header-height-desktop);
}

/* FIX: homepage tidak perlu offset karena hero full-bleed */
body.home,
body.nazhak-home {
    padding-top: 0 !important;
}

/* ===============================
   CONTAINER (DESKTOP: 3 KOLOM)
================================ */
.sw-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
}

/* ===============================
   HAMBURGER TOGGLE (MOBILE ONLY)
================================ */
.sw-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 1002;
    position: relative;
}

.toggle-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    margin: 3px 0;
    transition: var(--transition);
    transform-origin: center;
}

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

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

.sw-toggle[aria-expanded="true"] .toggle-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===============================
   LOGO
================================ */
.sw-logo img {
    height: 40px;
    width: auto;
    display: block;
}

/* ===============================
   SEARCH (DESKTOP)
================================ */
.desktop-search {
    max-width: 420px;
    width: 100%;
    justify-self: center;
}

.desktop-search input {
    width: 100%;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-opacity);
    background: var(--secondary);
    color: var(--primary);
    font-size: 14px;
}

.desktop-search input::placeholder {
    color: rgba(17, 17, 17, 0.5);
}

.desktop-search input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===============================
   NAV (DESKTOP)
================================ */
.sw-nav {
    justify-self: end;
}

.sw-menu {
    display: flex;
    align-items: center;
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

/* ===============================
   MENU ITEM
================================ */
.sw-menu > li {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ===============================
   TEXT MENU ITEMS
================================ */
.menu-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.menu-text a:hover {
    color: var(--accent);
}

/* ===============================
   ICON ITEMS
================================ */
.menu-icon a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    position: relative;
}

.menu-icon a:hover {
    background-color: var(--accent-hover);
}

.menu-icon .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    color: var(--primary);
}

/* ===============================
   CART BADGE
================================ */
.menu-icon.cart {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--accent);
    color: var(--secondary);
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-weight: 600;
    z-index: 1;
}

/* ===============================
   COLLECTION DROPDOWN (DESKTOP)
================================ */
.menu-text.has-dropdown {
    position: relative;
}

.menu-text.has-dropdown > a {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-arrow {
    font-size: 0.8em;
    line-height: 1;
    margin-left: 2px;
    color: var(--primary);
}

.collection-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
    border: 1px solid var(--border-opacity);
    border-radius: 8px;
    box-shadow: var(--shadow);
    list-style: none;
    margin: 15px 0 0 0;
    padding: 12px 0;
    min-width: 200px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
}

.menu-text.has-dropdown:hover .collection-dropdown {
    opacity: 1;
    visibility: visible;
    max-height: 400px;
}

.category-parent {
    position: relative;
    margin: 0;
    padding: 0;
}

.category-parent > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.category-parent > a:hover {
    background-color: var(--accent-hover);
    color: var(--accent);
}

.child-arrow {
    color: rgba(17, 17, 17, 0.5);
    font-size: 1.2em;
    margin-left: 10px;
}

.category-children {
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--secondary);
    border: 1px solid var(--border-opacity);
    border-radius: 8px;
    box-shadow: var(--shadow);
    list-style: none;
    margin: 0;
    padding: 10px 0;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1001;
}

.category-parent.has-children:hover .category-children {
    opacity: 1;
    visibility: visible;
}

.category-children li a {
    display: block;
    padding: 8px 20px;
    color: rgba(17, 17, 17, 0.7);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 400;
    transition: all 0.2s ease;
}

.category-children li a:hover {
    background-color: var(--accent-hover);
    color: var(--accent);
}

/* ===============================
   MOBILE SEARCH ICON
================================ */
.mobile-search-icon {
    display: none;
}

/* ===============================
   MOBILE MENU OVERLAY
================================ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--secondary);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    z-index: 9999;
}

.mobile-menu-overlay.active .mobile-menu-container {
    transform: translateX(0);
}

/* ===============================
   MOBILE SEARCH BAR
================================ */
.mobile-search-bar {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-opacity);
    background: var(--secondary);
}

.mobile-search-bar form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mobile-search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-opacity);
    border-radius: 24px;
    background: var(--secondary);
    font-size: 14px;
    outline: none;
    color: var(--primary);
}

.mobile-search-bar input:focus {
    border-color: var(--accent);
}

.mobile-search-bar button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.mobile-search-bar button:hover {
    opacity: 0.9;
}

.mobile-search-bar button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--secondary);
}

/* ===============================
   MOBILE MENU LIST
================================ */
.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--border-opacity);
}

.mobile-menu-item a {
    display: block;
    padding: 18px 24px;
    color: var(--primary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.mobile-menu-item a:hover {
    background-color: var(--accent-hover);
    color: var(--accent);
}

/* MOBILE COLLECTION SUBMENU */
.mobile-menu-item.has-submenu.active > a {
    background-color: var(--accent-hover);
    color: var(--accent);
}

.mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--secondary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-submenu-item {
    border-bottom: 1px solid var(--border-opacity);
    position: relative;
}

.mobile-submenu-item a {
    padding: 16px 24px 16px 36px;
    font-size: 15px;
    font-weight: 400;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary);
}

.mobile-submenu-item a:hover {
    color: var(--accent);
}

.mobile-arrow,
.mobile-child-arrow {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
    font-size: 1.2em;
    color: rgba(17, 17, 17, 0.5);
    margin-left: 8px;
}

.mobile-menu-item.has-submenu.active > a .mobile-arrow,
.mobile-submenu-item.has-nested.active > a .mobile-child-arrow {
    transform: rotate(90deg);
    color: var(--accent);
}

/* MOBILE NESTED MENU (CHILD CATEGORIES) */
.mobile-nested-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--secondary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nested-item a {
    padding: 14px 24px 14px 48px;
    font-size: 14px;
    color: rgba(17, 17, 17, 0.7);
    font-weight: 400;
    text-decoration: none;
}

.mobile-nested-item a:hover {
    background-color: var(--accent-hover);
    color: var(--accent);
}

/* SEPARATOR LINE */
.mobile-menu-separator {
    padding: 0;
    margin: 0;
}

.mobile-menu-separator hr {
    margin: 20px 24px;
    border: none;
    border-top: 1px solid var(--border-opacity);
    height: 1px;
}

/* LOGIN ITEM */
.login-item a {
    color: var(--primary);
    font-weight: 600;
}

.login-item a:hover {
    color: var(--accent);
}

/* ===============================
   FOCUS STATES
================================ */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===============================
   MOBILE STYLES (MAX-WIDTH: 768px)
================================ */
@media (max-width: 768px) {
    .sw-container {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 10px 16px;
        align-items: center;
        height: var(--header-height-mobile);
    }

    .sw-toggle {
        display: flex;
    }

    .sw-logo {
        justify-self: center;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        max-width: 120px;
    }

    .sw-logo img {
        height: 32px;
        width: auto;
        max-width: 100%;
    }

    .sw-nav {
        justify-self: end;
    }

    .sw-menu {
        gap: 4px;
    }

    .sw-menu .menu-text,
    .desktop-search,
    .menu-icon:not(.mobile-search-icon):not(.cart) {
        display: none !important;
    }

    .mobile-search-icon,
    .menu-icon.cart {
        display: flex !important;
    }

    .cart-count {
        top: 2px;
        right: 2px;
    }

    .collection-dropdown {
        display: none !important;
    }

    /* FIX: override body padding untuk mobile */
    body {
        padding-top: var(--header-height-mobile) !important;
    }

    /* Homepage tetap 0 di mobile */
    body.home,
    body.nazhak-home {
        padding-top: 0 !important;
    }
}

/* ===============================
   DESKTOP STYLES (MIN-WIDTH: 769px)
================================ */
@media (min-width: 769px) {
    .sw-toggle,
    .mobile-search-icon,
    .mobile-menu-overlay,
    .mobile-menu-container {
        display: none !important;
    }

    .sw-logo {
        position: static !important;
        transform: none !important;
        justify-self: start !important;
        max-width: none !important;
    }

    .sw-logo img {
        height: 40px !important;
    }

    .sw-menu .menu-text,
    .desktop-search,
    .menu-icon:not(.mobile-search-icon) {
        display: flex !important;
    }

    .sw-menu {
        gap: 22px !important;
    }
}

/* ===============================
   ANIMATIONS
================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.collection-dropdown {
    animation: fadeIn 0.3s ease-out;
}

/* ===============================
   UTILITY CLASSES
================================ */
.text-accent {
    color: var(--accent) !important;
}

.bg-accent {
    background-color: var(--accent) !important;
}

.no-scroll {
    overflow: hidden;
}