/* ═══ Rezmi — پورت دقیق globals.css + MagicButton.css + MagicBento.css ═══ */

:root {
  --font-vazir:     'Vazirmatn', sans-serif;
  --font-orbitron:  'Orbitron', 'Vazirmatn', sans-serif;
  --font-jetbrains: 'JetBrains Mono', 'Vazirmatn', monospace;
  --font-rajdhani:  'Vazirmatn', sans-serif;
}

/* ═══ THEME: رضمی سیاه (default) ═══ */
:root,
[data-theme="rezmi-dark"] {
  --bg-base:      #000000;
  --bg-dark:      #080808;
  --bg-card:      #0d0d0d;
  --bg-border:    #1a1a1a;
  --text-primary: #ffffff;
  --text-muted:   #9ca3af;
  --accent:       #ffffff;
  --accent-dark:  #d1d5db;
  --accent-2:     #e5e7eb;
  --accent-3:     #9ca3af;
  --grid-color:   rgba(255, 255, 255, 0.025);
  --scrollbar-bg: #000000;
  --scrollbar-thumb: #333333;
  --navbar-glass: rgba(0, 0, 0, 0.92);
  --navbar-border: rgba(255, 255, 255, 0.08);
  --scan-line:    rgba(255, 255, 255, 0.12);
  --input-bg:     #0d0d0d;
  --shadow-card:  0 8px 32px rgba(0, 0, 0, 0.8);
}

/* ═══ THEME: رضمی سفید ═══ */
[data-theme="rezmi-white"] {
  --bg-base:      #ffffff;
  --bg-dark:      #f3f4f6;
  --bg-card:      #ffffff;
  --bg-border:    #e5e7eb;
  --text-primary: #000000;
  --text-muted:   #6b7280;
  --accent:       #000000;
  --accent-dark:  #1f2937;
  --accent-2:     #374151;
  --accent-3:     #6b7280;
  --grid-color:   rgba(0, 0, 0, 0.03);
  --scrollbar-bg: #f3f4f6;
  --scrollbar-thumb: #d1d5db;
  --navbar-glass: rgba(255, 255, 255, 0.95);
  --navbar-border: rgba(0, 0, 0, 0.08);
  --scan-line:    rgba(0, 0, 0, 0.08);
  --input-bg:     #f9fafb;
  --shadow-card:  0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ═══ BASE STYLES ═══ */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-vazir), sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

*,
input,
textarea,
select,
button {
  font-family: var(--font-vazir), sans-serif;
}

.font-display,
h1.display,
h2.display {
  font-family: var(--font-orbitron), monospace;
}

.font-mono {
  font-family: var(--font-jetbrains), monospace;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dark); }

/* ─── Glow utilities ─── */
.text-glow-accent { text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent), 0 0 30px color-mix(in srgb, var(--accent) 30%, transparent); }
.text-glow-green  { text-shadow: 0 0 10px rgba(0,255,136,.8), 0 0 30px rgba(0,255,136,.4); }
.text-glow-cyan   { text-shadow: 0 0 10px rgba(0,229,255,.8), 0 0 30px rgba(0,229,255,.4); }

/* ─── Grid background ─── */
.bg-grid {
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ─── Card hover effects ─── */
.card-hover-green:hover  { border-color: rgba(255,255,255,.3) !important; box-shadow: var(--shadow-card); }
.card-hover-cyan:hover   { border-color: rgba(255,255,255,.3) !important; box-shadow: var(--shadow-card); }
.card-hover-purple:hover { border-color: rgba(255,255,255,.3) !important; box-shadow: var(--shadow-card); }
.card-hover-orange:hover { border-color: rgba(255,255,255,.3) !important; box-shadow: var(--shadow-card); }

[data-theme="rezmi-dark"] .card-hover-green:hover  { border-color: rgba(255,255,255,.2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 30px rgba(255,255,255,.05); }
[data-theme="rezmi-dark"] .card-hover-cyan:hover   { border-color: rgba(255,255,255,.2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 30px rgba(255,255,255,.05); }
[data-theme="rezmi-dark"] .card-hover-purple:hover { border-color: rgba(255,255,255,.2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 30px rgba(255,255,255,.05); }
[data-theme="rezmi-dark"] .card-hover-orange:hover { border-color: rgba(255,255,255,.2) !important; box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 30px rgba(255,255,255,.05); }

[data-theme="rezmi-white"] .card-hover-green:hover  { box-shadow: 0 8px 32px rgba(0,0,0,.12); }
[data-theme="rezmi-white"] .card-hover-cyan:hover   { box-shadow: 0 8px 32px rgba(0,0,0,.12); }
[data-theme="rezmi-white"] .card-hover-purple:hover { box-shadow: 0 8px 32px rgba(0,0,0,.12); }
[data-theme="rezmi-white"] .card-hover-orange:hover { box-shadow: 0 8px 32px rgba(0,0,0,.12); }

/* ─── Navbar glass ─── */
.navbar-glass {
  background: var(--navbar-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--navbar-border);
}

/* ─── Clip corner decorations ─── */
.clip-corner    { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); }
.clip-corner-sm { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }

[data-theme="rezmi-white"] .clip-corner,
[data-theme="rezmi-white"] .clip-corner-sm { filter: drop-shadow(0 2px 8px rgba(0,0,0,.08)); }

/* ─── Animated underline nav link ─── */
.nav-link-glow { position: relative; transition: color 0.3s ease; }
.nav-link-glow::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.3s ease;
}
.nav-link-glow:hover::after { width: 100%; }

/* ─── Hero scan line ─── */
@keyframes heroScan { 0% { top: -10%; } 100% { top: 110%; } }
.hero-scan-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--scan-line), transparent);
  animation: heroScan 8s linear infinite;
  pointer-events: none;
}

/* ─── Pixel logo dots ─── */
.pixel-dot {
  width: 4px; height: 4px;
  background: var(--accent);
}

/* ─── Theme transition ─── */
*, *::before, *::after {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ─── Admin sidebar active ─── */
.admin-nav-active { background: color-mix(in srgb, var(--accent) 10%, transparent); border-inline-start: 2px solid var(--accent); color: var(--accent); }

/* ─── Admin / global form inputs ─── */
.inp {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--bg-border);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-vazir), sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
}
.inp:focus { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* ─── Markdown live-preview + article body ─── */
.news-preview h1, .prose-rz h1 { font-family: var(--font-vazir); font-weight: 800; font-size: 1.6rem; margin: 1rem 0 0.6rem; color: var(--text-primary); }
.news-preview h2, .prose-rz h2 { font-family: var(--font-vazir); font-weight: 700; font-size: 1.3rem; margin: 0.9rem 0 0.5rem; color: var(--text-primary); }
.news-preview h3, .prose-rz h3 { font-family: var(--font-vazir); font-weight: 600; font-size: 1.1rem; margin: 0.8rem 0 0.4rem; color: var(--text-primary); }
.news-preview p, .prose-rz p { margin: 0.6rem 0; line-height: 1.9; color: var(--text-muted); }
.news-preview ul, .prose-rz ul { margin: 0.6rem 0; padding-inline-start: 1.2rem; }
.news-preview li, .prose-rz li { list-style: none; position: relative; padding-inline-start: 1rem; margin: 0.3rem 0; color: var(--text-muted); }
.news-preview li::before, .prose-rz li::before { content: "▸"; position: absolute; inset-inline-start: 0; color: var(--accent); }
.news-preview strong, .prose-rz strong { color: var(--text-primary); font-weight: 700; }
.news-preview a, .prose-rz a { color: #4da3ff; text-decoration: underline; }
.news-preview img, .prose-rz img { max-width: 100%; height: auto; margin: 1rem 0; border: 1px solid var(--bg-border); }

/* ── Press feedback on interactive top-bar elements ── */
.magic-btn { transition: transform 0.08s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease; }
.magic-btn:active { transform: scale(0.93); }
.rz-magic-navlink { transition: transform 0.08s ease, color 0.3s ease; }
.rz-magic-navlink:active { transform: translateY(1px) scale(0.97); }

/* ─── Fade-in برای بک‌گراند WebGL بعد از لود ─── */
@keyframes rz-bg-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── احترام به prefers-reduced-motion ─── */
@media (prefers-reduced-motion: reduce) {
  html, body { scroll-behavior: auto; }
  .hero-scan-line { animation: none; display: none; }
  .animate-bounce, .animate-pulse { animation: none; }
}

/* ═══ MagicButton.css ═══ */
@keyframes magic-ripple {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(1); opacity: 0; }
}

.magic-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.magic-btn-border {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    140px circle at var(--glow-x) var(--glow-y),
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.65)) 0%,
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.25)) 45%,
    transparent 75%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 1px;
}

/* ═══ MagicBento.css ═══ */
.rz-magic-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  --glow-x:         50%;
  --glow-y:         50%;
  --glow-intensity: 0;
  --glow-radius:    280px;
  --glow-color:     255, 255, 255;

  transition: transform 0.25s cubic-bezier(.22,.68,0,1.2),
              box-shadow 0.3s ease;
}

[data-theme="rezmi-white"] .rz-magic-card {
  --glow-color: 0, 0, 0;
}

.rz-magic-card::after {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: radial-gradient(
    var(--glow-radius) circle at var(--glow-x) var(--glow-y),
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.85)) 0%,
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.35)) 40%,
    transparent 70%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

.rz-magic-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    calc(var(--glow-radius) * 0.9) circle at var(--glow-x) var(--glow-y),
    rgba(var(--glow-color), calc(var(--glow-intensity) * 0.045)) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 1;
}

.rz-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
}

@keyframes rz-ripple {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(1); opacity: 0; }
}

.rz-magic-navlink {
  position: relative;
  overflow: visible;
  isolation: isolate;
  padding: 4px 2px;
}

.rz-navlink-border {
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 1px;
  pointer-events: none;
  background: radial-gradient(
    100px circle at var(--nav-glow-x, 50%) 50%,
    rgba(var(--glow-color, 255,255,255), calc(var(--nav-glow, 0) * 0.8)) 0%,
    rgba(var(--glow-color, 255,255,255), calc(var(--nav-glow, 0) * 0.3)) 50%,
    transparent 100%
  );
}

/* ═══ SpecialOfferPopup (styled-jsx → سراسری) ═══ */
.offer-card { animation: offer-in 0.5s cubic-bezier(.2,.8,.2,1); }
@keyframes offer-in { 0% { transform: scale(0.9); } 100% { transform: scale(1); } }
.offer-ring { position: absolute; inset: -4px; border-radius: 1.1rem; border: 2px solid; animation: offer-pulse 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes offer-pulse { 0%,100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.02); } }
.offer-float { animation: offer-float 3s ease-in-out infinite; display: inline-block; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }
@keyframes offer-float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-7px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .offer-card, .offer-float, .offer-ring { animation: none !important; } }

/* ═══ توست (پورت Toast.tsx) ═══ */
#rz-toasts {
  position: fixed; top: 6rem; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; align-items: center;
  gap: .5rem; width: calc(100% - 2rem); max-width: 24rem; pointer-events: none;
}
.rz-toast {
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem;
  border: 1px solid; cursor: pointer; pointer-events: auto;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  transition: all .3s ease; opacity: 0; transform: translateY(-1rem);
  font-family: var(--font-vazir); font-size: .875rem; color: var(--text-primary);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.rz-toast.show { opacity: 1; transform: translateY(0); }
.rz-toast-success { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 5%, var(--bg-card)); }
.rz-toast-error   { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.05); }
.rz-toast-info    { border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); background: color-mix(in srgb, var(--accent-2) 5%, var(--bg-card)); }
.rz-toast-loading { border-color: var(--bg-border); background: var(--bg-card); }

/* ─── نوار متحرک شبکه‌های اجتماعی — پورت StatsLoop.jsx + LogoLoop.jsx ─── */
.rz-socialloop { position: relative; overflow-x: clip; overflow-y: visible; padding: 14px 0; background: #000; border-top: 1px solid #1a1a1a; border-bottom: 1px solid #1a1a1a; }
html[data-theme="rezmi-white"] .rz-socialloop { background: #fff; border-color: #e5e5e5; }
.rz-socialloop-track { display: flex; align-items: center; gap: 52px; width: max-content; animation: rz-loop 28s linear infinite; }
.rz-socialloop:hover .rz-socialloop-track { animation-play-state: paused; }
@keyframes rz-loop { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.rz-social { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rz-social-icon { display: inline-flex; width: 36px; height: 36px; }
.rz-social-icon svg { width: 100%; height: 100%; fill: #ffffff; }
html[data-theme="rezmi-white"] .rz-social-icon svg { fill: #111111; }
.rz-social-tip { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) scale(0.9); opacity: 0; pointer-events: none; white-space: nowrap; background: #fff; color: #000; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 6px; transition: opacity .2s ease, transform .2s ease; z-index: 30; }
html[data-theme="rezmi-white"] .rz-social-tip { background: #000; color: #fff; }
.rz-social-tip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #fff; }
html[data-theme="rezmi-white"] .rz-social-tip::after { border-top-color: #000; }
.rz-social:hover .rz-social-tip { opacity: 1; transform: translateX(-50%) scale(1); }
@media (prefers-reduced-motion: reduce) { .rz-socialloop-track { animation: none; } }

/* ─── کارت پک شانسی — پورت styled-jsx از LuckyPackCard.tsx ─── */
.lucky-card { padding: 1.5px; transition: transform .4s ease; }
.lucky-card:hover { transform: translateY(-4px); }
.lucky-border { position: absolute; inset: 0; z-index: 0; border-radius: inherit; background: conic-gradient(from 0deg, #8b5cf6, #ec4899, #f59e0b, #3b82f6, #8b5cf6); background-size: 200% 200%; animation: lucky-spin 6s linear infinite; opacity: 0.55; transition: opacity .4s ease; }
.lucky-card:hover .lucky-border { opacity: 1; }
.lucky-inner { margin: 0; }
@keyframes lucky-spin { to { background-position: 200% 200%; } }
.lucky-float { animation: lucky-float 3.5s ease-in-out infinite; }
@keyframes lucky-float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
.lucky-rays { position: absolute; inset: -30%; z-index: 1; background: repeating-conic-gradient(from 0deg, rgba(168,85,247,0.10) 0deg 12deg, transparent 12deg 24deg); animation: lucky-spin2 18s linear infinite; opacity: .5; }
@keyframes lucky-spin2 { to { transform: rotate(360deg); } }
.lucky-shine { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 5; background: linear-gradient(100deg, transparent, rgba(255,255,255,0.18), transparent); transform: translateX(-200%); pointer-events: none; }
.lucky-card:hover .lucky-shine { animation: lucky-shine 1s ease; }
@keyframes lucky-shine { to { transform: translateX(350%); } }
@media (prefers-reduced-motion: reduce) { .lucky-border, .lucky-float, .lucky-rays, .lucky-shine { animation: none !important; } }
