/* ══════════════════════════════════════════════════════════════
   Design System - بيت المتأمن (Bait Al-Muta'amen)
   Dietary Supplements Store
   Theme: Dark Green + White + Gold Accent
   ══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Alexandria:wght@300;400;500;600;700;800&family=Noto+Sans+Hebrew:wght@300;400;500;600;700;800&display=swap');

/* ══════════════════════════════════════
   CSS Custom Properties (Design Tokens)
   ══════════════════════════════════════ */
:root {
    /* ── Primary Colors (Orange) ── */
    --primary-50:  hsl(25, 100%, 96%);
    --primary-100: hsl(25, 100%, 90%);
    --primary-200: hsl(25, 100%, 80%);
    --primary-300: hsl(25, 100%, 70%);
    --primary-400: hsl(25, 100%, 60%);
    --primary-500: hsl(25, 100%, 50%);
    --primary-600: hsl(25, 100%, 40%);
    --primary-700: hsl(25, 100%, 30%);
    --primary-800: hsl(25, 100%, 20%);
    --primary-900: hsl(25, 100%, 10%);

    /* ── Accent Colors (Gold) ── */
    --accent-50:  hsl(42, 90%, 96%);
    --accent-100: hsl(42, 85%, 88%);
    --accent-200: hsl(42, 80%, 75%);
    --accent-300: hsl(42, 82%, 62%);
    --accent-400: hsl(42, 85%, 55%);
    --accent-500: hsl(42, 80%, 48%);
    --accent-600: hsl(38, 75%, 40%);
    --accent-700: hsl(35, 70%, 32%);

    /* ── Neutral Colors ── */
    --neutral-50:  hsl(140, 15%, 98%);
    --neutral-100: hsl(140, 12%, 95%);
    --neutral-200: hsl(140, 10%, 90%);
    --neutral-300: hsl(140, 8%, 82%);
    --neutral-400: hsl(140, 5%, 64%);
    --neutral-500: hsl(140, 4%, 46%);
    --neutral-600: hsl(140, 5%, 34%);
    --neutral-700: hsl(140, 8%, 24%);
    --neutral-800: hsl(140, 12%, 14%);
    --neutral-900: hsl(140, 18%, 8%);

    /* ── Semantic Colors ── */
    --success: hsl(142, 70%, 40%);
    --success-bg: hsl(142, 60%, 94%);
    --warning: hsl(38, 92%, 50%);
    --warning-bg: hsl(38, 90%, 94%);
    --error: hsl(0, 72%, 51%);
    --error-bg: hsl(0, 70%, 95%);
    --info: hsl(210, 70%, 50%);
    --info-bg: hsl(210, 70%, 95%);

    /* ══════════════════════════════════
       Light Mode (Default)
       ══════════════════════════════════ */
    --bg-primary: #ffffff;
    --bg-secondary: var(--neutral-50);
    --bg-tertiary: var(--neutral-100);
    --bg-card: #ffffff;
    --bg-card-hover: var(--primary-50);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-strong: rgba(255, 255, 255, 0.95);

    --text-primary: var(--neutral-900);
    --text-secondary: var(--neutral-600);
    --text-muted: var(--neutral-400);
    --text-inverse: #ffffff;
    --text-on-primary: #ffffff;
    --text-accent: var(--accent-500);

    --border-color: var(--neutral-200);
    --border-light: var(--neutral-100);
    --border-focus: var(--primary-400);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.1), 0 8px 20px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(255, 107, 0, 0.15);
    --shadow-gold: 0 0 20px rgba(212, 165, 32, 0.2);

    /* ── Component-specific ── */
    --navbar-bg: var(--bg-glass-strong);
    --navbar-shadow: var(--shadow-sm);
    --sidebar-bg: var(--primary-800);
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-active: var(--primary-500);
    --footer-bg: var(--primary-900);
    --footer-text: rgba(255, 255, 255, 0.8);
    --input-bg: #ffffff;
    --input-border: var(--neutral-300);
    --input-focus-ring: rgba(255, 107, 0, 0.25);
    --badge-bg: var(--error);
    --badge-text: #ffffff;

    /* ── Typography ── */
    --font-ar: 'Alexandria', 'Segoe UI', Tahoma, sans-serif;
    --font-he: 'Noto Sans Hebrew', 'Segoe UI', Tahoma, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs:   0.75rem;    /* 12px */
    --text-sm:   0.875rem;   /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg:   1.125rem;   /* 18px */
    --text-xl:   1.25rem;    /* 20px */
    --text-2xl:  1.5rem;     /* 24px */
    --text-3xl:  1.875rem;   /* 30px */
    --text-4xl:  2.25rem;    /* 36px */
    --text-5xl:  3rem;       /* 48px */

    --leading-tight: 1.25;
    --leading-normal: 1.6;
    --leading-relaxed: 1.75;

    /* ── Spacing ── */
    --space-1:  0.25rem;   /* 4px */
    --space-2:  0.5rem;    /* 8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */

    /* ── Border Radius ── */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;

    /* ── Transitions ── */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Z-Index ── */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-tooltip: 1060;
    --z-toast: 1070;

    /* ── Layout ── */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1400px;
    --sidebar-width: 280px;
    --navbar-height: 72px;
}

/* ══════════════════════════════════
   Dark Mode
   ══════════════════════════════════ */
[data-theme="dark"] {
    --bg-primary: hsl(0, 0%, 6%);
    --bg-secondary: hsl(0, 0%, 9%);
    --bg-tertiary: hsl(0, 0%, 12%);
    --bg-card: hsl(0, 0%, 9%);
    --bg-card-hover: hsl(0, 0%, 12%);
    --bg-overlay: rgba(0, 0, 0, 0.8);
    --bg-glass: rgba(15, 15, 15, 0.85);
    --bg-glass-strong: rgba(15, 15, 15, 0.95);

    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(0, 0%, 75%);
    --text-muted: hsl(0, 0%, 55%);
    --text-inverse: hsl(0, 0%, 6%);

    --border-color: hsl(0, 0%, 18%);
    --border-light: hsl(0, 0%, 14%);
    --border-focus: var(--primary-400);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 25px rgba(255, 107, 0, 0.2);
    --shadow-gold: 0 0 25px rgba(212, 165, 32, 0.15);

    --navbar-bg: var(--bg-glass-strong);
    --sidebar-bg: hsl(0, 0%, 5%);
    --footer-bg: hsl(0, 0%, 4%);
    --input-bg: hsl(0, 0%, 8%);
    --input-border: hsl(0, 0%, 20%);
    --input-focus-ring: rgba(255, 107, 0, 0.25);

    --success-bg: hsl(142, 40%, 14%);
    --warning-bg: hsl(38, 40%, 14%);
    --error-bg: hsl(0, 40%, 14%);
    --info-bg: hsl(210, 40%, 14%);
}

/* ══════════════════════════════════
   Base Reset + Defaults
   ══════════════════════════════════ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: var(--font-he);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

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

/* RTL / LTR */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* ── Links ── */
a {
    color: var(--primary-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ── Images ── */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Lists ── */
ul, ol {
    list-style: none;
}

/* ── Selection ── */
::selection {
    background-color: var(--primary-200);
    color: var(--primary-900);
}

/* ══════════════════════════════════
   Layout Utilities
   ══════════════════════════════════ */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-2xl { max-width: var(--container-2xl); }

/* ── Grid System ── */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .grid-cols-4,
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 { grid-template-columns: 1fr; }
}

/* ── Flex Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Spacing ── */
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary-500); }
.text-accent { color: var(--accent-500); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

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

.hidden { display: none !important; }

/* ══════════════════════════════════
   Animations
   ══════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] @keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease forwards; }
.animate-fadeInDown { animation: fadeInDown 0.3s ease forwards; }
.animate-scaleIn { animation: scaleIn 0.3s ease forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Staggered animation delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ══════════════════════════════════
   Scrollbar
   ══════════════════════════════════ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-400);
}

/* ══════════════════════════════════
   Print Styles
   ══════════════════════════════════ */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; color: #000; }
}
