/* ============================================================
   MobileHub — Frontend Storefront CSS
   Atlas Theme Redesign Full Implementation
   ============================================================ */

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

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

:root {
    /* Color Palette */
    --color-bg: #FFFFFF;
    --color-bg-alt: #F4F4F4;
    --color-surface: #FFFFFF;
    --color-border: #E8E8E8;
    --color-border-light: #F2F2F2;
    --color-text: #1C1D1D;
    --color-text-secondary: #565656;
    --color-text-muted: #8E8E8E;

    /* Brand Colors - Atlas */
    --color-accent: #3A58DA;
    --color-accent-hover: #2940A3;

    /* Semantic Colors */
    --color-success: #3E8746;
    --color-badge-bestseller: #3A58DA;
    --color-badge-new: #E85D04;
    --color-badge-sale: #DC2626;

    /* Typography */
    --font-family: 'Inter', sans-serif;

    /* Layout & Sizing */
    --max-width: 1400px;

    /* UI Elements */
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-drawer: -4px 0 24px rgba(0, 0, 0, 0.15);

    --transition: 0.25s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    font-size: 15px;
    overflow-x: hidden;
}

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

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

button {
    cursor: pointer;
    font-family: inherit;
}

/* ============================================================
   Container
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 40px;
}

@media(max-width: 768px) {
    .container {
        padding: 0 20px;
    }
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
}

.header-top {
    padding: 20px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--color-text);
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.header-search {
    flex-grow: 1;
    max-width: 600px;
    position: relative;
}

.header-search input {
    width: 100%;
    background: var(--color-bg-alt);
    border: none;
    border-radius: var(--radius-full);
    padding: 12px 20px 12px 44px;
    font-size: 15px;
    outline: none;
}

.header-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    color: var(--color-text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-actions .action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    background: none;
    border: none;
}

.header-actions .action-item svg {
    width: 20px;
}

.nav-row {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centered Navigation */
    padding-bottom: 16px;
}

.nav-main {
    display: flex;
    gap: 32px;
}

.nav-main a {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.nav-main a:hover,
.nav-main a.active {
    color: var(--color-accent) !important;
    font-weight: 800;
    position: relative;
}
.nav-main a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
}

/* MOBILE NAV BUG FIX */
.mobile-nav {
    display: none;
    /* strictly hide on desktop */
    flex-direction: column;
    background: var(--color-bg-alt);
    padding: 20px;
    gap: 16px;
}

@media(max-width: 768px) {

    .nav-main,
    .header-search {
        display: none;
    }

    .mobile-nav.open {
        display: flex;
    }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    transition: all var(--transition);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
}

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

.btn-outline:hover {
    background: var(--color-text);
    color: #fff;
}

.btn-block {
    width: 100%;
}

/* ============================================================
   Hero Section Matrix (MobileHub)
   ============================================================ */
.hero-matrix {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    padding: 32px 0;
}

.hero-primary {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    padding: 40px;
    background: #1C1D1D;
}

.hero-primary img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: #fff;
    max-width: 500px;
}

.hero-content h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.1;
}

.hero-content p {
    font-size: 16px;
    margin-bottom: 32px;
    opacity: 0.9;
}

.hero-content .cta-group {
    display: flex;
    gap: 12px;
}

.hero-content .btn {
    background: #fff;
    color: var(--color-text);
    border-radius: 100px;
}

.hero-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-side-card {
    flex: 1;
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.hero-side-card h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    z-index: 2;
    position: relative;
}

.hero-side-card .btn {
    background: #fff;
    color: #000;
    align-self: flex-start;
    z-index: 2;
    position: relative;
    border-radius: 100px;
    padding: 8px 20px;
}

.hero-side-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    z-index: 1;
}

/* ============================================================
   Listing Page & Toolbar
   ============================================================ */
.page-header {
    background: var(--color-bg-alt);
    padding: 32px 0;
    margin-bottom: 32px;
}

.breadcrumbs {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.listing-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.listing-toolbar .result-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.listing-filters input,
.listing-filters select {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    font-family: inherit;
    font-size: 14px;
}

/* ============================================================
   Swiper Category Grid
   ============================================================ */
.section {
    padding: 64px 0;
}

.section-header {
    margin-bottom: 32px;
}

.section-header p {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.section-header h2 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.category-card {
    display: flex;
    flex-direction: column;
}

.category-card .cat-img-box {
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    aspect-ratio: 4/5;
    overflow: hidden;
    margin-bottom: 16px;
}

.category-card .cat-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.category-card p {
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Swiper Arrows Customization */
.swiper-button-next, .swiper-button-prev {
    background: #fff;
    color: var(--color-text) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}
.swiper-button-next::after, .swiper-button-prev::after {
    font-size: 16px !important;
    font-weight: 800;
}

/* ============================================================
   Product Cards
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px 24px;
}

@media(max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

.product-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    transition: box-shadow var(--transition);
}

.product-card:hover {
    box-shadow: var(--shadow);
}

.product-card .badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
    z-index: 2;
}

.badge-bestseller {
    background: var(--color-badge-bestseller);
}

.badge-new {
    background: var(--color-badge-new);
}

.badge-sale {
    background: var(--color-badge-sale);
}

.product-image {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    padding: 24px;
}

.product-image img {
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.product-brand {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-wrapper {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.price-current {
    font-size: 16px;
    font-weight: 700;
}

.price-original {
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.stock-text {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-text::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.stock-text.in-stock::before,
.stock-text.in-stock {
    color: var(--color-success);
}

.stock-text.low-stock::before,
.stock-text.low-stock {
    color: var(--color-badge-new);
}

.stock-text.out-stock::before,
.stock-text.out-stock {
    color: var(--color-badge-sale);
}


/* ============================================================
   Cart Drawer
   ============================================================ */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    background: #fff;
    z-index: 1000;
    box-shadow: var(--shadow-drawer);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.cart-drawer.active {
    right: 0;
}

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.close-cart {
    background: none;
    border: none;
    font-size: 24px;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-alt);
}

.cart-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    padding: 8px;
}

.cart-item-img img {
    height: 100%;
    object-fit: contain;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-item-price {
    font-weight: 700;
    margin-bottom: 8px;
}

.qty-selector {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
}

.qty-selector button {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
}

.qty-selector input {
    width: 40px;
    height: 30px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.remove-item {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: underline;
    margin-left: 12px;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--color-border);
    padding: 64px 0 32px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 64px;
}

.footer-brand .logo {
    margin-bottom: 16px;
    font-size: 24px;
}

.footer-brand p {
    font-size: 14px;
    color: var(--color-text-secondary);
    max-width: 320px;
}

.footer-col h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 24px;
    color: var(--color-text);
}

.footer-col a {
    display: block;
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.footer-col a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--color-border);
    padding-top: 24px;
}

.copyright {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Forms */
.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 15px;
}

/* Responsive */
@media(max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .hero-matrix {
        grid-template-columns: 1fr;
    }
}

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

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}