/* ================================================
   MODERN STORE - DESIGN SYSTEM & BASE STYLES
   ================================================ */

:root {
    /* Primary Colors - Brighter Blue Theme */
    --primary: #4FA3FF;
    --primary-light: #7CBFFF;
    --primary-dark: #2563eb;

    /* Secondary Colors */
    --secondary: #7CBFFF;
    --secondary-light: #E9F4FF;
    --secondary-dark: #2563eb;

    /* Accent Colors - Bright Gold */
    --accent: #F4B400;
    --accent-light: #FFC83D;
    --accent-dark: #E0A800;

    /* Status Colors */
    --success: #28a745;
    --success-light: #34d399;
    --danger: #dc3545;
    --danger-light: #f87171;
    --warning: #F59E0B;
    --info: #4FA3FF;

    /* Category Colors */
    --cat-food: #28a745;
    --cat-consumer: #4FA3FF;
    --cat-clothes: #F4B400;
    --cat-watches: #FFC83D;
    --cat-appliances: #2563eb;
    --cat-mobiles: #7CBFFF;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f0f7ff;
    --bg-tertiary: #E9F4FF;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.9);

    /* Text Colors */
    --text-primary: #1e3a5f;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-light: #ffffff;

    /* Border & Shadow */
    --border-color: #E9F4FF;
    --border-light: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 2px 4px rgba(79, 163, 255, 0.1);
    --shadow-md: 0 4px 12px rgba(79, 163, 255, 0.15);
    --shadow-lg: 0 8px 24px rgba(79, 163, 255, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(79, 163, 255, 0.15);
    --shadow-glow: 0 4px 20px rgba(244, 180, 0, 0.4);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4FA3FF 0%, #2563eb 100%);
    --gradient-hero: linear-gradient(135deg, #4FA3FF 0%, #7CBFFF 50%, #F4B400 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #f0f7ff 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Typography */
    --font-primary: 'Cairo', 'Tajawal', sans-serif;
    --font-display: 'Cairo', sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Container */
    --container-max: 1400px;
    --container-padding: 1.5rem;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal: 400;
    --z-tooltip: 500;
}

/* Dark Mode - Navy with Gold (Improved Contrast) */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;

    --secondary: #60a5fa;
    --secondary-light: #93c5fd;
    --secondary-dark: #3b82f6;

    --accent: #e8c882;
    --accent-light: #f0d9a0;
    --accent-dark: #d4a855;

    --bg-primary: #1a2744;
    --bg-secondary: #243654;
    --bg-tertiary: #2d4263;
    --bg-card: #243654;
    --bg-glass: rgba(36, 54, 84, 0.95);

    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --text-muted: #a8c0e0;

    --border-color: #3d5a80;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 4px 20px rgba(232, 200, 130, 0.3);

    --gradient-primary: linear-gradient(135deg, #1a2744 0%, #2d4263 100%);
    --gradient-hero: linear-gradient(135deg, #1a2744 0%, #2d4263 40%, #d4a855 100%);
    --gradient-card: linear-gradient(145deg, #243654 0%, #1a2744 100%);
}

/* ================================================
   RESET & BASE STYLES
   ================================================ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    direction: rtl;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-normal);
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    transition: var(--transition-normal);
}

input,
textarea,
select {
    font-family: inherit;
    border: none;
    outline: none;
    background: transparent;
}

::selection {
    background-color: var(--primary);
    color: var(--text-light);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ================================================
   UTILITIES
   ================================================ */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    padding: var(--space-4xl) 0;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-3xl);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--gradient-primary);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-glow);
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: var(--space-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Dark mode: use solid color for section titles */
[data-theme="dark"] .section-title {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #ffffff;
    background-clip: unset;
    color: #ffffff;
}

.section-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ================================================
   BUTTONS
   ================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-light);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border-color: var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--text-light);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-light);
}

.btn-success {
    background: var(--success);
    color: var(--text-light);
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

/* ================================================
   CARDS
   ================================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
}

/* ================================================
   BADGES
   ================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sale {
    background: var(--danger);
    color: var(--text-light);
}

.badge-new {
    background: var(--success);
    color: var(--text-light);
}

.badge-featured {
    background: var(--accent);
    color: var(--text-light);
}

.badge-category {
    background: var(--primary);
    color: var(--text-light);
}

/* Discount Badge */
.discount-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--danger);
    color: var(--text-light);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ================================================
   FORM ELEMENTS
   ================================================ */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Search Input */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper .form-input {
    padding-right: calc(var(--space-lg) * 2 + 20px);
}

/* ================================================
   RATINGS
   ================================================ */

.rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.rating i {
    color: var(--accent);
    font-size: 0.875rem;
}

.rating i.empty {
    color: var(--text-muted);
}

.rating-count {
    margin-right: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ================================================
   PRICE
   ================================================ */

.price {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.price-current {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.price-old {
    font-size: 1rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.price-discount {
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 600;
}

/* ================================================
   QUANTITY SELECTOR
   ================================================ */

.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.2rem;
}

.quantity-btn:hover {
    background: var(--primary);
    color: var(--text-light);
}

.quantity-input {
    width: 60px;
    height: 40px;
    text-align: center;
    font-weight: 600;
    border-left: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
}

/* ================================================
   LOADING STATES
   ================================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ================================================
   TOOLTIPS
   ================================================ */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: var(--space-sm) var(--space-md);
    background: #3b82f6;
    color: #ffffff;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Dark mode tooltip - ensure visibility */
[data-theme="dark"] [data-tooltip]::after {
    background: #1e3a5f;
    color: #ffffff;
    border: 1px solid #3d5a80;
}

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-slideInRight {
    animation: slideInRight 0.6s ease forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s ease forwards;
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Animation Delays */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

/* ================================================
   RESPONSIVE UTILITIES
   ================================================ */

@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
    }

    .section {
        padding: var(--space-3xl) 0;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ================================================
   BACK TO TOP BUTTON
   ================================================ */

.back-to-top {
    position: fixed;
    bottom: var(--space-xl);
    left: var(--space-xl);
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: var(--text-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-fixed);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition-normal);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

/* ================================================
   PAGE ENTRANCE ANIMATION
   ================================================ */

/* Smooth entrance animation when page loads */
body {
    animation: smoothEntrance 0.5s ease-out;
}

@keyframes smoothEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sections stagger animation */
section {
    animation: sectionFadeIn 0.6s ease-out backwards;
}

section:nth-of-type(1) {
    animation-delay: 0.1s;
}

section:nth-of-type(2) {
    animation-delay: 0.2s;
}

section:nth-of-type(3) {
    animation-delay: 0.3s;
}

section:nth-of-type(4) {
    animation-delay: 0.4s;
}

section:nth-of-type(5) {
    animation-delay: 0.5s;
}

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   FLOATING BACKGROUND ICONS
   ================================================ */

.floating-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.12;
    color: var(--primary);
    animation: floatIcon linear infinite;
}

/* Different sizes */
.floating-icon.small {
    font-size: 1rem;
    opacity: 0.08;
}

.floating-icon.medium {
    font-size: 1.5rem;
    opacity: 0.12;
}

.floating-icon.large {
    font-size: 2.5rem;
    opacity: 0.15;
}

/* Float animation */
@keyframes floatIcon {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.12;
    }

    90% {
        opacity: 0.12;
    }

    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Dark mode adjustment */
[data-theme="dark"] .floating-icon {
    color: var(--accent);
    opacity: 0.15;
}

[data-theme="dark"] .floating-icon.large {
    opacity: 0.2;
}

/* ================================================
   PRELOADER - Animated Shopping Cart
   ================================================ */

.preloader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* SVG Cart Animation */
.preloader-svg {
    width: 150px;
    height: 150px;
    margin-bottom: 30px;
}

.preloader-svg path,
.preloader-svg circle,
.preloader-svg line,
.preloader-svg polyline {
    fill: none;
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawCart 2s ease forwards;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 8px var(--accent));
}

.preloader-svg path:nth-child(1) {
    animation-delay: 0s;
}

.preloader-svg path:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-svg circle:nth-child(3) {
    animation-delay: 0.4s;
}

.preloader-svg circle:nth-child(4) {
    animation-delay: 0.5s;
}

.preloader-svg polyline:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes drawCart {
    to {
        stroke-dashoffset: 0;
    }
}


/* Loading text */
.preloader-text {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 3px;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Loading dots */
.preloader-dots {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.preloader-dots span {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(1) {
    animation-delay: 0s;
}

.preloader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}