/*
 * Onlenco design tokens.
 * Design tokens used across the UI.
 * Tailwind utilities still apply on top of this — these
 * vars feed the Tailwind config's `colors` block (see base.html).
 */

:root {
  --background: 210 40% 98%;
  --foreground: 222 47% 11%;

  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;

  --popover: 0 0% 100%;
  --popover-foreground: 222 47% 11%;

  --primary: 221 83% 53%;
  --primary-foreground: 0 0% 100%;
  --primary-glow: 213 94% 68%;

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

  --muted: 210 40% 96%;
  --muted-foreground: 215 16% 47%;

  --accent: 43 96% 56%;
  --accent-foreground: 222 47% 11%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  --border: 214 32% 91%;
  --input: 214 32% 91%;
  --ring: 221 83% 53%;

  --success: 160 84% 39%;
  --warning: 43 96% 56%;
  --info: 217 91% 60%;

  --radius: 0.75rem;

  --gradient-hero: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
  --gradient-primary: var(--gradient-hero);
  --gradient-sunset: linear-gradient(135deg, hsl(var(--accent)) 0%, hsl(38 92% 50%) 100%);
  --gradient-soft: linear-gradient(135deg, hsl(214 100% 97%) 0%, hsl(151 81% 96%) 100%);
  --gradient-card: linear-gradient(180deg, hsl(0 0% 100%) 0%, hsl(var(--background)) 100%);
  --gradient-text: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));

  --shadow-soft: 0 4px 14px -8px hsl(var(--foreground) / 0.16);
  --shadow-elegant: 0 20px 40px -24px hsl(var(--primary) / 0.35);
  --shadow-glow: 0 0 60px hsl(var(--secondary) / 0.24);

  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', 'Cairo', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

[dir="rtl"] body { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }
[dir="rtl"] .font-display { font-family: 'Cairo', 'Inter', system-ui, sans-serif; font-weight: 700; }

.font-display {
  font-family: 'Inter', 'Cairo', system-ui, sans-serif;
  letter-spacing: 0;
}

/* Gradient utilities */
.gradient-hero   { background: var(--gradient-hero); }
.gradient-sunset { background: var(--gradient-sunset); }
.gradient-card   { background: var(--gradient-card); }
.bg-gradient-soft { background: var(--gradient-soft); }

.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.feature-icon {
  height: 3rem;
  width: 3rem;
  border-radius: 0.875rem;
  display: grid;
  place-items: center;
}
.feature-icon-1 { background: hsl(var(--primary)); }
.feature-icon-2 { background: hsl(var(--secondary)); }
.feature-icon-3 { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.feature-icon-4 { background: hsl(var(--info, 217 91% 60%)); }
.feature-icon-5 { background: hsl(var(--warning, 43 96% 56%)); color: hsl(var(--accent-foreground)); }
.feature-icon-6 { background: hsl(var(--destructive)); }
.feature-icon-3 [data-lucide],
.feature-icon-5 [data-lucide] { color: hsl(var(--accent-foreground)); }
.feature-icon-soft-1 { background: hsl(var(--primary) / 0.10); color: hsl(var(--primary)); }
.feature-icon-soft-2 { background: hsl(var(--secondary) / 0.10); color: hsl(var(--secondary)); }
.feature-icon-soft-3 { background: hsl(var(--accent) / 0.16); color: hsl(38 92% 42%); }
.feature-icon-soft-4 { background: hsl(var(--info) / 0.10); color: hsl(var(--info)); }
.feature-icon-soft-5 { background: hsl(var(--warning) / 0.16); color: hsl(38 92% 42%); }
.feature-icon-soft-6 { background: hsl(var(--destructive) / 0.10); color: hsl(var(--destructive)); }

.shadow-soft    { box-shadow: var(--shadow-soft); }
.shadow-elegant { box-shadow: var(--shadow-elegant); }
.shadow-glow    { box-shadow: var(--shadow-glow); }

.transition-smooth { transition: all 0.3s var(--transition-smooth); }

/* Shared brand lockup from the Figma Make design. */
.onlenco-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: hsl(var(--foreground));
  text-decoration: none;
  font-weight: 800;
}
.onlenco-brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--gradient-primary, var(--gradient-hero));
  box-shadow: 0 12px 26px -16px hsl(var(--primary) / 0.75);
  flex: 0 0 auto;
}
.onlenco-brand-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1;
}
/* Brand logo image — the real Onlenco mark, shown at a readable size
   (not the tiny icon box). */
.onlenco-brand-logo {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Flip directional icons in RTL. */
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* RTL physical-direction shim.
   Tailwind's `left-X` / `right-X` are physical (always visually right
   regardless of writing direction). In Arabic we want them mirrored.
   These rules flip the most common cases so existing templates render
   correctly without per-template edits. */
[dir="rtl"] .right-4  { right: auto !important; left: 1rem !important; }
[dir="rtl"] .right-2  { right: auto !important; left: 0.5rem !important; }
[dir="rtl"] .left-4   { left: auto !important;  right: 1rem !important; }
[dir="rtl"] .left-2   { left: auto !important;  right: 0.5rem !important; }
/* Same for inline-style fixed positions used on the pricing badge etc. */
[dir="rtl"] [style*="right:1rem"]      { right: auto !important; left: 1rem !important; }
[dir="rtl"] [style*="right: 1rem"]     { right: auto !important; left: 1rem !important; }
[dir="rtl"] [style*="right:0.5rem"]    { right: auto !important; left: 0.5rem !important; }
[dir="rtl"] [style*="right: 0.5rem"]   { right: auto !important; left: 0.5rem !important; }

/* Container — centered content with responsive max widths. */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px)  { .container { max-width: 640px; } }
@media (min-width: 768px)  { .container { max-width: 768px; padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .container { max-width: 1024px; padding-left: 2rem;   padding-right: 2rem; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }
@media (min-width: 1536px) { .container { max-width: 1400px; } }

/* Animations */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.animate-fade-up { animation: fade-up 0.6s var(--transition-smooth) both; }
.animate-float   { animation: float 4s ease-in-out infinite; }

/* Form widgets — Django renders plain inputs; this styles them consistently
   without extra template dependencies. */
input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="file"],
select, textarea {
  width: 100%;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 0.625rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}
input[type="file"] { padding: 0.4rem; cursor: pointer; }
textarea { min-height: 90px; resize: vertical; }

/* Radio cards (placement test) */
.radio-card {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: 0.625rem;
  border: 1px solid hsl(var(--border));
  cursor: pointer;
  transition: background 0.2s;
}
.radio-card:hover { background: hsl(var(--muted) / 0.5); }
.radio-card input[type="radio"] {
  width: 18px; height: 18px; accent-color: hsl(var(--primary));
  margin: 0; padding: 0; flex: 0 0 18px;
}
.radio-card label { cursor: pointer; flex: 1; font-weight: 400; }

/* Toasts */
.toast {
  padding: 0.85rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}
.toast-success { border-color: hsl(150 50% 60%); background: hsl(150 50% 96%); color: hsl(150 60% 25%); }
.toast-error   { border-color: hsl(0 70% 70%);   background: hsl(0 75% 97%);   color: hsl(0 70% 35%); }
.toast-info    { border-color: hsl(200 70% 70%); background: hsl(200 70% 97%); color: hsl(200 70% 30%); }

.divider-soft { height: 1px; background: hsl(var(--border) / 0.6); }

/* =====================================================================
   Component classes
   Shared Button / Card / Badge styling. Keeping them as plain CSS (rather
   than re-applying
   Tailwind utilities everywhere) keeps the templates short.
   ===================================================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.625rem;
  font-weight: 600;
  font-size: 0.875rem;
  height: 2.5rem;
  padding: 0 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  font-family: inherit;
}
.btn:disabled, .btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-lg { height: 3rem; padding: 0 1.75rem; font-size: 1rem; border-radius: 0.75rem; }

.btn-hero {
  background: var(--gradient-hero);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-soft);
}
.btn-hero:hover { box-shadow: var(--shadow-elegant); transform: translateY(-1px); }

.btn-outline {
  background: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.btn-outline:hover { background: hsl(var(--muted)); border-color: hsl(var(--ring)); }

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}
.btn-ghost:hover { background: hsl(var(--muted) / 0.6); }

/* "Glass" button — used inside the gradient-hero card. Translucent
   white pill that pops against the dark gradient. */
.btn-glass {
  background: hsl(0 0% 100% / 0.18);
  border-color: hsl(0 0% 100% / 0.25);
  color: hsl(var(--primary-foreground));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-glass:hover { background: hsl(0 0% 100% / 0.28); }

/* --- Cards --- */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius);
  color: hsl(var(--card-foreground));
}

/* When a `.card` is also tagged with a gradient class, the gradient must win.
 * Without the compound selector below, the later-declared `.card` rule
 * paints the card white and the white-on-white text becomes invisible. */
.card.gradient-hero {
  background: var(--gradient-hero);
  color: #ffffff;
  border-color: transparent;
}
.card.gradient-hero h1,
.card.gradient-hero h2,
.card.gradient-hero h3,
.card.gradient-hero p,
.card.gradient-hero a,
.card.gradient-hero span {
  color: #ffffff;
}
.card.gradient-sunset {
  background: var(--gradient-sunset);
  color: #ffffff;
  border-color: transparent;
}
.card.gradient-sunset h1,
.card.gradient-sunset h2,
.card.gradient-sunset h3,
.card.gradient-sunset p,
.card.gradient-sunset a,
.card.gradient-sunset span {
  color: #ffffff;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  line-height: 1;
}
.badge-secondary { background: hsl(var(--secondary) / 0.15); color: hsl(var(--secondary)); border-color: hsl(var(--secondary) / 0.3); }
.badge-outline   { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.badge-popular   { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }

/* Toast container z-index already set in base.html */
.toast-container { pointer-events: none; }
.toast-container .toast { pointer-events: auto; }

/* --- Form labels & explicit .input/.label classes used in auth/payment forms --- */
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: hsl(var(--foreground));
}
.input { /* same as the generic input above; explicit class for clarity */ }

/* A0 World — beginner journey experience. */
.a0-world-hero {
  position: relative;
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at 12% 18%, hsl(var(--accent) / 0.22), transparent 28%),
    radial-gradient(circle at 86% 12%, hsl(var(--secondary) / 0.16), transparent 32%),
    linear-gradient(135deg, hsl(214 100% 98%) 0%, hsl(151 81% 97%) 100%);
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--shadow-elegant);
}
.a0-world-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -4rem;
  bottom: -4.5rem;
  width: 17rem;
  height: 17rem;
  border-radius: 999px;
  background: hsl(var(--primary) / 0.08);
}
.a0-micro-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.8rem;
  background: hsl(var(--card) / 0.82);
  padding: 0.7rem 0.8rem;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.a0-micro-step [data-lucide] {
  color: hsl(var(--primary));
  flex: 0 0 auto;
}
.a0-progress-panel {
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--card) / 0.9);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}
.a0-mission-map {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.a0-mission-card {
  position: relative;
  min-height: 15.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--card));
  padding: 1.1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--transition-smooth), box-shadow 0.2s var(--transition-smooth);
}
.a0-mission-card[data-state="unlocked"] {
  border-color: hsl(var(--primary) / 0.35);
}
.a0-mission-card[data-state="completed"] {
  border-color: hsl(var(--secondary) / 0.45);
  background: linear-gradient(180deg, hsl(151 81% 98%) 0%, hsl(var(--card)) 78%);
}
.a0-mission-card[data-state="locked"] {
  background: hsl(var(--muted) / 0.55);
  color: hsl(var(--muted-foreground));
}
.a0-mission-card[data-state="unlocked"]:hover,
.a0-mission-card[data-state="completed"]:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-elegant);
}
.a0-mission-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}
.a0-mission-icon[data-state="completed"] {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.a0-mission-icon[data-state="locked"] {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
