:root {
    --primary-color: #0a84ff;
    --primary-hover: #006fe6;
    --secondary-color: #5f6368;
    --bg-color: #f5f7fb;
    --card-bg: rgba(255, 255, 255, 0.9);
    --surface-color: #ffffff;
    --text-color: #111827;
    --muted-color: #6b7280;
    --white: #ffffff;
    --black: #000000;
    --border-color: rgba(17, 24, 39, 0.08);
    --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    --glass: rgba(255, 255, 255, 0.74);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --max-width: 1200px;
    --navbar-height: 4.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #050505;
        --card-bg: rgba(29, 29, 31, 0.7);
        --text-color: #f5f5f7;
        --secondary-color: #a1a1a6;
        --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(10, 132, 255, 0.14) 0px, transparent 40%),
        radial-gradient(at 100% 0%, rgba(15, 23, 42, 0.06) 0px, transparent 35%),
        radial-gradient(at 100% 100%, rgba(10, 132, 255, 0.08) 0px, transparent 35%),
        radial-gradient(at 0% 100%, rgba(15, 23, 42, 0.04) 0px, transparent 35%);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

ul {
    list-style: none;
}

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    font-family: inherit;
    transition: var(--transition);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(180%) blur(22px);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

@media (prefers-color-scheme: dark) {
    .navbar {
        background-color: rgba(0, 0, 0, 0.8);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    opacity: 0.8;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
    width: 200px;
}

@media (prefers-color-scheme: dark) {
    .search-bar input {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--white);
    }
}

.cart-icon {
    position: relative;
    font-size: 1.25rem;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
}

/* Hero Section */
.hero {
    padding-top: calc(var(--navbar-height) + 5.5rem);
    padding-bottom: 7rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(2, 6, 23, 0.92), rgba(10, 132, 255, 0.32)), url('../assets/images/hero.png');
    background-size: cover;
    background-position: center;
    color: white;
    margin-bottom: 4rem;
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
}

.hero h1 {
    font-size: clamp(2.6rem, 4vw, 4.3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.035em;
    line-height: 1.05;
    text-shadow: 0 10px 32px rgba(0,0,0,0.28);
}

.hero p {
    font-size: 1.16rem;
    color: rgba(255,255,255,0.9);
    max-width: 720px;
    margin: 0 auto 2rem;
}

.btn {
    padding: 0.8rem 1.9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #1d4ed8);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(10, 132, 255, 0.24);
}

.btn-secondary {
    border: 1px solid rgba(0, 113, 227, 0.25);
    color: var(--primary-color);
    background: rgba(0, 113, 227, 0.08);
}

.btn-secondary:hover {
    background: rgba(0, 113, 227, 0.15);
    transform: translateY(-2px);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(8px);
}

.trust-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.trust-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.9rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 2rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.feature-card i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.feature-card p {
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.loading-state,
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1.5rem;
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--secondary-color);
    box-shadow: var(--shadow);
}

.loading-state i {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Product Card */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.product-card {
    background: var(--surface-color);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-radius: 24px;
    padding: 1.4rem;
    text-align: left;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), rgba(10, 132, 255, 0.15));
}

.product-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12);
    border-color: rgba(10, 132, 255, 0.28);
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    margin-bottom: 1.2rem;
    border-radius: 16px;
    background: linear-gradient(145deg, #f8fbff, #eef4ff);
    padding: 1rem;
}

.image-fallback {
    object-fit: contain;
    opacity: 0.92;
}

.product-brand {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    padding: 4rem 0 2rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(245,247,251,0.92));
    margin-top: 6rem;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul li a {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    color: var(--muted-color);
    font-size: 0.85rem;
}

/* --- UI Improvements --- */

#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
}

.toast {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.toast i {
    color: #34c759;
    font-size: 1.25rem;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

@media (prefers-color-scheme: dark) {
    .toast {
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.float-animate {
    animation: float 4s ease-in-out infinite;
}

/* ===== Hamburger Menu ===== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1100;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: var(--text-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

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

.hamburger.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--surface-color);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    padding: 5rem 1.5rem 2rem;
    overflow-y: auto;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-nav-overlay.active .mobile-nav-panel {
    right: 0;
}

.mobile-nav-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

#mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

#mobile-nav-links li {
    margin: 0;
}

#mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    transition: background 0.2s;
}

#mobile-nav-links a:hover {
    background: rgba(0, 113, 227, 0.05);
}

#mobile-nav-links .user-profile-dropdown {
    display: none;
}

.mobile-nav-auth {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.3);
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    border: none;
}

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

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
}

/* Skeleton Loading */
.skeleton {
    position: relative;
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
}

.skeleton-card {
    height: 380px;
    padding: 1.4rem;
}

.skeleton-detail {
    height: 500px;
}

.skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.15) 50%,
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile filter toggle button */
.filter-toggle-btn {
    display: none;
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    .nav-links {
        display: none;
    }
    .navbar {
        height: auto;
        padding: 0.8rem 0;
    }
    .nav-container {
        gap: 0.8rem;
    }
    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }
    .search-bar {
        flex: 1;
    }
    .search-bar input {
        width: 100%;
    }
    .hero {
        padding-top: calc(var(--navbar-height) + 4rem);
        padding-bottom: 4.5rem;
    }
    .hero h1 {
        font-size: 2.35rem;
    }
    .hero p {
        font-size: 1.02rem;
    }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .section-heading {
        flex-direction: column;
        align-items: start;
    }
    .product-card {
        padding: 1rem;
    }
    .product-image {
        height: 180px;
    }
    .filter-toggle-btn {
        display: flex;
    }
    .filters.active {
        display: block;
    }
}

footer, .reviews-section, .related-products {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

body.nav-open {
    overflow: hidden;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.quantity-btn {
    min-width: 36px;
    min-height: 36px;
}

.admin-mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .search-bar input {
        font-size: 1rem;
    }
    .quantity-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .admin-mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border-color);
        z-index: 999;
        justify-content: space-around;
        padding: 0.5rem 0;
        backdrop-filter: blur(12px);
    }
    .admin-mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        font-size: 0.65rem;
        color: var(--secondary-color);
        text-decoration: none;
        padding: 0.3rem 0.5rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    .admin-mobile-nav a i {
        font-size: 1.2rem;
    }
    .admin-mobile-nav a.active {
        color: var(--primary-color);
    }
    body {
        padding-bottom: 4rem;
    }
    .admin-main {
        padding-bottom: 5rem;
    }
    table {
        font-size: 0.8rem;
    }
    table th, table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    .cart-item {
        gap: 1rem;
        padding: 1rem 0;
    }
    .cart-item img {
        width: 70px;
        height: 70px;
    }
    .qty-btn {
        min-width: 36px;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .cart-item {
        flex-wrap: wrap;
    }
    .cart-item .item-price {
        width: auto;
    }
    .checkout-summary {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        z-index: 10;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
    .footer-content {
        gap: 1.5rem;
    }
}
