/* ==============================================
   Mobile Navigation - Hamburger Menu & Bottom Tab
   ============================================== */

/* --- Hamburger Button --- */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    position: relative;
    z-index: var(--z-hamburger);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 20px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-btn.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Mobile Drawer --- */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-drawer-overlay);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.open {
    display: block;
    opacity: 1;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: var(--color-card-bg);
    z-index: var(--z-drawer);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.mobile-drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: hsl(var(--primary-foreground));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-lg);
}

.mobile-drawer-user-name {
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
}

.mobile-drawer-user-email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.mobile-drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.mobile-drawer-close:hover {
    background: var(--color-secondary-bg);
}

.mobile-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) 0;
}

.mobile-drawer-section {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.mobile-drawer-section:last-child {
    border-bottom: none;
}

.mobile-drawer-section-title {
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--color-text-muted);
}

.mobile-drawer-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    transition: background var(--transition-fast);
    text-decoration: none;
}

.mobile-drawer-link:hover,
.mobile-drawer-link.active {
    background: var(--color-secondary-bg);
    color: var(--color-primary);
}

.mobile-drawer-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    flex-shrink: 0;
}

.mobile-drawer-link:hover svg,
.mobile-drawer-link.active svg {
    opacity: 1;
}

.mobile-drawer-badge {
    margin-left: auto;
    background: var(--color-sale);
    color: var(--color-on-dark);
    font-size: var(--text-2xs);
    font-weight: var(--font-semibold);
    padding: var(--space-05) var(--space-2);
    border-radius: 9999px;
    min-width: 20px;
    text-align: center;
}

.mobile-drawer-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.mobile-drawer-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
    font-size: var(--text-md);
    color: var(--color-text);
}

.theme-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--color-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: none;
    padding: 0;
}

.theme-switch.active {
    background: var(--color-primary);
}

.theme-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--color-card-bg);
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.theme-switch.active .theme-switch-knob {
    transform: translateX(20px);
}

/* --- Bottom Tab Bar --- */
:root {
    --bottom-tab-height: 0px;
}

.bottom-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--color-card-bg);
    border-top: 1px solid var(--color-border);
    z-index: var(--z-bottom-tab);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 56px;
    max-width: 500px;
    margin: 0 auto;
}

.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-05);
    flex: 1;
    padding: var(--space-15) 0;
    min-height: 44px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--text-2xs);
    font-weight: var(--font-medium);
    transition: color var(--transition-fast), transform 0.1s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-tab-item svg {
    width: 22px;
    height: 22px;
}

.bottom-tab-item.active {
    color: var(--color-primary);
}

.bottom-tab-item.active svg {
    stroke-width: 2.5;
}

.bottom-tab-item.active::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-top: var(--space-1);
    transition: transform 0.2s ease;
}

.bottom-tab-item.active .bottom-tab-label,
.bottom-tab-item.active span {
    font-weight: var(--font-medium);
}

.bottom-tab-item:active {
    transform: scale(0.95);
}

.bottom-tab-badge {
    position: absolute;
    top: 0;
    right: calc(50% - 18px);
    background: var(--color-sale);
    color: var(--color-on-dark);
    font-size: var(--text-2xs);
    font-weight: var(--font-bold);
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .header-nav {
        display: none;
    }

    .header-logout {
        display: none;
    }

    .bottom-tab-bar {
        display: block;
    }

    :root {
        --bottom-tab-height: 56px;
    }

    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }

    .site-footer {
        margin-bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .header-actions .header-action-link:not(.header-search-toggle):not(.header-cart) {
        display: none;
    }

    .mobile-drawer {
        width: 100%;
        max-width: 100vw;
    }
}
