/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* Global Custom CSS Variables & Tokens */
:root {
    --bg-dark: #0a0e17;
    --bg-card: rgba(22, 31, 48, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents (和谐色彩) */
    --color-primary: #6366f1; /* Indigo */
    --color-secondary: #a855f7; /* Purple */
    --color-accent: #f43f5e; /* Rose */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #f43f5e 100%);
    --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(244, 63, 94, 0.15));
    
    /* Status Colors */
    --color-success: #10b981; /* Emerald */
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444; /* Red */
    --color-info: #0ea5e9; /* Sky */
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Theme Swapping Engine Additions */
    --bg-input: rgba(15, 23, 42, 0.6);
    --bg-input-focus: rgba(15, 23, 42, 0.8);
    --header-bg: rgba(10, 14, 23, 0.75);
    --footer-bg: rgba(10, 14, 23, 0.9);
    --bg-btn-secondary: rgba(255, 255, 255, 0.05);
    --bg-btn-secondary-hover: rgba(255, 255, 255, 0.1);
    --bg-product-image: #1e293b;
    
    --box-shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --box-shadow-card-hover: 0 12px 40px 0 rgba(99, 102, 241, 0.15);
}

:root.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-glow: rgba(99, 102, 241, 0.15);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Accents (Darker gradient for premium light mode text/visual legibility) */
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    --gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(219, 39, 119, 0.08));
    
    /* Theme Swapping Engine Additions */
    --bg-input: rgba(255, 255, 255, 0.8);
    --bg-input-focus: rgba(255, 255, 255, 0.95);
    --header-bg: rgba(248, 250, 252, 0.75);
    --footer-bg: rgba(241, 245, 249, 0.9);
    --bg-btn-secondary: rgba(15, 23, 42, 0.05);
    --bg-btn-secondary-hover: rgba(15, 23, 42, 0.1);
    --bg-product-image: #f1f5f9;
    
    --color-success: #059669; /* Darker emerald green for premium light mode legibility */
    --color-danger: #dc2626; /* Darker red for premium light mode legibility */
    
    --box-shadow-card: 0 8px 32px 0 rgba(15, 23, 42, 0.05);
    --box-shadow-card-hover: 0 12px 40px 0 rgba(99, 102, 241, 0.08);
}

:root.light-theme body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(244, 63, 94, 0.02) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.02) 0%, transparent 50%);
}

/* Reset and Core Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(244, 63, 94, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    overflow-x: hidden;
    transition: var(--transition-smooth);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Glassmorphism Card styling */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: var(--transition-smooth);
    box-shadow: var(--box-shadow-card);
}

.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--box-shadow-card-hover);
    transform: translateY(-4px);
    background: var(--bg-card-hover);
}

/* Input Fields Styling */
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: var(--bg-input-focus);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Button Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-bounce);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--color-btn-bg, var(--gradient-primary));
    color: var(--color-btn-text, #ffffff);
    box-shadow: 0 4px 15px rgba(var(--color-btn-shadow-rgb, 168, 85, 247), 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 22px rgba(var(--color-btn-shadow-rgb, 168, 85, 247), 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-btn-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-btn-secondary-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-accent {
    background: var(--color-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-accent:hover {
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.5);
    transform: translateY(-2px);
}

/* Header & Navigation */
.header-glass {
    position: sticky;
    top: 0;
    z-index: 1000; /* Higher z-index to stay above other page layers */
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: var(--transition-smooth);
}

.nav-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.logo-glow {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.search-bar-container {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--color-primary);
}

.cart-icon-wrapper {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.5);
}

/* Header Actions & Unified Premium Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-bounce);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-btn-secondary);
    cursor: pointer;
}

.nav-link-icon:hover {
    color: var(--text-primary);
    background: var(--bg-btn-secondary-hover);
    transform: translateY(-2px);
}

.nav-link-icon:active {
    transform: scale(0.95);
}

.theme-toggle-icon-btn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-btn-secondary);
    box-shadow: none;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-bounce);
}

.theme-toggle-icon-btn:hover {
    background: var(--bg-btn-secondary-hover);
    transform: translateY(-2px);
}

.theme-toggle-icon-btn:active {
    transform: scale(0.95);
}

/* Mobile Search Overlay Modal */
.search-overlay-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 2000; /* Extremely high z-index to overlay everything */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.light-theme .search-overlay-modal {
    background: rgba(248, 250, 252, 0.96);
}

.search-overlay-modal.active {
    opacity: 1;
    pointer-events: all;
}

.search-modal-content {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 2.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-bounce);
}

.close-modal-btn:hover {
    color: var(--text-primary);
    transform: scale(1.15);
}

.search-modal-form {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-modal-input {
    font-size: 1.15rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: var(--box-shadow-card);
}

.quick-links-search {
    margin-top: 0.5rem;
}

/* Mobile Sticky Bottom Tab Bar */
.mobile-bottom-nav {
    display: none; /* Hidden on desktop */
}

.auth-buttons-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Premium Responsive Viewport Breakpoints Overrides */
@media (max-width: 991px) {
    /* Push content up to avoid bottom-tab clipping */
    body {
        padding-bottom: 72px !important;
    }

    .search-bar-container {
        display: none !important;
    }

    /* Account Menu Side-Drawer (Slides from Right) */
    .nav-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        background: var(--header-bg);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        padding: 4rem 2.25rem;
        gap: 1.5rem;
        z-index: 2010; /* Stacked above sticky bottom nav */
        transform: translateX(100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        border-left: 1px solid var(--border-color);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
    }

    :root.light-theme .nav-links {
        box-shadow: -10px 0 30px rgba(15, 23, 42, 0.05);
    }

    .nav-links.active {
        transform: translateX(0);
        opacity: 1;
        pointer-events: all;
    }

    .auth-buttons-wrapper {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        margin-top: 1.5rem;
    }

    .auth-buttons-wrapper .btn {
        width: 100%;
        padding: 0.8rem;
    }

    .logout-form {
        width: 100%;
        margin-top: 1.5rem;
    }

    .logout-btn {
        width: 100%;
        padding: 0.8rem;
        display: block;
        text-align: center;
    }

    .nav-link {
        font-size: 1.15rem;
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-family: var(--font-heading);
    }

    :root.light-theme .nav-link {
        border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    }

    .nav-link.active {
        border-bottom-color: var(--color-primary);
        font-weight: 600;
        color: var(--color-primary);
    }

    .user-greeting {
        padding: 0.5rem;
        font-size: 1rem;
        color: var(--text-secondary);
        display: block;
    }

    /* Sticky Bottom Nav Bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--header-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        z-index: 1005;
        justify-content: space-around;
        align-items: center;
        padding: 5px 0 8px 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    :root.light-theme .mobile-bottom-nav {
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.03);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        font-size: 0.7rem;
        font-family: var(--font-heading);
        font-weight: 600;
        text-decoration: none;
        flex: 1;
        height: 100%;
        position: relative;
        transition: var(--transition-bounce);
        cursor: pointer;
    }

    .mobile-nav-item svg {
        margin-bottom: 2px;
        transition: var(--transition-bounce);
    }

    .mobile-nav-item span {
        transition: var(--transition-bounce);
    }

    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--color-primary);
    }

    .mobile-nav-item.active svg,
    .mobile-nav-item:hover svg {
        transform: translateY(-2px);
        color: var(--color-primary);
        filter: drop-shadow(0 0 4px var(--border-glow));
    }
}



/* Badge status colors */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-badge, rgba(99, 102, 241, 0.15));
    color: var(--color-badge-text-override, var(--color-primary));
    border: 1px solid var(--border-badge, rgba(99, 102, 241, 0.3));
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-confirmed { background: rgba(14, 165, 233, 0.15); color: var(--color-info); border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-packed { background: rgba(168, 85, 247, 0.15); color: var(--color-secondary); border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-shipped { background: rgba(99, 102, 241, 0.15); color: var(--color-primary); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-delivered { background: rgba(16, 185, 129, 0.15); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Grid Layouts */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* Product Card */
.product-card {
    position: relative;
    overflow: hidden;
}

.product-image-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: var(--bg-product-image);
    border: 1px solid var(--border-color);
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-bounce);
}

.product-card:hover .product-img {
    transform: scale(1.08);
}

.product-discount-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.product-info-wrap {
    margin-top: 1rem;
}

.product-seller-label {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.product-name-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.product-ratings {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-warning);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.product-pricing-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.current-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.compare-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Footer styling */
footer {
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 2rem 0;
    background: var(--footer-bg);
    margin-top: 5rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

/* Toast alert styling */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    color: #ffffff; /* Explicit white text in dark mode toast alerts */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

:root.light-theme .toast {
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a; /* Highly-legible dark slate text in light mode toast alerts */
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-left: 4px solid var(--color-primary);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-error { border-left-color: var(--color-danger); }
.toast.toast-warning { border-left-color: var(--color-warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Tracking Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin: 2rem 0;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: calc(-2rem - 6px);
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg-dark);
    transition: var(--transition-smooth);
}

.timeline-item.completed::after {
    background: var(--color-success);
    box-shadow: 0 0 10px var(--color-success);
}

.timeline-item.active::after {
    background: var(--color-primary);
    box-shadow: 0 0 12px var(--color-primary);
    transform: scale(1.3);
}

/* Simple Responsive Sidebar Grid (Filters) */
.shop-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

@media (max-width: 992px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }
}

/* Animated Shifting Gradient Banners System */
@keyframes dynamicGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-banner-bg {
    background-size: 200% 200% !important;
    animation: dynamicGradientShift 14s ease infinite !important;
}

/* Glowing Button Processing Spin Animation */
@keyframes spin-submit {
    to { transform: rotate(360deg); }
}
