/* ============ CYBERPUNK TERMINAL CHAT ============
   راهنما: پنجره‌ی گفتگو/چتِ سبکِ ترمینال که با دکمه‌ی «گفتگو» باز می‌شه.
   - max-width/height در .cyber-terminal-box → اندازه‌ی کلیِ پنجره‌ی چت
   - background/border در .cyber-terminal-box → رنگِ پس‌زمینه و کادرِ قرمزِ دورش
   ============ */
.cyber-terminal-overlay {
  position: fixed; 
  top: 0; left: 0; right: 0; bottom: 0;
  height: 100%; 
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(10px); z-index: 100000;
}
@media (max-width:768px){
  .cyber-terminal-overlay{ backdrop-filter: blur(4px); }
}
.cyber-terminal-overlay{
  display: flex; align-items: flex-start; justify-content: center; 
  padding-top: 12vh; 
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.cyber-terminal-overlay.show { opacity: 1; pointer-events: auto; }

.cyber-terminal-box {
  width: 90vw; max-width: 480px; 
  height: 480px; 
  max-height: calc(100% - 40px); 
  background: #050506; border: 2px solid var(--acid);
  box-shadow: 0 0 30px rgba(var(--acid-rgb), 0.25), inset 0 0 20px rgba(var(--acid-rgb), 0.08);
  display: flex; flex-direction: column; 
  position: relative; overflow: hidden;
  border-radius: var(--radius);
}

.cyber-terminal-box::before {
  content: " "; position: absolute; inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%);
  background-size: 100% 4px; pointer-events: none; z-index: 10;
}

#webAppModal .cyber-terminal-box::before {
  display: none !important;
}

/* حذف افکت خط‌خطیِ اسکن‌لاین فقط برای مودال راهنمای نصب */
#installGuideModal .cyber-terminal-box::before {
  display: none !important;
}

/* ============ STYLISH ONYX BLACK THEME FOR SUNLIGHT MODAL ============
   راهنما: تمِ رنگیِ مخصوصِ پنجره‌ی «webAppModal» (نمایشِ اپ‌های داخلِ سایت) —
   یک نسخه‌ی جداگانه و تیره‌تر از رنگ‌های پنجره‌ی چتِ بالا.
   - background در #webAppModal .cyber-terminal-box → رنگِ پس‌زمینه (#09090b)
   - background در #webAppModal .terminal-header → رنگِ نوارِ بالای پنجره
   ============ */
#webAppModal .cyber-terminal-box {
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: #09090b !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(0, 0, 0, 0.8) !important;
  border-radius: 8px;
}

#webAppModal .terminal-header {
  background: #121215 !important;
  color: #f4f4f5 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#webAppModal .terminal-header button {
  color: #a1a1aa !important;
}
#webAppModal .terminal-header button:hover {
  color: #ffffff !important;
}

/* ============ AGE RESULT DETAIL MODAL ============
   راهنما: پنجره‌ی نمایشِ نتیجه‌ی «محاسبه‌گرِ سن».
   - max-width در .age-modal-box → عرضِ بیشینه‌ی پنجره
   - background در .age-modal-box → رنگِ پس‌زمینه‌ی پنجره (#0f0f10)
   - font-size در .age-modal-headline → اندازه‌ی عنوانِ اصلیِ نتیجه
   - color در .age-modal-row.highlight → رنگِ ردیف‌های برجسته (var(--acid))
   ============ */
#ageResultModal { align-items: center; padding-top: 1.5vh; padding-bottom: 1.5vh; }
.age-modal-box {
  width: 92vw;
  max-width: 440px;
  height: auto;
  max-height: 97vh;
  background: #0f0f10;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
  transform: scale(0.9) translateY(14px);
  opacity: 0;
}
#ageResultModal.show .age-modal-box,
#installGuideModal.show .age-modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.cyber-terminal-box.age-modal-box {
  height: auto;
}
.age-modal-box .terminal-header {
  font-family: 'Space Mono', sans-serif;
  padding: 6px 14px;
}
.age-modal-box .terminal-header.age-modal-header {
  justify-content: flex-end;
}
.age-modal-body {
  padding: 18px 16px 10px;
  overflow-y: auto;
  direction: rtl;
}
body.lang-en .age-modal-body { direction: ltr; }
.age-modal-body::-webkit-scrollbar { width: 4px; }
.age-modal-body::-webkit-scrollbar-thumb { background: var(--acid); }

.age-modal-headline {
  text-align: center;
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.3;
  color: var(--ink);
  padding-bottom: 7px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.age-modal-equiv {
  text-align: center;
  font-family: 'Space Mono', 'Vazirmatn', sans-serif;
  font-size: 14px;
  color: var(--grey);
  margin-bottom: 2px;
  letter-spacing: 0.2px;
  line-height: 1.3;
}
.age-modal-equiv b { color: var(--ink); font-weight: 700; }

.age-modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
}
.age-modal-divider::before,
.age-modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.age-modal-divider span {
  font-size: 14px;
  font-weight: 700;
  color: var(--acid);
  white-space: nowrap;
  font-family: 'Vazirmatn', sans-serif;
}

.age-modal-row {
  text-align: center;
  font-size: 14.5px;
  color: var(--ink);
  padding: 5px 2px;
  border-bottom: 1px dashed var(--line);
  line-height: 1.35;
}
.age-modal-row:last-child { border-bottom: none; }
.age-modal-row.dim { color: var(--grey); font-size: 13px; }
.age-modal-row.ltr-force { direction: ltr; font-family: 'Space Mono', sans-serif; letter-spacing: 0.2px; }
.age-modal-row.highlight {
  color: var(--acid);
  font-weight: 700;
}
.age-modal-row.birthday-today {
  color: var(--acid);
  font-weight: 800;
  font-size: 15px;
}
@media (max-height: 700px) {
  .age-modal-headline { font-size: 16px; padding-bottom: 5px; margin-bottom: 4px; }
  .age-modal-row { padding: 4px 2px; font-size: 13px; }
  .age-modal-row.dim { font-size: 11.5px; }
  .age-modal-equiv { font-size: 12px; }
  .age-modal-divider { margin: 6px 0 3px; }
}

/* ============ INSTALL GUIDE MODAL (راهنمای نصب پی‌دبلیوای) ============
   راهنما: پنجره‌ای که با زدنِ دکمه‌ی «نصب» روی کارتِ پروژه‌ی تومان باز می‌شود
   و تصویرِ راهنمای نصب را نشان می‌دهد.
   - color در .btn-install-app → رنگِ متنِ دکمه‌ی «نصب» روی کارتِ پروژه
   - max-width در .install-guide-box → عرضِ بیشینه‌ی پنجره (برای جا شدنِ بهترِ تصویرِ عریض)
   - border در .install-guide-image → کادرِ دورِ تصویرِ راهنما
   - background در .install-guide-cta → رنگِ دکمه‌ی نهاییِ «اتصال به سایت»
   ============ */
.btn-install-app {
  background: rgba(var(--acid-rgb), 0.1) !important;
  color: var(--acid) !important;
  border: 1px solid rgba(var(--acid-rgb), 0.4) !important;
  box-shadow: none !important;
}
.btn-install-app:hover {
  background: var(--acid) !important;
  color: #ffffff !important;
  border-color: var(--acid) !important;
}

.install-guide-box {
  max-width: 640px;
}

.install-guide-title {
  text-align: center;
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  padding-bottom: 9px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.install-guide-image-link {
  display: block;
  margin-bottom: 6px;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
}

/* تصویرِ راهنما شاملِ ۳ قابِ مربعی‌شکلِ کنارِ‌هم است.
   عکس داخلِ قابِ مربعیِ مودال، به‌آرامی از وسط به راست پن می‌شود،
   سپس محو شده و از ابتدا (سمت چپ) تا انتها (سمت راست) دوباره پن می‌شود.
   انیمیشنِ پن، فقط بعد از لود کاملِ عکس (کلاسِ is-loaded) شروع می‌شود. */
.install-guide-image {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 300%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  opacity: 0;
  transition: opacity 0.35s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.install-guide-image-link.is-loaded .install-guide-image {
  opacity: 1;
  animation: installGuidePan 19.2s linear infinite;
}

@keyframes installGuidePan {
  0%     { transform: translate3d(0%, 0, 0);       opacity: 1; animation-timing-function: ease-out; }
  46.9%  { transform: translate3d(-33.333%, 0, 0); opacity: 1; animation-timing-function: ease-in-out; }
  78.1%  { transform: translate3d(-66.666%, 0, 0); opacity: 1; }
  88.5%  { transform: translate3d(-66.666%, 0, 0); opacity: 1; animation-timing-function: ease; }
  93.8%  { transform: translate3d(-66.666%, 0, 0); opacity: 0; }
  94.8%  { transform: translate3d(0%, 0, 0);       opacity: 0; animation-timing-function: ease; }
  100%   { transform: translate3d(0%, 0, 0);       opacity: 1; }
}

/* اسپینرِ لودینگ که تا قبل از بارگذاریِ کاملِ عکس نمایش داده می‌شود */
.install-guide-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 3px solid rgba(237, 234, 228, 0.15);
  border-top-color: var(--acid);
  animation: installGuideSpin 0.8s linear infinite;
  z-index: 1;
}

.install-guide-image-link.is-loaded .install-guide-spinner {
  display: none;
}

@keyframes installGuideSpin {
  to { transform: rotate(360deg); }
}

.install-guide-zoom-hint {
  font-size: 11px;
  color: var(--grey);
  text-align: center;
  margin-bottom: 14px;
}

.install-guide-note {
  font-size: 12.5px;
  color: var(--grey);
  line-height: 1.6;
  text-align: center;
  margin-bottom: 14px;
}

.install-guide-cta {
  display: flex !important;
  width: 100%;
  justify-content: center;
  font-size: 13.5px !important;
  padding: 11px 12px !important;
}

.terminal-header {
  background: var(--acid); color: var(--bone); padding: 8px 15px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Space Mono', sans-serif; font-weight: bold; font-size: 12px; 
  letter-spacing: 1px; direction: ltr; z-index: 2;
}
.terminal-header button {
  color: var(--bone); font-weight: bold; font-size: 14px; transition: transform 0.2s;
}
.terminal-header button:hover { transform: scale(1.2); }

.terminal-body {
  flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; 
  direction: rtl; font-size: 13px; z-index: 2; scroll-behavior: smooth;
}
.terminal-body::-webkit-scrollbar { width: 4px; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--acid); }

.msg {
  max-width: 85%; padding: 6px 12px; border-radius: 2px;
  word-break: break-word; line-height: 1.4; position: relative;
}

.check-item {
  display: block; 
  margin-top: 2px;
  font-family: 'Space Mono', 'Vazirmatn', sans-serif;
}
.text-green { color: #4ade80; text-shadow: 0 0 5px rgba(74, 222, 128, 0.2); }
.text-red { color: var(--acid); text-shadow: 0 0 5px rgba(var(--acid-rgb), 0.3); font-weight: bold; }

.msg.user {
  align-self: flex-start; text-align: right;
  background: rgba(237, 234, 228, 0.05); color: var(--ink);
  border-right: 3px solid var(--grey);
}

.msg.system {
  align-self: flex-end; text-align: left; direction: ltr;
  background: rgba(var(--acid-rgb), 0.07); color: var(--acid);
  border-left: 3px solid var(--acid);
  font-family: 'Space Mono', 'Vazirmatn', sans-serif;
  white-space: pre-line;
}
.sys-label { display: block; font-size: 10px; color: var(--acid); margin-bottom: 5px; opacity: 0.8; }

.terminal-footer {
  border-top: 1px solid rgba(var(--acid-rgb), 0.4); 
  display: flex; 
  align-items: center;
  gap: 8px;
  padding: 10px 12px; 
  background: #0A0A0B; 
  z-index: 2; 
  direction: ltr;
  box-sizing: border-box;
}

.prompt-icon { 
  display: flex; 
  align-items: center; 
  gap: 5px; 
  flex-shrink: 0;
  direction: ltr;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.2; 
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

.status-dot.green { background-color: #4ade80; }
.status-dot.orange { background-color: #fb923c; }
.status-dot.red { background-color: var(--acid); }

@keyframes orangePulse {
  0%, 100% { opacity: 0.2; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 12px #fb923c; }
}

.status-dot.orange.orange-active {
  animation: orangePulse 1s infinite ease-in-out;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 0.2; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 12px var(--acid); }
}

.status-dot.red.offline-active {
  animation: offlinePulse 1.5s infinite ease-in-out;
}

.terminal-footer input {
  flex: 1; 
  min-width: 0;
  background: transparent; 
  border: none; 
  color: var(--ink);
  font-family: 'Vazirmatn', sans-serif; 
  font-size: 16px !important;
  outline: none; 
  direction: rtl;
}
.terminal-footer input::placeholder { color: rgba(237, 234, 228, 0.3); font-size: 13px; }
.terminal-footer button {
  color: var(--acid); 
  font-family: 'Space Mono', sans-serif; 
  font-weight: bold; 
  padding: 6px 10px; 
  border: 1px solid var(--acid); 
  background: rgba(var(--acid-rgb), 0.1); 
  transition: 0.3s;
  flex-shrink: 0;
  white-space: nowrap;
  cursor: pointer;
}
.terminal-footer button:hover { background: var(--acid); color: var(--bone); }

.terminal-footer .terminal-retry-btn {
  width: 16px;
  height: 16px;
  border: 1.2px solid var(--acid);
  border-radius: 50%;
  background: transparent;
  color: var(--acid);
  font-size: 10px;
  line-height: 1;
  padding: 0;
  margin-left: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, color 0.3s ease;
}
.terminal-footer .terminal-retry-btn:hover { background: var(--acid); color: var(--bone); transform: rotate(-180deg); }

.typing-indicator { display: inline-flex; gap: 4px; padding: 5px 0; }
.typing-indicator span { width: 6px; height: 6px; background: var(--acid); animation: typeBlink 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typeBlink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

/* ============ GALLERY LOADER & ANIMATION STYLES ============
   راهنما: چرخِ لودینگ و افکتِ تعویضِ عکس‌ها در گالریِ داخلِ webAppModal.
   - width/height در .gallery-spinner-circle → اندازه‌ی چرخِ لودینگ
   - border-top در .gallery-spinner-circle → رنگِ بخشِ درحال‌چرخِ دایره (var(--acid))
   - font-size در .gallery-spinner-text → اندازه‌ی متنِ زیرِ چرخِ لودینگ
   ============ */
.gallery-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  pointer-events: none;
  background: rgba(9, 9, 11, 0.85);
  padding: 20px 30px;
  border-radius: 8px;
  border: 1px solid rgba(var(--acid-rgb), 0.3);
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}
.gallery-spinner-circle {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(237, 234, 228, 0.15);
  border-top: 3px solid var(--acid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.gallery-spinner-text {
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#webAppImage {
  transition: opacity 0.25s ease;
}
#webAppImage.fade-next {
  animation: galleryFadeNext 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
#webAppImage.fade-prev {
  animation: galleryFadePrev 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes galleryFadeNext {
  0% { opacity: 0; transform: translateX(-35px) scale(0.96); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes galleryFadePrev {
  0% { opacity: 0; transform: translateX(35px) scale(0.96); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ============ RESPONSIVE ============
   راهنما: تنظیماتِ اختصاصیِ حالتِ موبایل/تبلت (اندازه‌ها فقط زیرِ این عرض‌ها
   اعمال می‌شن؛ اگه اندازه‌ای رو فقط برای موبایل می‌خوای عوض کنی، همینجاست).
   - @media (max-width:1000px) → تبلت: نمایشِ منوی موبایل، اندازه‌ی لوگو
   - @media (max-width:560px)  → موبایل: تعدادِ ستون‌های گرید و ارتفاعِ چت
   - @media (max-width:480px)  → موبایلِ کوچک: اندازه‌ی آیکون‌های اجتماعی
   ============ */
body.lang-en .terminal-footer input {
  direction: ltr;
  text-align: left;
}

@media (max-width:1000px){
  .desktop-nav { display: none; }
  .mobile-nav { display: flex; }
  .nav { padding: 16px 20px; }
  .logo { font-size: 24px; gap: 8px; }
  .drops{grid-template-columns:repeat(2,1fr);}
  .drops .drop-card{ grid-column: span 1; }
  .drops .drop-card:nth-child(4){ grid-column: span 1; }
  .drops .drop-card:nth-child(5){ grid-column: 1 / -1; }
  .grid{grid-template-columns:repeat(2,1fr);}
  .foot-top{grid-template-columns:1fr 1fr; row-gap:36px;}
}
@media (max-width:560px){
  .grid{grid-template-columns:1fr 1fr; gap:16px 12px;}
  .drops{grid-template-columns:1fr;}
  .drops .drop-card,
  .drops .drop-card:nth-child(4),
  .drops .drop-card:nth-child(5){ grid-column: auto; }
  .foot-top{grid-template-columns:1fr;}
  
  .cyber-terminal-overlay { padding-top: 5vh; }
  .cyber-terminal-box { height: 380px; }
}
@media (max-width: 480px) {
  .hero-social-links { gap: 16px; }
  .social-icon-btn { width: 48px; height: 48px; }
  .social-icon-btn svg { width: 23px; height: 23px; }
}
