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

/* CSS VARIABLES */
:root {
    --bg: #f9fcff;
    --card: #ffffff;
    --accent: #4f46e5;
    --accent-2: #6366f1;
    --text: #111827;
    --muted: #6b7280;
    --success: #22c55e;
    --danger: #ef4444;
    --border: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.1);
    --radius: 20px;
    --maxw: 1280px;
    --font-main: 'Inter', system-ui, sans-serif;
}

/* RESET & DEFAULTS */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: 500;
    line-height: 1.5;
}

h1,
h2,
h3 {
    font-weight: 800;
}

p {
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

/* LAYOUT */
.container {
    width: 92%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 10px;
}

main {
    flex: 1;
    padding: 3rem 0;
}

/* HOME PAGE BACKGROUND */
#home-page {
    background: linear-gradient(135deg, var(--bg), rgba(99, 102, 241, 0.1)), url('https://via.placeholder.com/1920x1080?text=Souq+Shop+Background') no-repeat center center/cover;
}

/* PAGE TRANSITIONS */
.page {
    display: none;
    animation: fadeIn 0.6s ease-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HEADER & NAVIGATION */
header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
    z-index: 1000;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
    font-size: 1.4rem;
    box-shadow: var(--shadow-sm);
}

#nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#nav-links a,
#nav-links span {
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    font-weight: 700;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

#nav-links a:hover,
#nav-links span:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    transform: translateY(-2px);
}

.cart-count {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    padding: 3px 7px;
    margin-left: 6px;
    vertical-align: top;
}

#logout {
    cursor: pointer;
}

/* BUTTONS */
.btn {
    border: none;
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
}

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

.btn-ghost:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* FORMS */
.form-container {
    max-width: 520px;
    margin: 3rem auto;
    background: var(--card);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 700;
}

input,
select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.error {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 700;
    display: none;
}

/* HERO SECTION */
.hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 20px;
}

.hero-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hero-card h2 {
    margin-bottom: 0.75rem;
    font-size: 2.25rem;
}

.hero-card p {
    color: var(--muted);
    font-size: 1.1rem;
}

.hero-card .button-group {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

#mini-feature {
    margin-top: 1.5rem;
    color: var(--muted);
    background: rgba(99, 102, 241, 0.05);
    padding: 1rem;
    border-radius: 12px;
}

/* PROMO BANNER */
.promo-banner {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 3rem 0;
    box-shadow: var(--shadow-lg);
    margin: 20px;
}

.promo-banner h3 {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
}

.promo-banner p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.promo-banner .btn {
    background: var(--card);
    color: var(--text);
}

.promo-banner .btn:hover {
    background: var(--bg);
}

/* FEATURED CATEGORIES */
.featured-categories {
    margin: 3rem 0;
    text-align: center;
    padding: 20px;
}

.featured-categories h3 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.category-card h4 {
    font-size: 1.2rem;
    font-weight: 700;
}

/* TESTIMONIALS */
.testimonials {
    margin: 3rem 0;
    text-align: center;
}

.testimonials h3 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.testimonial-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0px 20px 20px;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.testimonial-card p {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.testimonial-author {
    font-weight: 700;
    color: var(--accent);
}

/* CATEGORIES & FILTERS */
.categories-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.categories-header h2 {
    font-size: 2.5rem;
}

.categories-header p {
    color: var(--muted);
    font-size: 1.2rem;
}

.filters {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 2rem;
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1 1 160px;
}

.price-inputs {
    display: flex;
    gap: 0.75rem;
}

.price-inputs input {
    width: 100%;
}

/* SLIDER */
.slider {
    margin: 2.5rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    position: relative;
}

.slide-inner {
    display: flex;
    gap: 2rem;
    align-items: center;
    animation: slideFade 0.6s ease-out;
}

@keyframes slideFade {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-inner img {
    width: 240px;
    height: 160px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.slide-meta p {
    font-size: 1rem;
    margin-top: 0.75rem;
    color: var(--muted);
}

/* PRODUCT GRID */
.products-section h3 {
    margin: 2.5rem 0 1.25rem;
    font-size: 1.8rem;
}

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

.product-card {
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 14px;
}

.product-card h3 {
    font-size: 1.2rem;
    flex: 1;
}

.price {
    color: var(--accent);
    font-weight: 800;
    font-size: 1.3rem;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
}

.small-btn {
    border: none;
    padding: 0.7rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.3s ease, transform 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.see-more {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
}

.see-more:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.add-to-cart {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
}

.add-to-cart:hover {
    transform: translateY(-2px);
}

/* PRODUCT DETAILS */
.product-details {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
    align-items: start;
    max-width: 1100px;
    margin: 3rem auto;
}

.gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s ease;
}

.gallery img:hover {
    transform: scale(1.05);
}

.details h2 {
    font-size: 2.75rem;
    margin-bottom: 0.75rem;
}

.details .meta {
    color: var(--muted);
    margin-bottom: 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.details p {
    font-size: 1.15rem;
    margin-bottom: 2rem;
}

.details .price {
    font-size: 2.25rem;
}

.details .button-group {
    display: flex;
    gap: 1.25rem;
    margin-top: 2rem;
}

/* CART PAGE */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

#cart-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

#cart-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.cart-item:hover {
    transform: translateY(-5px);
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.cart-item-info img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 14px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.qbtn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1.4rem;
    background: var(--bg);
    transition: background 0.3s ease, transform 0.3s ease;
}

.qbtn:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

.cart-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 2.5rem;
}

/* GENERIC BOXES (Order, Contact) */
.order-box,
.contact-box {
    max-width: 780px;
    margin: 3rem auto;
    background: var(--card);
    padding: 2.5rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.order-box h2,
.contact-box h2 {
    margin-bottom: 0.75rem;
    font-size: 2.25rem;
}

.order-box p,
.contact-box p {
    color: var(--muted);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

.order-box .button-group {
    margin-top: 2rem;
}

/* UI FEEDBACK & HELPERS */
#toast {
    position: fixed;
    right: 30px;
    bottom: 30px;
    min-width: 280px;
    padding: 1.25rem 1.75rem;
    border-radius: 14px;
    color: white;
    z-index: 2000;
    transform: translateY(30px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
    box-shadow: var(--shadow-md);
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#scroll-to-top {
    position: fixed;
    right: 30px;
    bottom: 100px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
    box-shadow: var(--shadow-md);
}

#scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

#scroll-to-top:hover {
    transform: translateY(-3px);
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 8px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* FOOTER */
footer {
    padding: 2.5rem 0;
    text-align: center;
    color: var(--muted);
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

/* RESPONSIVE DESIGN */
@media (max-width: 1000px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

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

    .product-details {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 600px) {
    body {
        font-size: 0.95rem;
    }

    header .container {
        flex-direction: column;
        gap: 1.25rem;
    }

    #nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-item {
        flex-basis: auto;
    }

    .slide-inner {
        flex-direction: column;
        text-align: center;
    }

    .cart-item {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-item-info {
        justify-content: center;
    }

    .testimonial-grid {
        grid-template-columns: 1fr;
    }
}