/* ================= ۱. فونت اختصاصی ================= */
@font-face {
  font-family: 'Black Future';
  src: url('../fonts/BlackFuture.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ================= ۲. متغیرهای رنگ ================= */
:root {
  --radius: 14px;
  --sky: #38bdf8;
  --purple: #7c3aed;
  --gradient: linear-gradient(135deg, #38bdf8 0%, #7c8cf8 45%, #a855f7 100%);

  --bg-1: #eaf3ff;
  --bg-2: #f4eeff;
  --text: #1c1b2e;
  --muted: #5f5c7d;
  --border: rgba(124,58,237,.15);
  --glass-bg: rgba(255,255,255,.55);
  --glass-border: rgba(124,58,237,.18);
  --glass-shadow: 0 8px 24px rgba(80,60,180,.10);
  --accent: #7c3aed;
}

html.dark {
  --bg-1: #0d1024;
  --bg-2: #160f2b;
  --text: #d1d5db;
  --muted: #9ca3af;
  --border: rgba(168,133,255,.22);
  --glass-bg: rgba(255,255,255,.06);
  --glass-border: rgba(168,133,255,.28);
  --glass-shadow: 0 8px 30px rgba(0,0,0,.45);
  --accent: #c084fc;
}

/* ================= ۳. پایه ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(56,189,248,.28), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(168,85,247,.24), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(124,58,237,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(124,58,237,.08) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
html.dark body::before {
  background-image:
    linear-gradient(to right, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.04) 1px, transparent 1px);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--gradient); border-radius: 10px; }

/* ================= ۴. شیشه و گرادیانت ================= */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all .3s ease;
}
.glass:hover, .glass:active {
  box-shadow: 0 0 20px rgba(168,85,247,.4), 0 0 40px rgba(56,189,248,.2);
  border-color: rgba(168,85,247,.6);
}
.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.4;
  padding-bottom: .3rem;
}

/* ================= ۵. کنترل‌ها ================= */
.floating-controls {
  position: fixed;
  top: 20px;
  inset-inline-start: 20px;
  display: flex;
  gap: 8px;
  z-index: 100;
}
.ctrl-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  transition: all .3s ease;
}
.ctrl-btn:hover { color: var(--accent); transform: rotate(20deg); }

/* ================= ۶. هدر (طراحی جدید و انیمیشن‌ها) ================= */
.header { 
  text-align: center; 
  padding: 60px 20px 30px; 
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: floatHeader 6s ease-in-out infinite;
}

.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px; /* فاصله کمتر بین لوگو و متن */
  padding: 10px 25px; /* کادر کوچک‌تر و جمع‌وجورتر شد */
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  animation: pop 1s cubic-bezier(.2,.9,.3,1.4), glowPulse 3s infinite alternate;
}

/* انیمیشن درخشش روی کادر */
.logo-wrap::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  animation: shine 4s infinite;
}

.logo-img {
  width: 42px; height: 42px; /* سایز لوگو متناسب با کادر کوچیک شد */
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(168,85,247,.6));
}
.logo-emoji {
  font-size: 38px;
  filter: drop-shadow(0 0 8px rgba(168,85,247,.6));
}

/* فونت و افکت متن اصلی */
.brand-name { 
  font-family: 'Black Future', "Vazirmatn", sans-serif; 
  font-size: 30px; 
  font-weight: 800; 
  letter-spacing: 1px; 
  background-size: 200% auto;
  animation: textShimmer 3s linear infinite;
}

/* بخش متن‌های پایین (دو زبانه) */
.brand-sub-wrap {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 0.3s;
}

.brand-sub-fa { 
  color: var(--text); 
  font-size: 20px; /* بزرگ‌تر شد */
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sub-divider {
  color: var(--accent);
  font-size: 12px;
  opacity: 0.8;
}

.brand-sub-en {
  color: var(--muted);
  font-size: 15px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.5px;
  direction: ltr;
}

/* ================= کی‌فریم‌های انیمیشن ================= */
@keyframes pop {
  from { opacity: 0; transform: scale(.7); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(168,85,247,0.1), 0 0 20px rgba(56,189,248,0.1); border-color: var(--glass-border); }
  100% { box-shadow: 0 0 25px rgba(168,85,247,0.5), 0 0 40px rgba(56,189,248,0.3); border-color: rgba(168,85,247,0.6); }
}

@keyframes shine {
  0% { left: -100%; }
  20% { left: 100%; }
  100% { left: 100%; }
}

@keyframes textShimmer {
  to { background-position: 200% center; }
}

/* ریسپانسیو برای موبایل */
@media (max-width: 500px) {
  .header { padding-top: 80px; }
  .logo-wrap { padding: 8px 20px; gap: 10px; }
  .logo-img, .logo-emoji { width: 36px; height: 36px; font-size: 32px; }
  .brand-name { font-size: 26px; }
  .brand-sub-fa { font-size: 18px; }
  .brand-sub-en { font-size: 13px; }
}

/* ================= ۷. جستجو و تب ================= */
.controls {
  max-width: 700px;
  margin: 20px auto 30px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.search-box { position: relative; }
.search-box input {
  width: 100%;
  padding-block: 16px;
  padding-inline-start: 52px;
  padding-inline-end: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: all .3s ease;
  box-shadow: var(--glass-shadow);
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(168,85,247,.4);
}
.search-box input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute;
  inset-inline-start: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tab {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all .3s ease;
}
.tab.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(124,58,237,.35);
}
.tab:hover:not(.active) { color: var(--text); border-color: var(--accent); }

/* ================= ۸. کارت‌ها و انیمیشن قوی‌تر ================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

.card {
  position: relative;
  padding: 22px 20px;
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all .3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  animation: fadeUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) both; /* انیمیشن قوی‌تر و کندتر */
}
.card:hover {
  box-shadow: 0 0 20px rgba(168,85,247,.4), 0 0 40px rgba(56,189,248,.2);
  border-color: rgba(168,85,247,.6);
  transform: translateY(-6px) scale(1.02); /* افکت هاور بهتر */
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(50px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand, var(--accent)) 18%, transparent);
  color: var(--brand, var(--accent));
  transition: transform .35s ease;
}
.card:hover .card-icon { transform: rotate(-8deg) scale(1.1); }
.card-icon svg { width: 24px; height: 24px; }

/* دکمه‌های عملیات (کپی و QR) */
.card-actions {
  display: flex;
  gap: 6px;
}
.action-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  z-index: 2;
  padding: 0;
}
.action-btn:hover {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}
.action-btn svg { width: 16px; height: 16px; }

.card-name { font-weight: 800; font-size: 16px; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.card-handle { font-size: 12px; color: var(--accent); font-weight: 600; opacity: .9; text-align: start; }
.card-handle span { direction: ltr; display: inline-block; unicode-bidi: isolate; }

.badge {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  z-index: 2;
}

/* ================= ۹. فوتر و توست ================= */
.footer {
  text-align: center;
  padding: 30px 20px 60px;
  color: var(--muted);
  font-size: 15px; /* فونت بزرگتر شد */
  font-weight: 500;
}
.footer .heart { color: var(--accent); }

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: var(--gradient);
  color: #fff;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 15px 40px rgba(124,58,237,.4);
  transition: transform .4s cubic-bezier(.2,.9,.3,1.4);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ================= ۱۰. مودال QR کد ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: var(--bg-1);
  padding: 30px;
  border-radius: var(--radius);
  position: relative;
  text-align: center;
  transform: scale(0.9);
  transition: all 0.3s cubic-bezier(.2,.9,.3,1.2);
  max-width: 90vw;
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}
.close-btn {
  position: absolute;
  top: 10px;
  inset-inline-end: 15px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.qr-wrapper {
  background: #fff; /* بکگراند سفید برای خوانایی بهتر QR در تم تاریک */
  padding: 15px;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 15px;
}
.qr-wrapper img {
  width: 200px;
  height: 200px;
  display: block;
}
.qr-link {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  max-width: 250px;
  margin: 0 auto;
}

/* ================= ۱۱. ریسپانسیو ================= */
@media (max-width: 500px) {
  .header { padding-top: 90px; }
  .brand-name { font-size: 26px; }
  .logo-wrap { padding: 14px 24px; gap: 12px; }
  .logo-img, .logo-emoji { width: 45px; height: 45px; font-size: 38px; }
  .brand-sub { font-size: 14px; }
  .grid { grid-template-columns: 1fr; }
}
