/* ============================================
   CODZY — Global Styles, Navbar, Footer, Utils
   ============================================ */

/* ── Google Fonts (loaded via <link> in HTML) ── */
/* Outfit 400-800 + Inter 300-700 */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: var(--fw-regular);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    cursor: none;
}

/* Show default cursor on touch devices */
@media (pointer: coarse) {
    body {
        cursor: auto;
    }
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul,
ol {
    list-style: none;
}

button,
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    border: none;
    background: none;
}

button {
    cursor: none;
}

@media (pointer: coarse) {
    button {
        cursor: pointer;
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    color: var(--text-primary);
}

/* ── Container ── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm {
    max-width: var(--container-sm);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ── Section ── */
.section {
    padding: var(--space-24) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-16);
}

.section-header h2 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
}

.section-header .accent-line {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary), var(--gold-light));
    margin: 0 auto var(--space-6);
    border-radius: var(--radius-full);
}

.section-header p {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ── Glass Card ── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow), var(--glass-shadow);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-sticky);
    transition: background var(--transition-base), box-shadow var(--transition-base);
}

.navbar.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--border-subtle);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 100px;
    width: auto;
    display: block;
    object-fit: contain;
}

.footer-brand .logo-img {
    height: 120px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.nav-links a {
    position: relative;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: var(--space-2) 0;
    transition: color var(--transition-fast);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-primary));
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* Nav Right: theme toggle + cart icon */
.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--grey-800);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background var(--transition-base);
    display: flex;
    align-items: center;
    padding: 3px;
}

.theme-toggle .toggle-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    transition: transform var(--transition-spring);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="light"] .theme-toggle {
    background: var(--grey-200);
}

[data-theme="light"] .theme-toggle .toggle-thumb {
    transform: translateX(24px);
}

/* Cart Icon */
.nav-cart {
    position: relative;
    color: var(--text-secondary);
    font-size: var(--text-xl);
    transition: color var(--transition-fast);
}

.nav-cart:hover {
    color: var(--accent);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: var(--gold-primary);
    color: var(--navy-deep);
    font-size: 11px;
    font-weight: var(--fw-bold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-spring);
}

.cart-count.bump {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: var(--space-2);
    z-index: var(--z-overlay);
}

.hamburger span {
    width: 26px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-fast);
}

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

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

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

/* Mobile Nav */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: flex-start;
        padding: calc(var(--navbar-height) + var(--space-8)) var(--space-8) var(--space-8);
        gap: var(--space-6);
        transition: right var(--transition-slow);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.3);
        border-left: 1px solid var(--border-subtle);
        z-index: var(--z-overlay);
    }

    .nav-links.open {
        right: 0;
    }

    .hamburger {
        display: flex;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: var(--z-dropdown);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-base);
    }

    .mobile-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-16) 0 var(--space-8);
}

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

.footer-brand p {
    color: var(--text-secondary);
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    max-width: 280px;
    line-height: 1.8;
}

.footer-heading {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: var(--space-6);
}

.footer-links li {
    margin-bottom: var(--space-3);
}

.footer-links a {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent);
    padding-left: 6px;
}

/* Newsletter */
.footer-newsletter p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.newsletter-form {
    display: flex;
    gap: var(--space-2);
}

.newsletter-form input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast);
}

.newsletter-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.newsletter-form button {
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    color: var(--navy-deep);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.newsletter-form button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Social */
.footer-social {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.footer-social a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    transition: all var(--transition-base);
}

.footer-social a:hover {
    background: var(--accent);
    color: var(--navy-deep);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

/* Footer Bottom */
.footer-bottom {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

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

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
}

/* ============================================
   CUSTOM CURSOR
   ============================================ */
.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--gold-primary);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: var(--z-cursor);
    transition: width 0.15s, height 0.15s, background 0.15s;
    transform: translate(-50%, -50%);
}

.cursor-ring {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: var(--z-cursor);
    transition: width 0.3s, height 0.3s, border-color 0.3s;
    transform: translate(-50%, -50%);
}

.cursor-dot.hover {
    width: 14px;
    height: 14px;
    background: var(--gold-light);
}

.cursor-ring.hover {
    width: 50px;
    height: 50px;
    border-color: var(--gold-primary);
}

/* Hide on touch devices */
@media (pointer: coarse) {

    .cursor-dot,
    .cursor-ring {
        display: none;
    }
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    color: var(--navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    box-shadow: var(--shadow-glow-lg);
    transform: translateY(-4px);
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-6);
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-screen .loading-text {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    letter-spacing: 3px;
}

.loading-screen .loading-text span {
    color: var(--accent);
}

.loading-recommend {
    font-size: var(--text-xs);
    color: var(--grey-400);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: var(--space-2);
    opacity: 0.6;
}

/* ============================================
   PAGE TRANSITION OVERLAY
   ============================================ */
.page-transition {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--navy-deep), var(--navy-mid));
    z-index: 99998;
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 16px);
    right: 20px;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    padding: var(--space-4) var(--space-6);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: var(--shadow-lg);
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    color: var(--accent);
    font-size: var(--text-lg);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-8);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.25) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
}

.btn:active::after {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    color: var(--navy-deep);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
    color: var(--navy-deep);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--navy-deep);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-lg {
    padding: var(--space-4) var(--space-10);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-xs);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-accent {
    color: var(--accent);
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.text-gradient {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Responsive helpers ── */
@media (max-width: 1024px) {
    .section-header h2 {
        font-size: var(--text-3xl);
    }
}

@media (max-width: 768px) {
    .section {
        padding: var(--space-16) 0;
    }

    .section-header h2 {
        font-size: var(--text-2xl);
    }

    .container {
        padding: 0 var(--space-4);
    }
}

/* ── User Account Navbar ── */
.nav-user {
    position: relative;
    margin-left: var(--space-2);
}

.nav-user-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.nav-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    color: var(--navy-deep);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-heading);
    transition: box-shadow 0.3s, transform 0.3s;
}

.nav-user-btn:hover .nav-user-avatar {
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
    transform: scale(1.05);
}

.nav-user-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 220px;
    background: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-3) 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s ease;
    z-index: 1000;
}

.nav-user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-user-info {
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.nav-user-email {
    font-size: var(--text-xs);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-2) 0;
}

.nav-user-item {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: none;
    border: none;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-base);
}

.nav-user-item:hover {
    background: rgba(212, 175, 55, 0.08);
    color: var(--gold-primary);
}

/* Light mode overrides */
[data-theme="light"] .nav-user-avatar {
    background: linear-gradient(135deg, var(--navy-mid), var(--navy-deep));
    color: #fff;
}

[data-theme="light"] .nav-user-dropdown {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(10, 25, 47, 0.1);
}