/* ─────────────────────────────────────────────────────────────────────────────
   استایل سراسری — بازنویسی Tailwind (globals.css + tailwind.config.ts)
   پالت برند brand + فونت وزیرمتن + RTL
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* ── مقیاس برند: نارنجی تاجوانی (گرادیانت رسمی سازمانی) ──
     گرادیانت اصلی سازمانی: 0% → #FF7700   |   100% → #FFA181
     --brand-500 (رنگ اصلی) = ابتدای گرادیانت، --brand-300 = انتهای گرادیانت */
  --brand-50: #fff7f0;
  --brand-100: #ffeee0;
  --brand-200: #ffd9b8;
  --brand-300: #ffa181;
  --brand-400: #ff8c40;
  --brand-500: #ff7700;
  --brand-600: #ed6500;
  --brand-700: #ce5600;
  --brand-800: #9e4200;
  --brand-900: #7d3600;
  --brand-950: #4f2100;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --red-50: #fef2f2;
  --red-600: #dc2626;

  /* ارتفاع هدر سایت — SiteHeader و صفحاتی که باید «از زیر هدر تا پایین دید»
     کشیده شوند (مثل صفحهٔ ورود) از همین استفاده می‌کنند */
  --header-h: 4rem;
}

/* ── Preflight گم‌شدهٔ Tailwind: box-sizing سراسری ──
   بدون این قاعده، .container-x (width:100% + padding-inline:1rem) در حالت
   content-box دو برابر padding از عرض دید بیرون می‌زد؛ در RTL با
   overflow-x: clip همین سرریز از سمت «چپ» بریده می‌شد و دکمهٔ «رزرو نوبت»
   ناقص و چسبیده به لبهٔ صفحه دیده می‌شد. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* پشتیبان مرورگرهای قدیمی — فقط روی html تا position: sticky هدر خراب نشود */
html {
  font-size: 16px;
  overflow-x: hidden;
}

/* حذف اسکرول‌بار افقی در زوم ۱۰۰٪ — clip برخلاف hidden کانتینر اسکرول نمی‌سازد
   و position: sticky هدر همچنان کار می‌کند */
html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  /* در مرورگر موبایل 100vh ارتفاع «بزرگ‌ترین» دید (بدون نوار آدرس) است و
     همیشه یک اسکرول عمودی اضافه می‌سازد؛ dvh ارتفاع واقعی دید است */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--slate-50);
  color: var(--slate-800);
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1:focus {
  outline: none;
}

::selection {
  background: rgba(255, 119, 0, 0.2);
  color: var(--brand-900);
}

/* اسکرول‌بار سفارشی */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--slate-100);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-300));
  border-radius: 9999px;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
}

.valid.modified:not([type="checkbox"]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid #e50000;
}

.validation-message {
  color: #e50000;
}

/* ═══════════════ کلاس‌های ابزار مشترک (بازنویسی utilities از globals.css) ═══════════════ */

.container-x {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ═══════════════ استایل‌های ابزار چیدمان ═══════════════ */

/* MainLayout از main.flex-1 استفاده می‌کند؛ این کلاس جا افتاده بود و main هرگز
   کشیده نمی‌شد. نتیجه: فوتر فقط با margin-top:auto پایین می‌رفت و هیچ صفحه‌ای
   نمی‌توانست «ارتفاع باقی‌ماندهٔ بین هدر و فوتر» را محاسبه کند (مثل وسط‌چین‌کردن
   کارت ورود که ۸۰vh + هدر + فوتر همیشه اسکرول عمودی اضافه می‌ساخت). */
.flex-1 {
  flex: 1 1 0%;
}

.glass-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

/* برق عبوری هنگام هاور — مطابق globals.css پروژه Node */
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.18) 45%,
    rgba(255, 255, 255, 0.05) 55%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform 0.9s ease;
  pointer-events: none;
}

.glass-card:hover::before {
  transform: translateX(120%);
}

.glow-border {
  position: relative;
}

.glow-border::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 119, 0, 0),
    rgba(255, 119, 0, 0.6),
    rgba(255, 119, 0, 0)
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.glow-border:hover::after {
  opacity: 1;
}

.btn-shine {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-shine::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: -60%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.7s ease;
  pointer-events: none;
}

.btn-shine:hover::after {
  left: 130%;
}

.text-gradient-animated {
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 5s linear infinite;
}

.bg-grid {
  background-image:
    linear-gradient(to left, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(
    ellipse 80% 65% at 50% 35%,
    black 35%,
    transparent 75%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 80% 65% at 50% 35%,
    black 35%,
    transparent 75%
  );
}

/* ── Reveal on scroll ── */
.reveal {
  opacity: 0;
  transform: translateY(32px) scale(0.98);
  transition:
    opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Keyframes ── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}

@keyframes blob {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(40px, -50px) scale(1.15);
  }
  66% {
    transform: translate(-30px, 30px) scale(0.92);
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shine-text {
  to {
    background-position: -200% center;
  }
}

.animate-fade-up {
  animation: fade-up 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.animate-fade-in {
  animation: fade-in 1.2s ease both;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-blob {
  animation: blob 14s ease-in-out infinite;
}

.animate-pulse-ring {
  animation: pulse-ring 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin-slow {
  animation: spin-slow 16s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .animate-fade-up,
  .animate-fade-in,
  .animate-float,
  .animate-blob,
  .animate-pulse-ring,
  .animate-spin-slow,
  .text-gradient-animated {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ═══════════════ Blazor error UI ═══════════════ */
#blazor-error-ui {
  color-scheme: light only;
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}
