/* ==========================================================================
   Global Shop Algeria - Main Stylesheet
   Theme: Modern Arabic Marketplace (Algeria 58 Wilayas)
   Compatibility: Modern Browsers, Responsive Desktop & Mobile, Dark/Light Mode
   ========================================================================== */

/* --- 1. CSS Variables & Design Tokens --- */
:root {
    /* Main Brand Colors */
    --primary-color: #1677ff;
    --primary-hover: #0b64df;
    --primary-light: #e7f1ff;
    --primary-dark: #0a58ca;
    
    --secondary-color: #2e8fe6;
    --secondary-hover: #1976c9;
    --secondary-light: #d9ebff;
    
    --accent-color: #4ba8ff;
    --accent-hover: #78bdff;
    --accent-dark: #1677ff;
    
    --danger-color: #dc3545;
    --danger-hover: #bb2d3b;
    --danger-light: #f8d7da;

    --whatsapp-color: #25d366;
    --whatsapp-hover: #1da851;
    
    /* Layout & Surface Colors */
    --bg-main: #f4f6f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-topbar: #0f172a;
    --bg-footer: #0f172a;
    --bg-modal: #ffffff;
    
    /* Border & Input Colors */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --input-bg: #ffffff;
    
    /* Typography Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-topbar: #cbd5e1;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    
    /* Radius & Spacing Standards */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-main: #070b11;
    --bg-surface: #0e1520;
    --bg-card: #0e1520;
    --bg-header: #0b111a;
    --bg-topbar: #03060b;
    --bg-footer: #03060b;
    --bg-modal: #0e1520;
    
    --border-color: #253247;
    --border-hover: #3a4c66;
    --input-bg: #080d14;
    
    --text-primary: #f4f7fb;
    --text-secondary: #b7c4d6;
    --text-muted: #8191a7;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* --- 2. CSS Reset & Typography --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* --- 3. Layout Grid & Utilities --- */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}
.hidden {
    display: none !important;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger-color) !important; }
.text-success { color: var(--secondary-color) !important; }

/* Buttons System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-accent {
    background-color: var(--accent-color);
    color: #06111f;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(75, 168, 255, 0.3);
}

@media (max-width: 760px) {
    .container {
        padding-right: 16px;
        padding-left: 16px;
    }

    .header-actions .btn-outline {
        display: none;
    }

    .menu-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .layout-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar-filter {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-details-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .product-gallery {
        min-width: 0;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-body {
        padding: 16px;
    }
}

@media (max-width: 520px) {
    .top-bar-container,
    .contact-info {
        gap: 8px;
    }

    .contact-info span {
        display: none;
    }

    #wilaya-badge {
        display: none;
    }

    .top-links {
        width: 100%;
        justify-content: space-between;
    }

    .header-actions .btn-accent {
        max-width: 190px;
        padding: 8px 10px;
        white-space: normal;
        line-height: 1.25;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .search-box-header form {
        flex-wrap: wrap;
    }

    .search-input-wrapper {
        flex-basis: 100%;
        min-height: 42px;
    }

    #header-wilaya-select,
    .search-box-header form .btn {
        flex: 1;
        max-width: none;
        min-height: 40px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .categories-grid {
        gap: 10px;
    }

    .products-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .sort-options {
        width: 100%;
        justify-content: space-between;
    }

    .footer-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .main-image-container {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

html[dir="ltr"] .mobile-navigation {
    right: auto;
    left: -300px;
}

html[dir="ltr"] .mobile-navigation.active {
    left: 0;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-success {
    background-color: var(--secondary-color);
    color: #ffffff;
}
.btn-success:hover {
    background-color: var(--secondary-hover);
}

.btn-whatsapp {
    background-color: var(--whatsapp-color);
    color: #ffffff;
}
.btn-whatsapp:hover {
    background-color: var(--whatsapp-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: var(--bg-main);
    border-color: var(--border-hover);
}

.btn-secondary {
    background-color: var(--text-muted);
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    padding: 0;
}
.btn-text:hover {
    text-decoration: underline;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-topbar);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}
.icon-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Forms Framework */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .col {
    flex: 1;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* --- 4. Main Header & Navigation --- */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-header);
    box-shadow: var(--shadow-sm);
}

.top-bar {
    background-color: var(--bg-topbar);
    color: var(--text-topbar);
    font-size: 0.825rem;
    padding: 6px 0;
}

.top-bar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-info {
    display: flex;
    gap: 20px;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.contact-info a {
    color: inherit;
}

.language-select {
    max-width: 112px;
    padding: 4px 8px;
    color: var(--text-topbar);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
}

.nav-bar {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.brand-title span {
    color: var(--primary-color);
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Header Search Engine */
.search-box-header {
    flex: 1;
    max-width: 600px;
}

.search-box-header form {
    display: flex;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.search-icon {
    color: var(--text-muted);
    margin-left: 8px;
}

.search-input-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
}

#header-wilaya-select {
    border: none;
    background: transparent;
    border-right: 1px solid var(--border-color);
    padding: 0 10px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    max-width: 150px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* Mobile Navigation Side Drawer */
.mobile-navigation {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-surface);
    z-index: 2000;
    box-shadow: var(--shadow-xl);
    transition: right 0.3s ease;
    padding: 20px;
}

.mobile-navigation.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
}

.mobile-nav-list li {
    margin-bottom: 15px;
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.mobile-nav-list a.active, .mobile-nav-list a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* --- 5. Hero Banner Section --- */
.hero-section {
    background: linear-gradient(135deg, #03060b 0%, #0d1b2b 58%, #102f55 100%);
    color: #ffffff;
    padding: 50px 0;
    position: relative;
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center;
}

.welcome-panel {
    min-height: 210px;
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    text-align: center;
    background: linear-gradient(145deg, #07111e, #123c6b);
    border: 1px solid rgba(75, 168, 255, 0.35);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.welcome-panel > i {
    color: var(--accent-color);
    font-size: 2rem;
}

.welcome-panel h2 {
    font-size: 1.35rem;
}

.welcome-panel p {
    color: #b7c4d6;
}

.marketplace-hero-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(75, 168, 255, 0.2);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.hero-content h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 15px;
}

.hero-content p {
    color: #94a3b8;
    font-size: 1.05rem;
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    gap: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Quick Filter Card inside Hero */
.quick-filter-card {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.quick-filter-card h3 {
    font-size: 1.1rem;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}

/* --- 6. Categories Showcase Section --- */
.categories-section {
    padding: 50px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 35px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.category-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.cat-icon {
    width: 50px;
    height: 50px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 12px;
}

.category-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.category-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- 7. Main Grid & Product Listing Area --- */
.main-content {
    padding-bottom: 60px;
}

.layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* Sidebar Filtering Controls */
.filter-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.filter-title h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.promo-banner-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.promo-banner-card i {
    font-size: 2.2rem;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.promo-banner-card h4 {
    margin-bottom: 8px;
}

.promo-banner-card p {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Toolbar & Grid Results */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.results-count {
    font-weight: 600;
    color: var(--text-secondary);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.empty-state {
    min-height: 280px;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--text-secondary);
    background-color: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.empty-state > i {
    color: var(--primary-color);
    font-size: 2rem;
}

.empty-state h3 {
    color: var(--text-primary);
}

/* Product Card Component */
.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.product-image-wrap {
    position: relative;
    width: 100%;
    height: 180px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.product-card:hover .product-image-wrap img {
    transform: scale(1.05);
}

.card-badge-wilaya {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

.product-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pill-info {
    font-size: 0.72rem;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.product-card-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- 8. Price Estimator & Complaints Sections --- */
.price-estimator-section, .complaints-section {
    padding: 50px 0;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
}

.estimator-card, .complaints-card {
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 35px;
    box-shadow: var(--shadow-sm);
}

.estimator-header, .complaints-header {
    text-align: center;
    margin-bottom: 25px;
}

.estimator-header h2, .complaints-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.btn-align {
    display: flex;
    align-items: flex-end;
}

.estimator-result {
    margin-top: 25px;
    background-color: var(--primary-light);
    border: 1px dashed var(--primary-color);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

.price-range-badge {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
}

/* --- 9. Modal Windows Framework --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-container {
    background-color: var(--bg-modal);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.3s ease;
}

.modal-container.modal-lg {
    max-width: 950px;
}

.auth-modal-container {
    max-width: 460px;
}

.form-status {
    min-height: 1.5em;
    margin-top: 12px;
    color: var(--text-secondary);
}

.form-status[data-state="error"] {
    color: var(--danger-color);
}

.form-status[data-state="success"] {
    color: var(--secondary-color);
}

.auth-resend-btn {
    display: block;
    margin: 14px auto 0;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Product Details Layout inside Modal */
.product-details-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.main-image-container {
    width: 100%;
    height: 320px;
    background-color: #e2e8f0;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
}

.main-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.product-thumbnail {
    width: 65px;
    height: 65px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-main);
    padding: 0;
    transition: var(--transition-fast);
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-thumbnail:hover,
.product-thumbnail:focus-visible {
    border-color: var(--primary-color);
}

.thumb-img {
    width: 65px;
    height: 65px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
}

.thumb-img.active, .thumb-img:hover {
    border-color: var(--primary-color);
}

.detail-price-badge {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag-badge {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 600;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.description-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    white-space: pre-line;
    margin-bottom: 20px;
}

.seller-contact-card {
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 15px;
}

.seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.seller-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.contact-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- 10. Footer Section --- */
.main-footer {
    background-color: var(--bg-footer);
    color: #94a3b8;
    padding-top: 60px;
    font-size: 0.9rem;
}

.footer-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1.05rem;
    margin-bottom: 20px;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: #94a3b8;
}

.footer-col a:hover {
    color: #ffffff;
}

.wilaya-links-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 0.8rem;
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.social-links a {
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.cloudflare-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: rgb(109, 5, 5);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.image-preview-grid:empty {
    display: none;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

@media (max-width: 1100px) {
    .nav-container {
        flex-wrap: wrap;
    }

    .search-box-header {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .layout-grid {
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 20px;
    }

    .footer-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .container {
        padding-right: 16px;
        padding-left: 16px;
    }

    .header-actions .btn-outline {
        display: none;
    }

    .menu-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .layout-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-details-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-body {
        padding: 16px;
    }
}

@media (max-width: 520px) {
    .top-bar-container {
        gap: 8px;
    }

    .contact-info span,
    #wilaya-badge {
        display: none;
    }

    .top-links {
        width: 100%;
        justify-content: space-between;
    }

    .header-actions .btn-accent {
        max-width: 190px;
        padding: 8px 10px;
        white-space: normal;
        line-height: 1.25;
    }

    .brand-title {
        font-size: 1.15rem;
    }

    .search-box-header form {
        flex-wrap: wrap;
    }

    .search-input-wrapper {
        flex-basis: 100%;
        min-height: 42px;
    }

    #header-wilaya-select,
    .search-box-header form .btn {
        flex: 1;
        max-width: none;
        min-height: 40px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .products-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .sort-options {
        width: 100%;
        justify-content: space-between;
    }

    .footer-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .main-image-container {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

html[dir="ltr"] .mobile-navigation {
    right: auto;
    left: -300px;
}

html[dir="ltr"] .mobile-navigation.active {
    left: 0;
}