:root {
  --bg: #eef2f7;
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: rgba(255, 255, 255, 0.78);
  --surface-soft: rgba(248, 251, 253, 0.68);
  --line: rgba(33, 150, 243, 0.28);
  --text: #333333;
  --muted: #6b7280;
  --primary: #2196f3;
  --primary-dark: #1976d2;
  --primary-light: rgba(227, 242, 253, 0.82);
  --primary-border: #90caf9;
  --glass-bg: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.62),
      rgba(227, 242, 253, 0.38)
    ),
    radial-gradient(circle at 15% 20%, rgba(33, 150, 243, 0.24), transparent 35%),
    radial-gradient(circle at 85% 28%, rgba(38, 166, 154, 0.16), transparent 34%),
    radial-gradient(circle at 50% 105%, rgba(25, 118, 210, 0.14), transparent 42%);
  --glass-border: rgba(33, 150, 243, 0.32);
  --glass-shadow: 0 18px 45px rgba(25, 118, 210, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(33, 150, 243, 0.08);
  --glass-blur: blur(26px) saturate(170%);
  --max-width: 1320px;
  --dock-h: 76px;
}

/* Fonts */
@font-face {
  font-family: "Samim";
  src: url("./fonts/Samim/Samim-FD.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Estedad";
  src: url("./fonts/Estedad/Estedad-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Estedad";
  src: url("./fonts/Estedad/Estedad-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Base */
* {
  box-sizing: border-box;
}

html {
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
  padding: 0 1% calc(var(--dock-h) + 26px);
  color: var(--text);
  font-family: "Estedad", "Samim", Tahoma, sans-serif;

  background-color: #f3f7fc;
  background-image:
    radial-gradient(circle at 15% 18%, rgba(33, 150, 243, 0.16), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(38, 166, 154, 0.10), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(25, 118, 210, 0.10), transparent 38%),
    repeating-linear-gradient(
      45deg,
      rgba(25, 118, 210, 0.10) 0px,
      rgba(25, 118, 210, 0.10) 1px,
      transparent 1px,
      transparent 22px
    ),
    repeating-linear-gradient(
      135deg,
      rgba(25, 118, 210, 0.10) 0px,
      rgba(25, 118, 210, 0.10) 1px,
      transparent 1px,
      transparent 22px
    ),
    linear-gradient(135deg, #f8fbff 0%, #e7f0fb 45%, #f3f7fc 100%);

  background-size:
    100% 100%,
    100% 100%,
    100% 100%,
    32px 32px,
    32px 32px,
    100% 100%;

  background-position: center;
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.bs-btn,
.bs-nav a,
h1,
h2,
h3,
h4 {
  font-family: "Estedad", Tahoma, sans-serif;
}

button {
  border: none;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
}

/* Layout */
.bs-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.bs-main {
  min-height: 30vh;
  padding-top: 13px;
  color: var(--text);
}

/* Glass Common */
.bs-glass,
.bs-header,
.bs-footer-card,
.bs-nav-bottom .bs-header {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Header / Navbar */
.bs-header-wrap {
  position: sticky;
  top: 5px;
  z-index: 1000;
  padding-top: 5px;
}

.bs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 34px;
}

.bs-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.bs-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.bs-nav a {
  color: #4b5563;
  padding: 6px 10px;
  border-radius: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: 0.2s;
}

.bs-nav a:hover,
.bs-nav a.bs-active {
  color: var(--primary-dark);
  background: rgba(227, 242, 253, 0.72);
}

/* Buttons */
.bs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 20px;
  font-weight: 700;
  transition: 0.2s;
  white-space: nowrap;
}

.bs-btn-primary {
  color: #fff;
  background: var(--primary);
}

.bs-btn-secondary {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--primary-border);
}

/* Footer */
.bs-footer {
  padding: 42px 0 12px;
  color: var(--text);
}

.ejadepanel {
  background: #ffffff;
  border: #1976d2 3px solid;
  border-radius: 50%;
  color: #ffffff;
}

.bs-footer-card {
  border-radius: 34px;
  padding: 28px;
}

/* فوتر ۵ ستونه - ستون اول عریض‌تر */
.bs-footer-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.bs-footer h4 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  color: var(--primary-dark);
}

.bs-footer p,
.bs-footer li,
.bs-footer a {
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.94rem;
}

.bs-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

/* Licenses */
.bs-licenses {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-top: 18px;
}

/*
  این بخش مشکل اصلی را حل می‌کند.
  هر چیزی که از طرف اینماد، زرین‌پال یا مجوزهای دیگر داخل کادر تولید شود،
  محدود و مرتب داخل همین کادر نمایش داده می‌شود.
*/
.bs-license {
  width: 96px;
  min-width: 96px;
  height: 82px;
  border-radius: 18px;
  border: 1px dashed var(--primary-border);
  background: rgba(255, 255, 255, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
  padding: 8px;
  overflow: hidden;
  position: relative;
  color: var(--muted);
}

/* wrapper داخلی برای scriptها */
.bs-license-inner {
  width: 100%;
  height: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

/* همه عناصر تولیدشده توسط scriptهای مجوزها */
.bs-license *,
.bs-license-inner * {
  box-sizing: border-box !important;
}

/* لینک‌های تولیدشده توسط اینماد/زرین‌پال */
.bs-license a,
.bs-license-inner a {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  text-decoration: none !important;
  overflow: hidden !important;
  line-height: 1 !important;
}

/* عکس لوگوی مجوزها */
.bs-license img,
.bs-license-inner img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
}

/* اگر سرویس مجوز iframe تولید کند */
.bs-license iframe,
.bs-license-inner iframe {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* div/span/table تولیدشده توسط اسکریپت‌های مجوز */
.bs-license div,
.bs-license span,
.bs-license table,
.bs-license tbody,
.bs-license tr,
.bs-license td,
.bs-license-inner div,
.bs-license-inner span,
.bs-license-inner table,
.bs-license-inner tbody,
.bs-license-inner tr,
.bs-license-inner td {
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
  vertical-align: middle !important;
}

/* برای متن‌های جایگزین مثل جای اینماد */
.bs-license-placeholder {
  line-height: 1.6;
  font-weight: 700;
}

/* اگر لوگوی زرین‌پال کمی بزرگ بود، این کلاس کمک می‌کند */
.bs-license-zarinpal {
  padding: 7px;
}

/* Copy */
.bs-copy {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(144, 202, 249, 0.38);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bs-under-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 16px 0 6px;
  margin-bottom: 80px;
}

/* Bottom Nav */
.bs-nav-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 1100;
  width: 98%;
  margin: 0 auto;
}

.bs-today-date {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--primary-border);
  padding: 10px 14px;
  border-radius: 34px;
  font-size: 0.88rem;
}

/* Responsive Logic */

/* تبلت: ۲ ستونه */
@media (max-width: 1180px) {
  .bs-footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px;
  }
}

/* موبایل: ۱ ستونه */
@media (max-width: 850px) {
  .bs-footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .bs-licenses {
    justify-content: center;
  }

  .bs-header {
    padding: 5px 9px;
  }
}

/* موبایل: کوچک‌سازی هدر، نوار پایین و فوتر */
@media (max-width: 576px) {
  :root {
    --dock-h: 52px;
  }

  /* Header Mobile */
  .bs-header-wrap {
    top: 2px;
    padding-top: 2px;
  }

  .bs-header {
    padding: 2px 4px;
    gap: 3px;
    border-radius: 14px;
  }

  .bs-brand-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 0.62rem;
  }

  .bs-nav {
    gap: 2px;
  }

  .bs-nav a {
    padding: 2px 5px;
    font-size: 0.64rem;
    border-radius: 10px;
    white-space: nowrap;
  }

  .bs-header-actions {
    display: flex;
    align-items: center;
    gap: 3px;
  }

  .bs-btn {
    padding: 3px 6px;
    font-size: 0.62rem;
    border-radius: 10px;
    gap: 2px;
    white-space: nowrap;
  }

  /* Bottom Nav Mobile */
  .bs-nav-bottom {
    bottom: 5px;
    width: 96%;
  }

  .bs-nav-bottom .bs-header {
    padding: 3px 5px;
    gap: 3px;
    border-radius: 14px;
  }

  .bs-nav-bottom .bs-nav {
    gap: 1px;
  }

  .bs-nav-bottom .bs-nav a {
    padding: 2px 4px;
    font-size: 0.62rem;
    border-radius: 9px;
  }

  .bs-nav-bottom .bs-icon {
    font-size: 0.68rem;
  }

  .bs-today-date {
    padding: 3px 6px;
    font-size: 0.58rem;
    border-radius: 10px;
    white-space: nowrap;
  }

  /* Footer Mobile */
  .bs-footer {
    padding: 20px 0 6px;
  }

  .bs-footer-card {
    padding: 12px 10px;
    border-radius: 16px;
  }

  .bs-footer-grid {
    gap: 14px !important;
  }

  .bs-footer h4 {
    margin: 0 0 6px;
    font-size: 0.76rem;
  }

  .bs-footer p,
  .bs-footer li,
  .bs-footer a {
    font-size: 0.66rem;
    line-height: 1.45;
  }

  .bs-footer ul {
    gap: 4px;
  }

  .bs-licenses {
    gap: 7px;
    margin-top: 10px;
    justify-content: center;
  }

  .bs-license {
    width: 72px;
    min-width: 72px;
    height: 58px;
    border-radius: 12px;
    font-size: 0.56rem;
    padding: 5px;
  }

  .bs-license-zarinpal {
    padding: 4px;
  }

  .bs-copy {
    margin-top: 10px;
    padding-top: 10px;
    gap: 6px;
    font-size: 0.62rem;
    justify-content: center;
    text-align: center;
  }

  .bs-under-footer {
    font-size: 0.62rem;
    padding: 8px 0 4px;
    margin-bottom: 58px;
  }
}
