/* =================================================================
   E-COMMERCE SHOP - Minimalistic-Tech-Toon Theme
   Violet (#8A2BE2) on White with Dark Mode Support
   Mobile-First Responsive Design
   ================================================================= */

/* =================================================================
   CSS VARIABLES
   ================================================================= */
:root {
    /* Primary Colors */
    --color-primary: #8A2BE2;
    --color-primary-light: #9F4BEE;
    --color-primary-dark: #7B1FA2;
    --color-primary-rgb: 138, 43, 226;

    /* Background & Surface */
    --color-bg: #FFFFFF;
    --color-bg-secondary: #F8F9FA;
    --color-surface: #FFFFFF;
    --color-surface-elevated: #FFFFFF;

    /* Text */
    --color-text: #1A1A2E;
    --color-text-secondary: #6B7280;
    --color-text-muted: #9CA3AF;
    --color-text-inverse: #FFFFFF;

    /* Borders */
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;

    /* Status Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 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.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius - Slight rounded (Tech-Toon) */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-ar: 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;

    /* Layout */
    --container-max: 1280px;
    --header-height: 64px;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: #0F0F1A;
    --color-bg-secondary: #1A1A2E;
    --color-surface: #16162A;
    --color-surface-elevated: #1E1E38;
    --color-text: #F3F4F6;
    --color-text-secondary: #9CA3AF;
    --color-text-muted: #6B7280;
    --color-border: #2D2D4A;
    --color-border-light: #252540;
    --shadow-sm: 0 1px 2px 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);
}

/* Auto Theme Detection */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --color-bg: #0F0F1A;
        --color-bg-secondary: #1A1A2E;
        --color-surface: #16162A;
        --color-surface-elevated: #1E1E38;
        --color-text: #F3F4F6;
        --color-text-secondary: #9CA3AF;
        --color-text-muted: #6B7280;
        --color-border: #2D2D4A;
        --color-border-light: #252540;
        --shadow-sm: 0 1px 2px 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);
    }
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

[lang="ar"] body, [dir="rtl"] body {
    font-family: var(--font-family-ar);
}

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

a:hover { color: var(--color-primary-dark); }

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: var(--font-size-base);
}

/* =================================================================
   UTILITIES
   ================================================================= */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-center { text-align: center; }

.hide-mobile { display: inline; }

@media (max-width: 768px) {
    .hide-mobile { display: none; }
}

/* =================================================================
   BUTTONS
   ================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
}

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

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    color: var(--color-text-inverse);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: var(--color-border-light);
    border-color: var(--color-primary);
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-text);
}

.btn-ghost:hover {
    background-color: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =================================================================
   FORM ELEMENTS
   ================================================================= */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-input.error,
.form-select.error {
    border-color: var(--color-error);
}

.form-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
}

/* =================================================================
   HEADER
   ================================================================= */
.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--space-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text);
    flex-shrink: 0;
}

.logo img {
    height: 36px;
    width: auto;
}

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

/* Search */
.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-form {
    display: flex;
    align-items: center;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-full);
    padding: var(--space-xs) var(--space-md);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.search-form:focus-within {
    border-color: var(--color-primary);
    background-color: var(--color-surface);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-xs);
    color: var(--color-text);
}

.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--color-text-muted); }

.search-btn {
    color: var(--color-text-secondary);
    padding: var(--space-xs);
    display: flex;
    align-items: center;
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-xs);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: var(--z-dropdown);
}

.search-results.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    transition: background-color var(--transition-fast);
}

.search-result-item:hover {
    background-color: var(--color-bg-secondary);
}

.search-result-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.search-result-info { flex: 1; min-width: 0; }

.search-result-name {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-price {
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Language Switcher */
.lang-switcher {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-primary);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    display: none;
    z-index: var(--z-dropdown);
}

[dir="rtl"] .lang-dropdown { right: auto; left: 0; }
.lang-dropdown.active { display: block; }

.lang-option {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    cursor: pointer;
}

[dir="rtl"] .lang-option { text-align: right; }
.lang-option:hover { background-color: var(--color-bg-secondary); }
.lang-option.active { color: var(--color-primary); font-weight: 600; }

/* Cart Button */
.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.cart-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-primary);
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(25%, -25%);
}

.cart-count:empty,
.cart-count[data-count="0"] { display: none; }

/* Search Toggle Mobile */
.search-toggle-mobile {
    display: none;
    padding: var(--space-sm);
    color: var(--color-text);
}

/* Dropdown */
/* --- TechGare Dialog Styles --- */
:root {
    --color-primary: #8A2BE2;
    --color-text: #1A1A2E;
    --color-text-secondary: #6B7280;
    --color-surface: #FFFFFF;
    --color-bg-secondary: #F8F9FA;
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;
    --color-error: #EF4444;
    --radius-sm: 6px;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-2xl: 3rem;
}

/* Details/Summary Reset */
.category-item-link {
    cursor: pointer;
    list-style: none;
}
.category-item-link::-webkit-details-marker {
    display: none;
}

/* Ensure mobile header remains compact */
@media (max-width: 768px) {
    .header-inner { height: 56px; }
    .nav-dropdown-btn span { display: none; } /* Show only icon on small mobile */
}
.category-dialog {
    border: 2px solid var(--color-primary); /* Tech-Toon border style */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0;
    width: 90%;
    max-width: 450px;
    max-height: 85vh;
    background: var(--color-surface);
    color: var(--color-text);
    overflow: hidden;
    /* Center the dialog effectively */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.category-dialog::backdrop {
    background: rgba(138, 43, 226, 0.2); /* Tinted backdrop to match brand */
    backdrop-filter: blur(8px);
}

.dialog-header {
    background-color: var(--color-bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.dialog-header h3 {
    color: var(--color-primary);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.close-dialog {
    font-size: 2rem;
    color: var(--color-text-secondary);
    line-height: 1;
    transition: color var(--transition-fast);
}

.close-dialog:hover {
    color: var(--color-error);
}

.dialog-body {
    padding: var(--space-sm) 0;
}

/* List Items matching your current menu-link style */
.dialog-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    color: var(--color-text);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
    list-style: none; /* Removes default arrow */
}

/* Custom indicator for categories with children */
.dialog-menu-link::-webkit-details-marker {
    display: none;
}

.dialog-menu-link:hover {
    background-color: rgba(var(--color-primary-rgb), 0.05);
    color: var(--color-primary);
}

.dialog-submenu {
    background-color: var(--color-bg-secondary);
    list-style: none;
    padding: var(--space-xs) 0;
}

.dialog-submenu-link {
    display: block;
    padding: var(--space-sm) var(--space-2xl);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.dialog-submenu-link:hover {
    color: var(--color-primary);
    padding-left: calc(var(--space-2xl) + 5px); /* Subtle slide effect */
}

/* Handle RTL specifically for the close button and arrows */
[dir="rtl"] .dialog-submenu-link:hover {
    padding-left: 0;
    padding-right: calc(var(--space-2xl) + 5px);
}

/* =================================================================
   MAIN CONTENT
   ================================================================= */
.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* =================================================================
   HERO SECTION
   ================================================================= */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    margin-bottom: var(--space-xl);
    color: var(--color-text-inverse);
    text-align: center;
}

.hero h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.hero p {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    margin-bottom: var(--space-lg);
}

/* =================================================================
   SPECIAL DEALS CAROUSEL
   ================================================================= */
.deals-section {
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.deals-carousel {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: var(--space-xs) 0;
}

.deals-carousel::-webkit-scrollbar { display: none; }

.deal-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.deal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.deal-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.deal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.deal-card:hover .deal-image img {
    transform: scale(1.05);
}

.deal-badge {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

[dir="rtl"] .deal-badge { left: auto; right: var(--space-sm); }

.deal-info {
    padding: var(--space-md);
}

.deal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--color-text);
}

.deal-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.deal-price {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.deal-current-price {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
}

.deal-old-price {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: line-through;
}

/* =================================================================
   PRODUCT GRID
   ================================================================= */
.products-section {
    margin-bottom: var(--space-2xl);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-lg);
}

.product-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: var(--color-bg-secondary);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-base);
}

.product-image .hover-image {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.product-card:hover .product-image .hover-image {
    opacity: 1;
}

.product-card:hover .product-image .main-image {
    opacity: 0;
}

.product-badge {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--color-error);
    color: var(--color-text-inverse);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

[dir="rtl"] .product-badge { left: auto; right: var(--space-sm); }

.product-info {
    padding: var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

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

.product-name:hover {
    color: var(--color-primary);
}

.product-price {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: auto;
    margin-bottom: var(--space-sm);
}

.product-current-price {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary);
}

.product-old-price {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.product-stock {
    font-size: var(--font-size-xs);
    color: var(--color-success);
}

.product-stock.out-of-stock {
    color: var(--color-error);
}

.add-to-cart-btn {
    width: 100%;
    margin-top: var(--space-sm);
}

/* =================================================================
   SHOW MORE BUTTON
   ================================================================= */
.show-more-container {
    text-align: center;
    margin-top: var(--space-xl);
}

.show-more-btn {
    min-width: 200px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* =================================================================
   PRODUCT DETAIL PAGE
   ================================================================= */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
}

.product-gallery {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
}

.gallery-main {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--color-bg-secondary);
    margin-bottom: var(--space-md);
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumbs {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
}

.gallery-thumb {
    flex: 0 0 80px;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.gallery-thumb.active,
.gallery-thumb:hover {
    border-color: var(--color-primary);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-info {
    padding: var(--space-lg) 0;
}

.product-detail-category {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.product-detail-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.product-detail-price {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.product-detail-current-price {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-primary);
}

.product-detail-old-price {
    font-size: var(--font-size-xl);
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.product-detail-discount {
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--color-error);
    color: var(--color-text-inverse);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.product-detail-description {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.8;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.quantity-label {
    font-weight: 500;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.quantity-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-primary);
}

.quantity-input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-weight: 600;
}

.quantity-input:focus { outline: none; }

.add-to-cart-large {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
}

/* =================================================================
   CART PAGE
   ================================================================= */
.cart-page {
    max-width: 900px;
    margin: 0 auto;
}

.cart-empty {
    text-align: center;
    padding: var(--space-2xl);
}

.cart-empty svg {
    width: 80px;
    height: 80px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

.cart-empty h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-md);
}

.cart-empty p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.cart-items {
    margin-bottom: var(--space-xl);
}

.cart-item {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}

.cart-item-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.cart-item-name:hover {
    color: var(--color-primary);
}

.cart-item-price {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: auto;
}

.cart-item-remove {
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.cart-item-remove:hover {
    color: var(--color-error);
}

.cart-summary {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
}

.cart-summary-row.total {
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.cart-summary-row.total .value {
    color: var(--color-primary);
}

.cart-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.cart-actions .btn {
    flex: 1;
}

/* =================================================================
   CHECKOUT PAGE
   ================================================================= */
.checkout-page {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--space-2xl);
}

.checkout-form {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.checkout-section {
    margin-bottom: var(--space-xl);
}

.checkout-section:last-child {
    margin-bottom: 0;
}

.checkout-section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.delivery-type-toggle {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.delivery-type-btn {
    flex: 1;
    padding: var(--space-md);
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.delivery-type-btn:hover {
    border-color: var(--color-primary);
}

.delivery-type-btn.active {
    border-color: var(--color-primary);
    background-color: rgba(var(--color-primary-rgb), 0.1);
}

.delivery-type-btn input {
    display: none;
}

.delivery-fields {
    display: none;
}

.delivery-fields.active {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.checkout-summary {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
}

.order-summary {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.order-summary-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.order-items {
    margin-bottom: var(--space-md);
}

.order-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
}

.order-item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

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

.order-item-info {
    flex: 1;
}

.order-item-name {
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.order-item-qty {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.order-item-price {
    font-weight: 600;
    color: var(--color-primary);
}

/* =================================================================
   ORDER CONFIRMATION
   ================================================================= */
.confirmation-page {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.confirmation-icon {
    width: 80px;
    height: 80px;
    background-color: var(--color-success);
    color: var(--color-text-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.confirmation-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-md);
}

.confirmation-message {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.order-number {
    display: inline-block;
    padding: var(--space-md) var(--space-xl);
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-xl);
}

/* =================================================================
   FOOTER
   ================================================================= */
.footer {
    background-color: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: var(--space-2xl) 0 var(--space-lg);
    margin-top: auto;
}

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

.footer-section h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* =================================================================
   TOAST NOTIFICATIONS
   ================================================================= */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

[dir="rtl"] .toast-container {
    right: auto;
    left: var(--space-lg);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
    animation: slideIn 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

[dir="rtl"] .toast {
    border-left: none;
    border-right: 4px solid var(--color-primary);
}

.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-error); }

.toast-close {
    margin-left: auto;
    color: var(--color-text-muted);
    padding: var(--space-xs);
}

[dir="rtl"] .toast-close {
    margin-left: 0;
    margin-right: auto;
}

.toast-close:hover {
    color: var(--color-text);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

[dir="rtl"] @keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 1024px) {
    .product-detail {
        grid-template-columns: 1fr;
    }

    .product-gallery {
        position: static;
    }

    .checkout-page {
        grid-template-columns: 1fr;
    }

    .checkout-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .search-container {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-width: none;
        padding: var(--space-sm) var(--space-md);
        background-color: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        display: none;
    }

    .search-container.active {
        display: block;
    }

    .search-toggle-mobile {
        display: flex;
    }

    .nav-dropdown {
        display: none;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .hero {
        padding: var(--space-xl);
    }

    .hero h1 {
        font-size: var(--font-size-2xl);
    }

    .cart-item {
        flex-direction: column;
    }

    .cart-item-image {
        width: 100%;
        height: 200px;
    }

    .cart-actions {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

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

    .deal-card {
        flex: 0 0 260px;
    }

    .product-detail-title {
        font-size: var(--font-size-2xl);
    }

    .product-detail-current-price {
        font-size: var(--font-size-2xl);
    }
}
