/**
 * Icon Button Styles
 *
 * Header icon buttons (menu, search, cart) and cart link.
 */

/* ===========================================
   ICON BUTTONS
   =========================================== */
.header-icon-btn {
    position: relative;
    background: none;
    border: none;
    padding: var(--icon-btn-padding, 8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--header-text, #fff);
}

.header-icon-btn svg {
    width: var(--icon-size, 22px);
    height: var(--icon-size, 22px);
    stroke: currentColor;
    stroke-width: 1.4;
    fill: none;
}

/* ===========================================
   DELIVERY MODE WRAPPER + DROPDOWN
   =========================================== */
.delivery-mode-wrapper {
    position: relative;
    display: none; /* follows same show/hide as selector */
    flex-shrink: 0;
}

.delivery-mode-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 148px;
    background: #252525;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.delivery-mode-dropdown.is-open {
    display: block;
}

.delivery-mode-option {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 13px 8px 8px;
    text-decoration: none;
    color: #fff;
    transition: background 0.15s ease;
    cursor: pointer;
}

.delivery-mode-option + .delivery-mode-option {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.delivery-mode-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.delivery-mode-option.is-active {
    background: transparent;
}

/* Flag in dropdown: 28×28px (Figma: 72×28 Hug group = 28px flag + gap + text) */
.delivery-mode-option .dm-opt-flag {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 44px;
    margin-right: 8px;
}

.delivery-option-text {
    flex: 1;
}

.delivery-option-title {
    font-family: var(--font-primary, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

/* Hide subtitles — Figma shows country name only */
.delivery-option-subtitle {
    display: none;
}

/* Checkmark: 16×16px, pushed right with auto margin (creates ~40px gap per Figma) */
.dm-check {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 2.5;
    flex-shrink: 0;
    margin-left: auto;
}

/* Chevron rotation when dropdown is open */
.delivery-mode-selector[aria-expanded="true"] > svg {
    transform: rotate(180deg);
}

.delivery-mode-selector > svg {
    transition: transform 0.2s ease;
}

@media (min-width: 1024px) {
    .delivery-mode-wrapper {
        display: flex;
    }
}

/* ===========================================
   DELIVERY MODE SELECTOR (Desktop Row 1)
   =========================================== */
/* Figma: ~138×36px pill, padding: 4px, border-radius: 900px */
.delivery-mode-selector {
    display: none; /* hidden on mobile */
    align-items: center;
    gap: 0;
    padding: 4px;
    height: 36px;
    border-radius: 900px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(17.25px);
    -webkit-backdrop-filter: blur(17.25px);
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
}

.delivery-mode-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Figma: 28×28px circle, emoji clipped to perfect circle */
.delivery-flag {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 6px;
    /* Force square aspect to keep the circle crisp */
    aspect-ratio: 1 / 1;
}

/* UAE flag: shift right to center within circular clip */
.delivery-flag .flag-emoji.flag-uae {
    transform: translateX(6px);
}

/* Figma: Text/14SB — Inter 14px Semi Bold */
.delivery-label {
    font-family: var(--font-primary, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
}

/* Chevron: Figma 20px container (5+10+5), 34px gap from label, 10×5 arrow */
.delivery-mode-selector > svg {
    stroke: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
    width: 10px;
    height: 5px;
    padding: 0 5px;
    box-sizing: content-box;
    margin-left: 34px;
}

/* ===========================================
   LANGUAGE SELECTOR (Desktop Row 1)
   =========================================== */
.lang-selector {
    display: none; /* hidden on mobile */
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #fff;
    padding: 4px 2px;
    flex-shrink: 0;
}

.lang-label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.lang-selector svg {
    stroke: rgba(255, 255, 255, 0.7);
    fill: none;
}

/* ===========================================
   CURRENCY SWITCHER
   =========================================== */
.currency-wrapper {
    position: relative;
    display: none;
    flex-shrink: 0;
}

.currency-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 32px;
    border-radius: 900px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(17.25px);
    -webkit-backdrop-filter: blur(17.25px);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.currency-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.currency-symbol {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1;
}

.currency-code {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.currency-chevron {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.currency-selector[aria-expanded="true"] .currency-chevron {
    transform: rotate(180deg);
}

/* Figma: 100 Hug × 66 Hug, dark bg, 12px radius */
.currency-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100px;
    background: #252525;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.currency-dropdown.is-open {
    display: block;
}

/* Figma: each row ~8px padding, flex row, 2px gap between symbol+label */
.currency-option {
    display: flex;
    align-items: center;
    padding: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: var(--font-primary, 'Inter', sans-serif);
}

.currency-option + .currency-option {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.currency-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Active row: subtle highlight */
.currency-option.is-active {
    background: rgba(255, 255, 255, 0.06);
}

/* Figma: "Text and Flag" group — 42 Hug × 19 Hug, gap 2px */
.currency-option .currency-opt-symbol {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1;
    margin-right: 2px;
}

.currency-option .currency-opt-label {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

/* Figma: checkmark 16×16, pushed right (margin-left auto) */
.currency-check {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    flex-shrink: 0;
    margin-left: auto;
    display: none;
}

@media (min-width: 1024px) {
    .currency-wrapper {
        display: flex;
    }
}

/* ===========================================
   DESKTOP SEARCH ICON (Row 1, desktop only)
   =========================================== */
.header-desktop-search {
    display: none; /* hidden on mobile */
}

@media (min-width: 1024px) {
    .delivery-mode-selector {
        display: flex;
    }

    .lang-selector {
        display: flex;
    }

    .header-desktop-search {
        display: flex;
    }
}

/* ===========================================
   ACCOUNT PILL (Desktop Row 1 — main header)
   =========================================== */
.header-account-pill {
    display: none; /* hidden on mobile */
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    height: 36px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(17.25px);
    -webkit-backdrop-filter: blur(17.25px);
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-account-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.account-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.account-avatar svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    stroke-width: 1.4;
    fill: none;
}

.account-label {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.account-chevron {
    width: 10px;
    height: 6px;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 1.4;
    fill: none;
    flex-shrink: 0;
}

/* Account pill is only used on homepage desktop header */
@media (min-width: 1024px) {
    .homepage-desktop-header .header-account-pill {
        display: flex;
    }
}

/* ===========================================
   CART COUNT BADGE (absolute positioned dot)
   =========================================== */
/* Cart count: plain white number to the right of the icon, no background */
.cart-count-badge {
    position: static;
    background: none;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    margin-left: 4px;
    padding: 0;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
}

/* Cart link: flex row so number sits beside icon */
.cart-btn,
.cart-link {
    display: inline-flex !important;
    align-items: center;
    position: relative;
}

/* Wishlist button needs relative for the overlaid badge */
.header-icon-btn {
    position: relative;
}

/* ===========================================
   WISHLIST BUTTON (Row 1)
   =========================================== */
.header-right .wishlist-trigger {
    position: relative;
}

.header-right .wishlist-trigger svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.4;
    fill: none;
    transition: fill 0.2s ease;
}

.header-right .wishlist-trigger:hover svg {
    fill: currentColor;
}

/* ===========================================
   CART BUTTON (Mobile header)
   =========================================== */
.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--header-text, #fff);
    text-decoration: none;
}

.cart-count {
    font-size: 14px;
    color: var(--header-text, #fff);
}

/* Mobile: dark cart count on white background */
@media (max-width: 1023px) {
    .cart-count {
        color: #000000;
    }
}

/* ===========================================
   DESKTOP NAV CART LINK (Row 2)
   =========================================== */
.desktop-cart-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--header-text, #fff);
    text-decoration: none;
    transition: color var(--transition-fast, 0.15s ease);
}

.desktop-cart-link:hover {
    color: var(--header-text-hover, rgba(255, 255, 255, 0.7));
}

.desktop-cart-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.desktop-cart-link .cart-count {
    font-size: 11px;
    color: var(--header-text, #fff);
}

/* ===========================================
   RESPONSIVE ICON SIZES
   =========================================== */

/* Mobile (< 1024px): Delivery pill + dropdown adjustments */
@media (max-width: 1023px) {
    /* Pill: compact to fit mobile header height */
    .delivery-mode-selector {
        height: 32px;
        padding: 3px 6px 3px 3px;
    }

    /* Smaller flag on mobile */
    .delivery-mode-wrapper .delivery-flag {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 36px;
        margin-right: 5px;
    }

    .delivery-label {
        font-size: 13px;
    }

    /* Remove desktop padding — just the icon itself on mobile */
    .delivery-mode-selector > svg {
        width: 10px;
        height: 6px;
        padding: 0;
        margin-left: 6px;
        box-sizing: border-box;
    }

    /* Dropdown: anchor to left of pill, guard against screen overflow */
    .delivery-mode-dropdown {
        left: 0;
        right: auto;
        max-width: calc(100vw - 16px);
    }
}

/* Mobile (< 1024px): Icon sizes per Figma at 400px width */
@media (max-width: 1023px) {
    /* Menu toggle: 21px x 14px, 2px stroke per Figma */
    .header-icon-btn.menu-toggle {
        padding: 0;
    }

    .header-icon-btn.menu-toggle svg {
        width: 21px;
        height: 14px;
        stroke-width: 2.5;
        stroke-linecap: round;
    }

    /* Search icon in header-left: 20px per Figma */
    .header-search-icon svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.5;
    }

    /* Wishlist (heart): 18px per Figma */
    .header-right .wishlist-trigger svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.5;
    }

    /* User account: 18px per Figma */
    .header-right .header-icon-btn svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.5;
    }

    /* Cart (shopping bag): 17px per Figma */
    .header-right .cart-btn svg {
        width: 19px;
        height: 19px;
        stroke-width: 1.5;
    }

    .cart-count {
        font-size: 13px;
        font-weight: 500;
    }

    .header-icon-btn {
        padding: 0;
    }
}

/* 1024px-1199px: Compact */
@media (min-width: 1024px) and (max-width: 1199px) {
    .desktop-cart-link svg {
        width: 16px;
        height: 16px;
    }

    .desktop-cart-link .cart-count {
        font-size: 10px;
    }
}

/* 1200px-1399px: Medium */
@media (min-width: 1200px) and (max-width: 1399px) {
    .desktop-cart-link svg {
        width: 18px;
        height: 18px;
    }

    .desktop-cart-link .cart-count {
        font-size: 11px;
    }
}

/* 1400px+: Full */
@media (min-width: 1400px) {
    .desktop-cart-link {
        gap: 5px;
    }

    .desktop-cart-link svg {
        width: 19px;
        height: 19px;
    }

    .desktop-cart-link .cart-count {
        font-size: 12px;
    }
}

/* 1600px+: Extra large */
@media (min-width: 1600px) {
    .desktop-cart-link svg {
        width: 20px;
        height: 20px;
    }

    .desktop-cart-link .cart-count {
        font-size: 13px;
    }
}
