:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 16px;
    --box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth page load animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: fadeIn 0.5s ease-out;
}

/* Smooth transitions for all interactive elements */
a, button, .product-card, .nav-link-btn, .icon-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Navbar */
.navbar {
    background: var(--surface-color);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
}

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

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 20px;
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link-btn:hover {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.user-name {
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

/* Banners Slider */
.banners-slider {
    position: relative;
    width: calc(100% - 4rem);
    margin: 1.5rem auto 2.5rem;
    overflow: hidden;
    border-radius: 20px;
    background: #000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.banners-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.banner-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.banner-image {
    width: 100%;
    height: 420px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}

.banner-slide:hover .banner-image {
    transform: scale(1.02);
}

.banner-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    padding: 2.5rem 3rem;
    color: white;
}

.banner-caption h2 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Slider dots */
.banner-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.banner-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* Prev / Next arrows */
.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.banner-arrow:hover {
    background: rgba(255,255,255,0.4);
}

.banner-arrow.prev { right: 1rem; }
.banner-arrow.next { left: 1rem; }

@media (max-width: 768px) {
    .banners-slider { width: calc(100% - 2rem); border-radius: 14px; }
    .banner-image { height: 220px; }
    .banner-caption { padding: 1.5rem; }
    .banner-caption h2 { font-size: 1.3rem; }
    .banner-arrow { width: 34px; height: 34px; }
}


/* Hero Section */
.hero {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    padding: 4rem 5%;
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Layout */
.container {
    padding: 0 5%;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    margin-bottom: 4rem;
}

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

/* Sidebar Filters */
.filters {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f3f5;
}

.category-list {
    list-style: none;
}

.category-link {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.category-link:hover, .category-link.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    transform: translateX(-5px);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.product-image {
    height: 200px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    position: relative;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image i {
    width: 60px;
    height: 60px;
}

.product-category-tag {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.product-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.4;
    height: 2.8rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto;
    margin-bottom: 0.75rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-to-cart-btn:hover {
    background: var(--primary-hover);
}

/* Form Styles */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: 'Tajawal', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.btn {
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Tajawal', sans-serif;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    grid-column: 1 / -1;
    border: 1px solid var(--border-color);
}

.empty-state i {
    width: 64px;
    height: 64px;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .brand {
        font-size: 1.4rem;
    }

    .nav-icons {
        gap: 0.75rem;
    }

    .nav-link-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .user-name {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }

    /* Location display on mobile */
    .navbar > div[style*="map-pin"] {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
        font-size: 0.75rem;
        text-align: center;
    }


    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .container {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .filters {
        position: static;
        margin-bottom: 1.5rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .product-card {
        border-radius: 10px;
    }

    .product-image {
        height: 160px;
    }

    .product-image i {
        width: 50px;
        height: 50px;
    }

    .product-details {
        padding: 1rem;
    }

    .product-title {
        font-size: 0.9rem;
        height: 2.5rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-category-tag {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        top: 0.5rem;
        right: 0.5rem;
    }

    .add-to-cart-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    /* Product detail page */
    .card[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 1.5rem !important;
    }

    .card[style*="min-height"] > div:first-child {
        min-height: 250px !important;
    }

    .card[style*="min-height"] > div:first-child img {
        max-height: 250px !important;
    }

    .card[style*="flex-direction"] h1 {
        font-size: 1.5rem !important;
    }

    .card[style*="flex-direction"] div[style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .product-image {
        height: 140px;
    }

    .product-title {
        font-size: 0.85rem;
    }

    .product-price {
        font-size: 1rem;
    }

    .btn {
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
    }

    .nav-icons {
        gap: 0.5rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
    }
}

/* Location Marquee */
.location-marquee-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 150px;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}
.location-marquee-text {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-rtl 10s linear infinite;
}
.location-marquee-text:hover {
    animation-play-state: paused;
}
@keyframes marquee-rtl {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
