/**
 * Mobile Header & Drawer — S33.3
 * MOBILE ONLY: <768px
 * Uses existing CSS variables from shop.css
 */

/* ===== BASE: Hidden by default on all screens ===== */
.sh-mobile-header,
.sh-mobile-hamburger,
.sh-drawer,
.sh-drawer-overlay {
    display: none;
}

/* ===== MOBILE ONLY (<768px) ===== */
@media (max-width: 767px) {

    /* Hide desktop header on mobile */
    .sh-header {
        display: none !important;
    }

    /* ===== MOBILE HEADER ===== */
    .sh-mobile-header {
        display: block;
        background: #fafafa;
        border-bottom: 1px solid var(--sh-border-default, #e5e5e5);
    }

    /* Hide mobile header when drawer is open */
    body.sh-drawer-open .sh-mobile-header {
        display: none;
    }

    /* ===== ROW 1: Hamburger | Logo | Account + Cart ===== */
    .sh-mobile-header__row1 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 56px;
        padding: 0 var(--s-3, 12px);
        border-bottom: 1px solid var(--sh-border-subtle, #eee);
    }

    /* ===== HAMBURGER BUTTON ===== */
    .sh-mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: var(--tap, 44px);
        height: var(--tap, 44px);
        padding: 0;
        margin: 0;
        background: transparent;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .sh-mobile-hamburger__icon {
        width: 24px;
        height: 24px;
        stroke: var(--color-text, #2d2a26);
        stroke-width: 2;
        fill: none;
    }

    .sh-mobile-hamburger:active {
        opacity: 0.7;
    }

    /* ===== MOBILE LOGO ===== */
    .sh-mobile-header__logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .sh-mobile-header__logo-img {
        height: 28px;
        width: auto;
    }

    /* ===== MOBILE ICONS ===== */
    .sh-mobile-header__icons {
        display: flex;
        align-items: center;
        gap: var(--s-2, 8px);
    }

    /* Action buttons in mobile header */
    .sh-mobile-header__icons .sh-action {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        text-decoration: none;
        border-radius: var(--r-sm, 6px);
        cursor: pointer;
        background: #fef7ed;
        border: 1px solid rgba(255, 149, 0, 0.15);
    }

    .sh-mobile-header__icons .sh-action__icon {
        width: 18px;
        height: 18px;
        color: #b07830;
    }

    .sh-mobile-header__icons .sh-action__label {
        display: none;
    }

    .sh-mobile-header__icons .sh-action--cart {
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
        border: none;
    }

    .sh-mobile-header__icons .sh-action--cart .sh-action__icon {
        color: #fff;
    }

    .sh-mobile-header__icons .sh-action__badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        font-size: 10px;
        font-weight: 700;
        color: #fff;
        background: #22c55e;
        border: 2px solid #fafafa;
        border-radius: 100px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ===== ROW 2: Search (EXACT copy from desktop header.css) ===== */
    .sh-mobile-header__row2 {
        padding: 6px 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .sh-mobile-header__row2 .sh-topbar__search {
        flex: 1;
        max-width: none;
        position: relative;
        display: flex;
        align-items: center;
    }

    .sh-mobile-header__row2 .sh-topbar__search-icon {
        position: absolute;
        left: 14px;
        width: 15px;
        height: 15px;
        color: #666666;
        pointer-events: none;
    }

    .sh-mobile-header__row2 .sh-topbar__search-input {
        width: 100%;
        height: 38px;
        padding: 0 48px 0 40px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 450;
        color: #1a1a1a;
        letter-spacing: -0.01em;
        background: #eeeeee;
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: 10px;
        outline: none;
    }

    .sh-mobile-header__row2 .sh-topbar__search-input::placeholder {
        color: #666666;
        font-weight: 400;
    }

    .sh-mobile-header__row2 .sh-topbar__search-input:focus {
        background: #e0e0e0;
        border-color: rgba(0, 0, 0, 0.12);
        box-shadow: none;
        outline: none;
    }

    .sh-mobile-header__row2 .sh-topbar__search-btn {
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
        border: none;
        border-radius: 8px;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
    }

    .sh-mobile-header__row2 .sh-topbar__search-btn svg {
        width: 13px;
        height: 13px;
        color: #ffffff;
    }

    /* ===== ROW 3: Callback + Phone (copy from desktop) ===== */
    .sh-mobile-header__row3 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .sh-mobile-callback {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        font-size: 12px;
        font-weight: 600;
        color: #404040;
        text-decoration: none;
        background: transparent;
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: 8px;
        white-space: nowrap;
    }

    .sh-mobile-callback:active {
        color: #f97316;
        background: rgba(249, 115, 22, 0.1);
        border-color: rgba(249, 115, 22, 0.4);
    }

    /* Phone block — EXACT copy from desktop */
    .sh-mobile-phone {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        padding: 6px 12px;
        background: rgba(22, 163, 74, 0.1);
        border: 1px solid rgba(34, 197, 94, 0.2);
        border-radius: 8px;
    }

    .sh-mobile-phone:active {
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.3);
    }

    .sh-mobile-phone__icon {
        width: 16px;
        height: 16px;
        color: #16a34a;
        flex-shrink: 0;
    }

    .sh-mobile-phone span {
        font-size: 11px;
        font-weight: 500;
        color: #666666;
        letter-spacing: -0.01em;
    }

    .sh-mobile-phone strong {
        font-size: 14px;
        font-weight: 700;
        color: #1a1a1a;
        letter-spacing: -0.02em;
    }

    /* ===== ROW 4: Info ===== */
    .sh-mobile-header__row4 {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--s-4, 16px);
        padding: var(--s-2, 8px) var(--s-3, 12px);
    }

    .sh-mobile-header__info {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 500;
        color: var(--sh-text-tertiary, #999);
    }

    .sh-mobile-header__info-icon {
        width: 14px;
        height: 14px;
        color: var(--color-accent, #2d7a5f);
        flex-shrink: 0;
    }

    /* ===== DRAWER OVERLAY ===== */
    .sh-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1001;
        background: rgba(45, 42, 38, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 300ms ease-out, visibility 0s 300ms;
    }

    .sh-drawer-overlay.is-active {
        opacity: 1;
        visibility: visible;
        transition: opacity 300ms ease-out, visibility 0s;
    }

    /* ===== DRAWER PANEL ===== */
    .sh-drawer {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1002;
        width: min(80vw, 300px);
        height: 100vh;
        height: 100dvh;
        background: var(--color-surface-elevated, #fff);
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%);
        transition: transform 300ms ease-out;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sh-drawer.is-open {
        transform: translateX(0);
    }

    /* ===== AUTH BLOCK (top of drawer) ===== */
    .sh-drawer-auth {
        padding: var(--s-3, 12px) var(--s-4, 16px);
        background: var(--color-surface, #f7f5f0);
        border-bottom: 1px solid var(--color-border, #e8e4dd);
    }

    /* Header row: Avatar | Name | Close */
    .sh-drawer-auth__header {
        display: flex;
        align-items: center;
        gap: var(--s-3, 12px);
    }

    .sh-drawer-auth__avatar {
        width: 40px;
        height: 40px;
        border-radius: var(--r-full, 9999px);
        object-fit: cover;
        background: var(--color-border, #e8e4dd);
        flex-shrink: 0;
    }

    .sh-drawer-auth__avatar-placeholder {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--color-accent-light, #e8f5f0);
        color: var(--color-accent, #2d7a5f);
        border-radius: var(--r-full, 9999px);
        flex-shrink: 0;
    }

    .sh-drawer-auth__avatar-icon {
        width: 22px;
        height: 22px;
        stroke: currentColor;
        stroke-width: 1.75;
        fill: none;
    }

    .sh-drawer-auth__info {
        flex: 1;
        min-width: 0;
    }

    .sh-drawer-auth__name {
        font-size: 15px;
        font-weight: 500;
        color: var(--color-text, #2d2a26);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sh-drawer-auth__email {
        font-size: 13px;
        color: var(--color-text-secondary, #6b6560);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 2px;
    }

    /* Close button in header */
    .sh-drawer__close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        margin-left: auto;
        background: transparent;
        border: none;
        border-radius: var(--r-sm, 6px);
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .sh-drawer__close:active {
        background: var(--color-border, #e8e4dd);
    }

    .sh-drawer__close-icon {
        width: 20px;
        height: 20px;
        stroke: var(--color-text-secondary, #6b6560);
        stroke-width: 2;
        fill: none;
    }

    /* Actions block */
    .sh-drawer-auth__actions {
        display: flex;
        flex-direction: column;
        gap: var(--s-2, 8px);
        margin-top: var(--s-3, 12px);
    }

    .sh-drawer-auth__login-btn {
        display: flex;
        align-items: center;
        gap: var(--s-2, 8px);
        width: 100%;
        padding: var(--s-3, 12px) var(--s-4, 16px);
        background: var(--color-accent, #2d7a5f);
        color: #fff;
        font-size: 15px;
        font-weight: 500;
        font-family: inherit;
        border: none;
        border-radius: var(--r-md, 10px);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background var(--transition-fast, 150ms ease);
    }

    .sh-drawer-auth__login-btn:active {
        background: var(--color-accent-hover, #236349);
    }

    .sh-drawer-auth__login-icon {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        stroke-width: 2;
        fill: none;
    }

    .sh-drawer-auth__link {
        display: flex;
        align-items: center;
        gap: var(--s-2, 8px);
        padding: var(--s-2, 8px) var(--s-3, 12px);
        background: var(--color-surface-elevated, #fff);
        color: var(--color-text, #2d2a26);
        font-size: 14px;
        font-weight: 500;
        text-decoration: none;
        border: 1px solid var(--color-border, #e8e4dd);
        border-radius: var(--r-sm, 6px);
        transition: background var(--transition-fast, 150ms ease);
    }

    .sh-drawer-auth__link:active {
        background: var(--color-surface, #f7f5f0);
    }

    .sh-drawer-auth__link-icon {
        width: 18px;
        height: 18px;
        stroke: var(--color-text-secondary, #6b6560);
        stroke-width: 1.75;
        fill: none;
    }

    .sh-drawer-auth__logout-btn {
        display: flex;
        align-items: center;
        gap: var(--s-2, 8px);
        width: 100%;
        padding: var(--s-2, 8px) var(--s-3, 12px);
        background: transparent;
        color: var(--color-error, #c45a5a);
        font-size: 14px;
        font-weight: 500;
        font-family: inherit;
        border: 1px solid var(--color-error, #c45a5a);
        border-radius: var(--r-sm, 6px);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background var(--transition-fast, 150ms ease);
    }

    .sh-drawer-auth__logout-btn:active {
        background: var(--color-error-light, #fdf0f0);
    }

    .sh-drawer-auth__logout-icon {
        width: 18px;
        height: 18px;
        stroke: currentColor;
        stroke-width: 1.75;
        fill: none;
    }

    /* ===== DRAWER CONTENT ===== */
    .sh-drawer__content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: var(--s-3, 12px) 0;
        padding-bottom: 80px;
    }

    /* ===== DRAWER MENU ===== */
    .sh-drawer-menu {
        display: flex;
        flex-direction: column;
    }

    .sh-drawer-menu__section {
        padding: 0 var(--s-4, 16px);
        margin-bottom: var(--s-3, 12px);
    }

    .sh-drawer-menu__section:not(:last-child) {
        padding-bottom: var(--s-3, 12px);
        border-bottom: 1px solid var(--color-border, #e8e4dd);
    }

    .sh-drawer-menu__title {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px !important;
        font-weight: 600;
        color: var(--color-text-secondary, #6b6560);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin: 0 0 6px 0 !important;
        padding: 0;
    }

    .sh-drawer-menu__title-icon {
        width: 14px;
        height: 14px;
        color: var(--color-accent, #2d7a5f);
        flex-shrink: 0;
    }

    .sh-drawer-menu__list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .sh-drawer-menu__link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 0 6px 8px;
        font-size: 13px;
        font-weight: 450;
        color: var(--color-text-secondary, #6b6560);
        text-decoration: none;
        letter-spacing: -0.01em;
        transition: color 150ms ease;
    }

    .sh-drawer-menu__link::before {
        content: '•';
        color: var(--color-text-muted, #a8a4a0);
        font-size: 10px;
    }

    .sh-drawer-menu__link:active {
        color: var(--color-text, #2d2a26);
    }

    .sh-drawer-menu__link.is-active {
        color: var(--color-accent, #2d7a5f);
        font-weight: 500;
    }

    .sh-drawer-menu__link.is-active::before {
        color: var(--color-accent, #2d7a5f);
    }

    /* Buttons for quick actions */
    .sh-drawer-menu__buttons {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .sh-drawer-menu__btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        font-size: 13px;
        font-weight: 500;
        color: var(--color-accent, #2d7a5f);
        text-decoration: none;
        background: var(--color-surface-elevated, #fff);
        border: 1px solid var(--color-border, #e8e4dd);
        border-radius: var(--r-sm, 6px);
        transition: all 150ms ease;
    }

    .sh-drawer-menu__btn:active {
        background: var(--color-surface, #f7f5f0);
    }

    .sh-drawer-menu__btn--accent {
        background: var(--color-warning-light, #fdf8eb);
        border-color: var(--color-warning, #c4943a);
        color: var(--color-warning, #c4943a);
    }

    .sh-drawer-menu__btn--accent:active {
        background: #faecd0;
    }

    .sh-drawer-menu__btn-icon {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    /* ===== BODY SCROLL LOCK ===== */
    body.sh-drawer-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        padding-top: 0;
    }

}
