@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  /* ═══════════════════════════════════════
     LIGHT MODE — Clean Pro Design
     ═══════════════════════════════════════ */
  :root {
    --background:        220 14% 96%;   /* #F3F4F6 */
    --foreground:        220 39% 11%;   /* #111827 */

    --card:              0 0% 100%;
    --card-foreground:   220 39% 11%;

    --popover:           0 0% 100%;
    --popover-foreground: 220 39% 11%;

    --primary:           172 85% 36%;   /* #0D9488 — teal */
    --primary-foreground: 0 0% 100%;

    --secondary:         220 14% 94%;
    --secondary-foreground: 220 9% 46%;

    --muted:             220 14% 94%;
    --muted-foreground:  220 9% 46%;   /* #6B7280 */

    --accent:            197 100% 42%; /* #06B6D4 — cyan */
    --accent-foreground: 0 0% 100%;

    --destructive:       0 72% 51%;
    --destructive-foreground: 0 0% 100%;

    --success:           160 84% 39%;
    --success-foreground: 0 0% 100%;

    --warning:           38 92% 50%;
    --warning-foreground: 0 0% 0%;

    --border:            220 13% 91%;
    --input:             220 13% 91%;
    --ring:              172 85% 36%;
    --radius: 0.75rem;

    /* ── Sidebar — white ── */
    --sidebar-background:   0 0% 100%;
    --sidebar-foreground:   220 39% 11%;
    --sidebar-border:       220 13% 91%;
    --sidebar-primary:      243 75% 59%;
    --sidebar-accent:       243 100% 97%;
    --sidebar-accent-foreground: 243 75% 45%;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 72px;

    /* ── Shadows ── */
    --shadow-xs:   0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:   0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-brand: 0 4px 14px rgba(99,102,241,0.3);
    --shadow-glass: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-glow: 0 4px 16px rgba(99,102,241,0.2);
    --shadow-button: 0 4px 14px rgba(99,102,241,0.3);
    --shadow-elevated: 0 10px 25px rgba(0,0,0,0.08);
    --shadow-card-hover: 0 8px 20px rgba(0,0,0,0.08);

    /* ── Legacy compat ── */
    --violet: 243 75% 59%;
    --violet-dim: 243 60% 52%;
    --violet-glow: rgba(99,102,241,0.12);
    --violet-border: rgba(99,102,241,0.22);
    --brand-alpha-10: rgba(99,102,241,0.08);
    --brand-alpha-20: rgba(99,102,241,0.15);
    --brand-border: rgba(99,102,241,0.22);
    --gradient-primary: linear-gradient(135deg,#6366F1,#8B5CF6);
    --gradient-card: linear-gradient(135deg,#fff,#F9FAFB);
    --gradient-glow: radial-gradient(circle at center,rgba(99,102,241,0.05),transparent 70%);
    --gradient-mesh: #F3F4F6;
    --glass-bg: 0 0% 100% / 0.92;
    --glass-border: 220 13% 91% / 0.8;
    --glass-blur: 16px;
  }

  /* ═══════════════════════════════════════
     DARK MODE
     ═══════════════════════════════════════ */
  .dark {
    --background:        224 71% 4%;
    --foreground:        213 31% 91%;

    --card:              222 47% 8%;
    --card-foreground:   213 31% 91%;

    --popover:           222 47% 8%;
    --popover-foreground: 213 31% 91%;

    --primary:           243 75% 68%;
    --primary-foreground: 0 0% 100%;

    --secondary:         222 40% 14%;
    --secondary-foreground: 215 20% 65%;

    --muted:             222 40% 14%;
    --muted-foreground:  215 16% 47%;

    --accent:            243 75% 68%;
    --accent-foreground: 0 0% 100%;

    --destructive:       0 63% 55%;
    --destructive-foreground: 0 0% 100%;

    --success:           160 84% 44%;
    --success-foreground: 0 0% 100%;

    --warning:           38 88% 55%;
    --warning-foreground: 0 0% 0%;

    --border:            222 40% 14%;
    --input:             222 40% 14%;
    --ring:              243 75% 68%;

    --sidebar-background:  222 47% 6%;
    --sidebar-border:      222 40% 12%;
    --sidebar-accent:      243 40% 14%;
    --sidebar-accent-foreground: 243 75% 80%;

    --shadow-xs:   0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:   0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg:   0 10px 15px rgba(0,0,0,0.4);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-brand: 0 4px 14px rgba(99,102,241,0.4);
    --shadow-glass: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-glow: 0 4px 16px rgba(99,102,241,0.3);
    --shadow-button: 0 4px 14px rgba(99,102,241,0.4);
    --shadow-elevated: 0 10px 25px rgba(0,0,0,0.5);
    --shadow-card-hover: 0 8px 20px rgba(0,0,0,0.4);

    --violet: 243 75% 68%;
    --violet-dim: 243 60% 58%;
    --violet-glow: rgba(99,102,241,0.18);
    --violet-border: rgba(99,102,241,0.28);
    --brand-alpha-10: rgba(99,102,241,0.12);
    --brand-alpha-20: rgba(99,102,241,0.20);
    --brand-border: rgba(99,102,241,0.28);
    --gradient-primary: linear-gradient(135deg,#6366F1,#8B5CF6);
    --gradient-card: linear-gradient(135deg,hsl(222 47% 8%),hsl(222 47% 10%));
    --gradient-glow: radial-gradient(circle at center,rgba(99,102,241,0.08),transparent 70%);
    --gradient-mesh: hsl(224 71% 4%);
    --glass-bg: 222 47% 8% / 0.90;
    --glass-border: 222 40% 14% / 0.8;
    --glass-blur: 16px;
  }

  * {
    border-color: hsl(var(--border));
    box-sizing: border-box;
  }

  html {
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Heebo', 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
  }
}

@layer components {
  /* ─── Cards ─────────────────────────────── */
  .card-base {
    @apply bg-card rounded-xl border border-border;
    box-shadow: var(--shadow-card);
  }

  .card-interactive {
    @apply card-base transition-all duration-200 cursor-pointer;
  }

  .card-interactive:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
  }

  /* ─── Stat Card ──────────────────────────── */
  .stat-card {
    @apply card-base relative overflow-hidden p-5;
    transition: box-shadow 0.2s, transform 0.2s;
  }

  .stat-card:hover {
    box-shadow: var(--shadow-card-hover);
  }

  /* Kept for legacy compat — invisible */
  .stat-shimmer { display: none; }
  .stat-bar     { display: none; }

  /* ─── Scrollbar ──────────────────────────── */
  .scrollbar-hide::-webkit-scrollbar { display: none; }
  .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
}

/* ─── Animations ──────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.animate-fade-in  { animation: fadeIn 0.25s ease-out both; }
.animate-slide-in { animation: slideInRight 0.22s ease-out both; }

/* ─── Focus ──────────────────────────────── */
*:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: 6px;
}

/* ─── Safe area ──────────────────────────── */
.safe-area-top    { padding-top: env(safe-area-inset-top, 0px); }
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ─── Responsive grid helper ─────────────── */
@media (min-width: 640px) {
  .sm-grid-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}
