/* Navigation */
:root {
    --nav-height: 64px;
    --transition-snappy: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.03em;
    text-decoration: none;
    transition: transform var(--transition-snappy);
}

.nav-brand:hover {
    transform: scale(1.02);
    text-decoration: none;
}

.nav-brand span {
    color: var(--color-accent);
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    list-style: none;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--color-muted);
    font-weight: 600;
    text-decoration: none;
    position: relative;
    padding: 0.25rem 0;
    transition: color var(--transition-snappy);
}

.nav-links a:hover {
    color: var(--color-text);
}

/* Elegant underline slide effect on desktop link hover */
.nav-links li a:not(.btn-nav)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-snappy);
}

.nav-links li a:not(.btn-nav):hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Cart Badge Enhancement */
.cart-count {
    background: var(--color-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 99px;
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

/* Clean Accent Buttons */
.nav-links .btn-nav {
    background: var(--color-accent);
    color: #fff !important;
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(var(--color-accent-rgb, 99, 102, 241), 0.25);
    transition: background var(--transition-snappy), transform 0.1s, box-shadow var(--transition-snappy);
}

.nav-links .btn-nav:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 4px 12px rgba(var(--color-accent-rgb, 99, 102, 241), 0.35);
}

.nav-links .btn-nav:active {
    transform: scale(0.96);
}


/* Navigation Search */
.nav-search {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    max-width: 420px;
    margin: 0 2rem;
}

.nav-search input {
    flex: 1;
    height: 34px;
    padding: 0 0.875rem;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 0.875rem;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color 0.15s;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.nav-search button {
    height: 34px;
    padding: 0 1rem;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.nav-search button:hover {
    background: var(--color-accent-hover);
}


/* ============================================================
   MOBILE RESPONSIVENESS 
   ============================================================ */

/* ── Hamburger button - hidden on desktop ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 6px;
    border: none;
    background: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.22s ease;
    transform-origin: center;
}

/* ── Drawer: hidden by default (all screen sizes) ── */
.nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    visibility: hidden;
}

.nav-drawer.nav-drawer-open {
    transform: translateX(0);
    visibility: visible;
}

.nav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 499;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.nav-drawer-overlay.nav-drawer-overlay-open {
    opacity: 1;
    pointer-events: auto;
}

.nav-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.nav-drawer-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.nav-drawer-brand span {
    color: var(--color-accent);
}

.nav-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-muted);
    padding: 4px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.nav-drawer-close:hover {
    color: var(--color-text);
}

.nav-drawer-search {
    display: flex;
    gap: 0;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.nav-drawer-search input {
    flex: 1;
    height: 40px;
    padding: 0 0.875rem;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 0.9rem;
    background: var(--color-bg);
    color: var(--color-text);
}

.nav-drawer-search input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.nav-drawer-search button {
    height: 40px;
    padding: 0 1rem;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.nav-drawer-search button:hover {
    background: var(--color-accent-hover);
}

.nav-drawer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    flex: 1;
}

.nav-drawer-links li a,
.nav-drawer-links .drawer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    transition: background 0.12s;
    text-decoration: none;
}

.nav-drawer-links li:last-child a {
    border-bottom: none;
}

.nav-drawer-links li a:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.nav-drawer-links .drawer-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    cursor: default;
}

.nav-drawer-links .btn-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: none !important;
    color: var(--color-accent);
}

/* ── Drawer link icons ── */
.nav-drawer-links svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-drawer-links li a:hover svg {
    opacity: 1;
}

.nav-drawer-links .btn-nav svg {
    opacity: 0.8;
}

.nav-drawer-links .drawer-user svg {
    opacity: 0.4;
}

/* Search Bar Autocomplete */

.autocomplete-wrapper {
    position: relative;
    flex: 1;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--color-bg);
    color: var(--color-accent);
}

.nav-search .autocomplete-wrapper {
    flex: 1;
    position: relative;
    display: flex;
}

.nav-search .autocomplete-wrapper input {
    flex: 1;
    width: 100%;
}

.commander-modal .autocomplete-dropdown {
    z-index: 500;
}
/* User account dropdown (desktop) */
.nav-user-menu {
    position: relative;
}

.nav-user-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    padding: 0.25rem 0;
    font-family: inherit;
}

.nav-user-trigger i {
    font-size: 0.75rem;
    transition: transform 0.15s;
}

.nav-user-menu.open .nav-user-trigger i {
    transform: rotate(180deg);
}

.nav-user-dropdown {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}

.nav-user-menu.open .nav-user-dropdown {
    display: flex;
}

.nav-user-dropdown a,
.nav-user-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-user-dropdown a:hover,
.nav-user-dropdown-item:hover {
    background: var(--color-bg);
    color: var(--color-accent);
}

.nav-user-dropdown form {
    margin: 0;
}

/* Mobile drawer: 2FA form needs to look like its sibling <a> links */
.drawer-form {
    margin: 0;
}

.drawer-form button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    color: var(--color-text);
    border: none;
    border-bottom: 1px solid var(--color-border);
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.12s;
}

.drawer-form button:hover {
    background: var(--color-bg);
}

.nav-drawer-links li:last-child .drawer-form button {
    border-bottom: none;
}
