/*
 * Navigation Component
 */

/* ── Page transition progress bar ────────────────── */
.wishly-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: calc(var(--w-z-header) + 10);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wishly-progress-bar--active {
    opacity: 1;
}

.wishly-progress-bar__fill {
    height: 100%;
    width: 0%;
    background: var(--w-gradient-primary);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5), 0 0 5px rgba(124, 58, 237, 0.3);
    border-radius: 0 2px 2px 0;
    transition: width 0.3s ease;
    will-change: width;
}

.wishly-progress-bar--finishing .wishly-progress-bar__fill {
    transition: width 0.2s ease, opacity 0.4s ease 0.2s;
    width: 100% !important;
    opacity: 0;
}

.wishly-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--w-header-height);
    z-index: var(--w-z-header);
    background: rgba(10, 10, 11, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--w-border-primary);
    transition: background var(--w-transition-base), box-shadow var(--w-transition-base);
}

[data-theme="light"] .wishly-header {
    background: rgba(250, 250, 250, 0.92);
}

.wishly-header--scrolled {
    box-shadow: var(--w-shadow-md);
}

.wishly-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--w-header-height);
    gap: var(--w-space-4);
}

/* Logo */
.wishly-logo {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    font-weight: 800;
    font-size: var(--w-text-xl);
    color: var(--w-text-primary);
    transition: opacity var(--w-transition-fast);
}

.wishly-logo:hover {
    opacity: 0.8;
}

.wishly-logo__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--w-gradient-primary);
    border-radius: var(--w-radius-lg);
    color: #fff;
    font-weight: 900;
    font-size: var(--w-text-lg);
}

/* Menu */
.wishly-nav__menu {
    display: flex;
    align-items: center;
    gap: var(--w-space-1);
}

.wishly-nav__link {
    display: flex;
    align-items: center;
    gap: var(--w-space-1);
    padding: var(--w-space-2) var(--w-space-3);
    font-size: var(--w-text-sm);
    font-weight: 500;
    color: var(--w-text-secondary);
    border-radius: var(--w-radius-lg);
    transition: all var(--w-transition-fast);
    white-space: nowrap;
}

.wishly-nav__link:hover {
    color: var(--w-text-primary);
    background: var(--w-bg-glass);
}

[data-theme="light"] .wishly-nav__link:hover {
    background: rgba(0, 0, 0, 0.07);
}

.wishly-nav__link--active {
    color: var(--w-accent);
    background: var(--w-accent-light);
}

/* Actions */
.wishly-nav__actions {
    display: flex;
    align-items: center;
    gap: var(--w-space-3);
}

/* Theme toggle — 44px minimum touch target */
.wishly-nav__theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--w-radius-lg);
    color: var(--w-text-secondary);
    transition: all var(--w-transition-fast);
}

.wishly-nav__theme-toggle:hover {
    background: var(--w-bg-glass);
    color: var(--w-text-primary);
}

[data-theme="light"] .wishly-nav__theme-toggle:hover {
    background: rgba(0, 0, 0, 0.07);
}

.wishly-nav__theme-icon--light { display: none; }
.wishly-nav__theme-icon--dark  { display: flex; }

[data-theme="light"] .wishly-nav__theme-icon--light { display: flex; }
[data-theme="light"] .wishly-nav__theme-icon--dark  { display: none; }

/* XP pill */
.wishly-nav__xp-pill {
    display: flex;
    align-items: center;
    gap: var(--w-space-1);
    padding: var(--w-space-1) var(--w-space-3);
    background: var(--w-accent-light);
    color: var(--w-accent);
    border-radius: var(--w-radius-full);
    font-size: var(--w-text-xs);
    font-weight: 700;
    transition: all var(--w-transition-fast);
}

.wishly-nav__xp-pill:hover {
    background: var(--w-accent);
    color: #fff;
}

/* Logout icon button */
.wishly-nav__logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--w-text-secondary);
    border-radius: var(--w-radius-lg);
    transition: all var(--w-transition-fast);
    flex-shrink: 0;
}

.wishly-nav__logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.wishly-nav__logout:focus-visible {
    outline: 2px solid var(--w-accent);
    outline-offset: 2px;
}

/* Mobile toggle — 44px minimum touch target */
.wishly-nav__mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: var(--w-radius-lg);
    color: var(--w-text-primary);
}

.wishly-nav__mobile-icon--close { display: none; }

.wishly-nav__mobile-toggle[aria-expanded="true"] .wishly-nav__mobile-icon--open  { display: none; }
.wishly-nav__mobile-toggle[aria-expanded="true"] .wishly-nav__mobile-icon--close { display: flex; }

/* Mobile menu */
.wishly-nav__mobile-menu {
    display: none;
    position: fixed;
    top: var(--w-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--w-bg-primary);
    padding: var(--w-space-6);
    z-index: var(--w-z-overlay);
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--w-transition-base);
}

.wishly-nav__mobile-menu--open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li {
    animation: wishly-slide-up 0.3s ease forwards;
    opacity: 0;
}

.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(1) { animation-delay: 50ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(2) { animation-delay: 100ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(3) { animation-delay: 150ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(4) { animation-delay: 200ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(5) { animation-delay: 250ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(6) { animation-delay: 300ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(7) { animation-delay: 350ms; }
.wishly-nav__mobile-menu--open .wishly-nav__mobile-list li:nth-child(8) { animation-delay: 400ms; }

.wishly-nav__mobile-list {
    display: flex;
    flex-direction: column;
    gap: var(--w-space-2);
}

.wishly-nav__mobile-link {
    display: flex;
    align-items: center;
    gap: var(--w-space-4);
    padding: var(--w-space-4) var(--w-space-4);
    font-size: var(--w-text-lg);
    font-weight: 500;
    color: var(--w-text-secondary);
    border-radius: var(--w-radius-xl);
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.wishly-nav__mobile-link:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.wishly-nav__mobile-link span {
    flex: 1;
}

.wishly-nav__mobile-link:hover {
    background: var(--w-bg-glass);
    color: var(--w-text-primary);
}

[data-theme="light"] .wishly-nav__mobile-link:hover {
    background: rgba(0, 0, 0, 0.07);
}

/* Main content offset */
.wishly-main {
    padding-top: var(--w-header-height);
    min-height: calc(100vh - var(--w-header-height));
}

/* ── SPA page transition animations ──────────────── */
.wishly-main--exiting {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.wishly-main--entering {
    opacity: 0;
    transform: translateY(12px);
    animation: wishly-page-enter 220ms ease forwards;
}

@keyframes wishly-page-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wishly-main--exiting {
        transform: none;
        transition: opacity 100ms ease;
    }
    .wishly-main--entering {
        transform: none;
        animation-duration: 100ms;
    }
}

/* Responsive — hide desktop menu below 1024px (7 nav items need the space) */
@media (max-width: 1024px) {
    .wishly-nav__menu { display: none; }
    .wishly-nav__mobile-toggle { display: flex; }
}

/* At medium desktop widths, hide nav icons to recover ~90px of horizontal space */
@media (max-width: 1280px) and (min-width: 1025px) {
    .wishly-nav__link svg { display: none; }
    .wishly-nav__link { gap: 0; }
}

/* ── Footer ────────────────────────────────────── */
.wishly-footer {
    border-top: 1px solid var(--w-border-primary);
    padding: var(--w-space-16) 0 var(--w-space-8);
    background: var(--w-bg-secondary);
}

.wishly-footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--w-space-10);
    margin-bottom: var(--w-space-12);
}

.wishly-footer__brand {
    max-width: 320px;
}

.wishly-footer__logo {
    display: flex;
    align-items: center;
    gap: var(--w-space-2);
    font-weight: 800;
    font-size: var(--w-text-xl);
    margin-bottom: var(--w-space-3);
}

.wishly-footer__tagline {
    font-size: var(--w-text-sm);
    font-weight: 600;
    color: var(--w-accent);
    margin-bottom: var(--w-space-3);
}

.wishly-footer__description {
    font-size: var(--w-text-sm);
    color: var(--w-text-secondary);
    line-height: var(--w-leading-relaxed);
}

.wishly-footer__heading {
    font-size: var(--w-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--w-tracking-wider);
    color: #c4c4c8;
    margin-bottom: var(--w-space-4);
}

.wishly-footer__links ul {
    display: flex;
    flex-direction: column;
    gap: var(--w-space-3);
}

.wishly-footer__links a {
    font-size: var(--w-text-sm);
    color: #c4c4c8;
    transition: color var(--w-transition-fast);
}

.wishly-footer__links a:hover {
    color: var(--w-text-primary);
}

.wishly-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--w-space-8);
    border-top: 1px solid var(--w-border-primary);
    font-size: var(--w-text-xs);
    color: var(--w-text-tertiary);
}

.wishly-footer__made {
    color: var(--w-text-tertiary);
}

@media (max-width: 768px) {
    .wishly-footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--w-space-8);
    }

    .wishly-footer__brand {
        grid-column: 1 / -1;
        max-width: none;
    }

    .wishly-footer__bottom {
        flex-direction: column;
        gap: var(--w-space-2);
        text-align: center;
    }
}

/* ── Focus styles for accessibility ──────────────── */
.wishly-nav__link:focus-visible,
.wishly-nav__theme-toggle:focus-visible,
.wishly-nav__xp-pill:focus-visible,
.wishly-nav__mobile-toggle:focus-visible,
.wishly-nav__mobile-link:focus-visible,
.wishly-footer__links a:focus-visible,
.wishly-filter-chip:focus-visible {
    outline: 2px solid var(--w-accent);
    outline-offset: 2px;
}

/* ── Skip to main link ───────────────────────────── */
.wishly-skip-link {
    position: absolute;
    top: -100%;
    left: var(--w-space-4);
    z-index: calc(var(--w-z-header) + 1);
    padding: var(--w-space-3) var(--w-space-6);
    background: var(--w-accent);
    color: #fff;
    border-radius: var(--w-radius-lg);
    font-weight: 600;
    font-size: var(--w-text-sm);
    transition: top var(--w-transition-fast);
}

.wishly-skip-link:focus {
    top: var(--w-space-4);
}
