/* ============================================================
   اشتراک صفحه — تم مشکی + طلایی شیشه‌ای (Glassmorphism)
   فقط دیزاین؛ هیچ تغییری در منطق برنامه نیست
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --gold: #fbbf24;
  --gold-2: #d97706;
  --gold-3: #fcd34d;
  --gold-soft: #fde68a;
  --bg: #050505;
  --text: #f2f0e9;
  --muted: #9a937f;
  --glass: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.09);
  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;
}

html,
body {
  min-height: 100vh;
}

body {
  background-color: var(--bg);
  /* بک‌گراند چهارخانه — سلول‌های ریز + خطوط درشت طلایی محو */
  background-image:
    linear-gradient(rgba(251, 191, 36, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 191, 36, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(251, 191, 36, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 191, 36, 0.09) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px, 240px 240px, 240px 240px;
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
}

/* هاله‌های نرم طلایی دور صفحه */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}

body::before {
  width: 520px;
  height: 520px;
  background: rgba(217, 119, 6, 0.16);
  top: -160px;
  right: -140px;
}

body::after {
  width: 460px;
  height: 460px;
  background: rgba(251, 191, 36, 0.06);
  bottom: -160px;
  left: -140px;
}

::selection {
  background: rgba(251, 191, 36, 0.3);
}

/* ================= کارت شیشه‌ای ================= */

.wrap {
  max-width: 580px;
  margin: 6vh auto 0;
  padding: 44px 36px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: fadeInUp 0.5s ease both;
}

/* ================= لوگو ================= */

.logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 10px 22px rgba(217, 119, 6, 0.5));
  animation: floatY 4s ease-in-out infinite;
}

/* ================= تیترها ================= */

h1 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

h2 {
  font-size: 23px;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.sub {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.9;
}

.sub b {
  color: var(--gold-3);
  font-weight: 700;
}

/* ================= فرم ================= */

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="text"]::placeholder {
  color: rgba(154, 147, 127, 0.7);
}

input[type="text"]:focus {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
  background: rgba(255, 255, 255, 0.07);
}

.check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #cfc7b4;
  cursor: pointer;
  font-size: 14.5px;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

/* ================= دکمه‌ها — طلایی، باریک و شیک ================= */

button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #241503;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow:
    0 6px 18px rgba(217, 119, 6, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow:
    0 10px 26px rgba(217, 119, 6, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

button:active {
  transform: translateY(0) scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

button.big {
  padding: 12px 28px;
  font-size: 16px;
  border-radius: 14px;
}

button.ghost {
  background: rgba(251, 191, 36, 0.06);
  color: var(--gold-3);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: none;
}

button.ghost:hover {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.25);
}

button.active {
  background: linear-gradient(135deg, #f87171, #dc2626);
  border-color: rgba(248, 113, 113, 0.4);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}

button.active:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.5);
}

/* بازخورد کپی موفق */
button.copied {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 6px 18px rgba(52, 211, 153, 0.45);
  transform: scale(1.04);
}

a {
  text-decoration: none;
}

/* آیکون داخل دکمه */
.bi {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

button.big .bi {
  width: 20px;
  height: 20px;
}

/* ================= راهنما و نتیجه ================= */

.hint {
  color: rgba(154, 147, 127, 0.8);
  font-size: 13px;
  margin-top: 16px;
  line-height: 1.9;
}

#result {
  margin-top: 28px;
  animation: fadeInUp 0.45s ease both;
}

.linkbox {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.linkbox input {
  flex: 1;
  direction: ltr;
  text-align: left;
}

.linkbox.small {
  margin-top: 0;
}

.linkbox.small input {
  padding: 9px 12px;
  font-size: 13px;
}

.linkbox.small button {
  padding: 9px 14px;
  font-size: 13px;
}

.linkbox.small .bi {
  width: 15px;
  height: 15px;
}

/* ================= دروازه ورود به جلسه ================= */

#gate {
  max-width: 460px;
  margin: 12vh auto 0;
  text-align: center;
  padding: 40px 32px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: fadeInUp 0.5s ease both;
}

#gate input {
  margin-bottom: 16px;
}

#gate .sub {
  margin-bottom: 20px;
}

/* ================= هدر جلسه — نوار شیشه‌ای ================= */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 20;
}

header .home {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

header .home:hover {
  color: var(--gold-3);
}

header .title {
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ================= کنترل‌ها و وضعیت ================= */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 20px 4px;
}

/* راهنمای شیر با صدا */
.shareHint {
  text-align: center;
  color: rgba(154, 147, 127, 0.75);
  font-size: 12px;
  margin: 2px 20px 12px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* دکمه‌ی قطع/وصل صدای هر شیر (روی قاب، گوشه‌ی پایین) */
.muteBtn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.65);
  color: var(--gold-3);
  border: 1px solid rgba(251, 191, 36, 0.35);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.muteBtn svg {
  width: 16px;
  height: 16px;
}

.muteBtn:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.75);
}

.muteBtn.off {
  color: rgba(154, 147, 127, 0.75);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(10, 10, 10, 0.75);
}

.muteBtn.off svg {
  stroke: #f87171;
}

/* دکمه‌ی «برای شنیدن صدا کلیک کن» روی قاب شیرِ بی‌صدا */
.soundBtn {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(10, 10, 10, 0.75);
  color: var(--gold-3);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12.5px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.soundBtn:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.8);
}

/* ================= لیست کاربران ================= */

.usersWrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 20px 14px;
  min-height: 20px;
}

.userChip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 5px 14px 5px 8px;
  border-radius: 999px;
  font-size: 13.5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  animation: popIn 0.35s ease both;
}

.userChip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.userChip .avatar.a1 { background: linear-gradient(135deg, #fcd34d, #d97706); }
.userChip .avatar.a2 { background: linear-gradient(135deg, #fbbf24, #b45309); }
.userChip .avatar.a3 { background: linear-gradient(135deg, #fb923c, #ea580c); }
.userChip .avatar.a4 { background: linear-gradient(135deg, #f472b6, #db2777); }
.userChip .avatar.a5 { background: linear-gradient(135deg, #34d399, #059669); }
.userChip .avatar.a6 { background: linear-gradient(135deg, #22d3ee, #0891b2); }

.userChip.me {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.1);
  box-shadow: 0 4px 18px rgba(251, 191, 36, 0.2);
}

.userChip.me .avatar {
  background: linear-gradient(135deg, #fde68a, #d97706);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.userChip .badge {
  font-size: 11px;
  color: var(--gold-3);
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* ================= ویدیوها ================= */

#videoGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.emptyNote {
  grid-column: 1 / -1;
  color: rgba(154, 147, 127, 0.8);
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

/* قاب تصویر — چهارخونه (شبکه) داخل قاب + گوشه‌های دوربینی مثل حفاظ */
.videoBox {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(10, 10, 10, 0.9);
  background-image:
    linear-gradient(rgba(251, 191, 36, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 191, 36, 0.09) 1px, transparent 1px);
  background-size: 32px 32px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 18px;
  padding: 4px; /* بند شبکه (شیارهای قاب) دور تصویر — نازک، تا تصویر بزرگ‌تر دیده بشه */
  overflow: hidden;
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeInUp 0.4s ease both;
}

.videoBox video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: contain;
  background: transparent; /* شبکه چهارخونه از پشت تصویر دیده بشه */
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* چهار گوشه‌ی دوربینی (چهارخونه) — مثل کادر حفاظ */
.videoBox::after {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(#ffd54a, #ffd54a) 0 0 / 28px 3px,
    linear-gradient(#ffd54a, #ffd54a) 0 0 / 3px 28px,
    linear-gradient(#ffd54a, #ffd54a) 100% 0 / 28px 3px,
    linear-gradient(#ffd54a, #ffd54a) 100% 0 / 3px 28px,
    linear-gradient(#ffd54a, #ffd54a) 0 100% / 28px 3px,
    linear-gradient(#ffd54a, #ffd54a) 0 100% / 3px 28px,
    linear-gradient(#ffd54a, #ffd54a) 100% 100% / 28px 3px,
    linear-gradient(#ffd54a, #ffd54a) 100% 100% / 3px 28px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.75));
}

.videoLabel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--gold-3);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.videoLabel::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
  animation: pulse 1.6s infinite;
}

/* ================= نوار شیرها (لیست استریم‌ها) ================= */

#shareBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 20px 14px;
}

.shareTabsWrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.shareTitle {
  font-size: 12.5px;
  color: var(--muted);
}

.shareTab {
  background: rgba(251, 191, 36, 0.08);
  color: var(--gold-3);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
}

.shareTab:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
}

.shareTab.on {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #241503;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.4);
}

/* حالت نمایش تکی (فوکوس روی یک شیر) */
.videoBox.focused {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 900px;
}

.videoBox.dimmed {
  display: none;
}

.hidden {
  display: none !important;
}

/* ================= اعلان‌ها (توست با افکت) ================= */

#toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(16, 16, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  color: var(--text);
  animation: toastIn 0.45s cubic-bezier(0.21, 1.02, 0.73, 1) both;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.toast.leaving {
  animation: toastOut 0.3s ease both;
}

.toast .ticon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.ok .ticon { color: var(--ok); }
.toast.err .ticon { color: var(--err); }
.toast.info .ticon { color: var(--gold); }

.toast .bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  transform-origin: left;
  animation: toastBar var(--dur, 3s) linear both;
}

.toast.ok .bar { background: linear-gradient(90deg, var(--ok), transparent); }
.toast.err .bar { background: linear-gradient(90deg, var(--err), transparent); }
.toast.info .bar { background: linear-gradient(90deg, var(--gold), transparent); }

/* ================= انیمیشن‌ها ================= */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-26px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-18px) scale(0.95); }
}

@keyframes toastBar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ================= موبایل و دسترس‌پذیری ================= */

@media (max-width: 520px) {
  .wrap,
  #gate {
    padding: 32px 20px;
  }

  header {
    padding: 10px 14px;
  }

  .videoBox video {
    aspect-ratio: 4 / 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
