/* ═══════════════════════════════════════════
   MindLead — Base Styles
   ═══════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-fa);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Screens ─── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* ─── Loading Screen ─── */
#loading-screen {
  background: radial-gradient(circle at 50% 40%, #1a2540 0%, var(--bg-base) 70%);
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  padding: 24px;
}

.logo-pulse {
  font-size: 80px;
  margin-bottom: 24px;
  animation: pulse 2s var(--ease-in-out) infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.85; }
}

.brand-title {
  font-family: var(--font-en);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.brand-tagline {
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--text-tertiary);
  margin-bottom: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── App Header ─── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 10;
}

.app-header.hidden { display: none; }

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.icon-btn:hover,
.icon-btn:active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.icon-btn.hidden { visibility: hidden; }

/* ─── Page Container ─── */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* ─── Page (generic) ─── */
.page {
  animation: fadeIn 0.35s var(--ease-out);
  max-width: 480px;
  margin: 0 auto;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-hero {
  text-align: center;
  padding: 40px 0 32px;
}

.page-hero .emoji {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}

.page-hero h2 {
  font-family: var(--font-en);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.page-hero .tagline {
  font-family: var(--font-en);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--text-tertiary);
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s var(--ease-out);
}

.card-elevated {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  box-shadow: var(--shadow-md);
}

/* ─── Buttons ─── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-fa);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 16px var(--brand-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px var(--brand-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s var(--ease-out);
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); background: var(--success-bg); }
.toast.error   { border-color: rgba(239, 68, 68, 0.4); background: var(--danger-bg); }

.toast.hidden { display: none; }

/* ─── Utilities ─── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
/* ═══════════════════════════════════════════
   Modal & Wallet Picker
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s var(--ease-out);
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.3s var(--ease-out);
  max-height: 80vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-fa);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  text-align: right;
  width: 100%;
}

.wallet-option:hover,
.wallet-option:active {
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.wallet-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.wallet-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.wallet-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}
/* ═══════════════════════════════════════════
   Profile + Stats + Quick Actions
   ═══════════════════════════════════════════ */

.loading-card {
  padding: 60px 20px;
  text-align: center;
}

.card-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Profile Header ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--brand-glow);
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-id {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.badge-id {
  display: inline-block;
  padding: 2px 8px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-en);
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.profile-address {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-item {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-item .stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stat-item .stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-row-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 12px;
}

/* ── Points Big ── */
.points-big {
  text-align: center;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.points-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.points-value {
  font-size: 38px;
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -0.02em;
}

/* ── Rooms Summary ── */
.rooms-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  gap: 10px;
}

.rooms-summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.room-badge.room-max {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease-out);
}

/* ── Info List ── */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span:first-child {
  color: var(--text-secondary);
}

/* ── Quick Actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-fa);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.qa-btn:active {
  transform: scale(0.97);
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
}

.qa-icon {
  font-size: 24px;
}

.qa-label {
  font-size: 12px;
}

/* ── Rooms Grid ── */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.room-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  transition: all 0.2s;
  text-align: center;
}

.room-tile.open {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

.room-tile.locked {
  opacity: 0.55;
}

.room-emoji {
  font-size: 20px;
  margin-bottom: 4px;
}

.room-num {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.room-status {
  font-size: 9px;
  color: var(--text-tertiary);
}
/* ═══════════════════════════════════════════
   Room Tile (button) + Invite Modal
   ═══════════════════════════════════════════ */

.room-tile {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-fa);
  cursor: pointer;
}

.room-title-small {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 2px;
  line-height: 1.2;
  text-align: center;
}

/* ── Invite Modal ── */
.invite-icon {
  font-size: 64px;
  text-align: center;
  margin: 8px 0 12px;
  animation: pop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.invite-title {
  font-size: 20px;
  font-weight: 700;
  color: #10b981;
  text-align: center;
  margin-bottom: 6px;
}

.invite-sub {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.7;
  margin-bottom: 20px;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
/* ═══════════════════════════════════════════
   Welcome + Broadcast Cards
   ═══════════════════════════════════════════ */

.welcome-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand-gradient);
}

.welcome-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ── Broadcast ── */
.broadcast-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(239, 68, 68, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  position: relative;
}

.broadcast-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.broadcast-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.broadcast-icon {
  font-size: 18px;
}

.broadcast-label {
  font-size: 11px;
  font-weight: 700;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.broadcast-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.broadcast-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}
/* ═══════════════════════════════════════════
   Admin Panel
   ═══════════════════════════════════════════ */

.admin-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.admin-tab {
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-fa);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab.active {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.admin-actions .btn {
  flex: 1;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}

/* ── Admin Broadcast Card ── */
.broadcast-admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.broadcast-admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
}

.broadcast-target {
  color: var(--brand-primary);
  font-weight: 600;
}

.broadcast-timer {
  padding: 3px 10px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-radius: var(--radius-full);
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 600;
}

.broadcast-timer.expired {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.broadcast-admin-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.broadcast-admin-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; /* سه ستون مساوی */
  gap: 8px;
  margin-top: 16px;
}

.qa-btn {
  padding: 14px 4px; /* فشرده‌تر */
}

.room-title-en {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-en);
  margin-bottom: 4px;
}
/* اصلاح گرید تب‌ها برای ۴ دکمه */
.admin-tabs {
  grid-template-columns: repeat(4, 1fr) !important;
}

/* کارت‌های کاربران در پنل ادمین */
.admin-user-card {
  padding: 14px;
}

.user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.user-wallet {
  font-size: 12px;
  color: var(--brand-primary);
  margin-bottom: 4px;
}

.user-date {
  font-size: 11px;
  color: var(--text-tertiary);
}
/* ═══════════════════════════════════════════
   Education Hub (Knowledge Base)
   ═══════════════════════════════════════════ */

.edu-details {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
}

.edu-details summary {
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  position: relative;
  transition: background 0.2s;
}

.edu-details summary::-webkit-details-marker { display: none; }

.edu-details summary::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-tertiary);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s;
}

.edu-details[open] summary::after { transform: translateY(-50%) rotate(180deg); }

.edu-details summary:hover { background: var(--bg-card-hover); }

.edu-content {
  padding: 0 14px 14px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
  padding-top: 12px;
}
/* غیرفعال کردن انتخاب متن در کل مینی‌اپ */
body {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;     /* IE 10 and IE 11 */
  user-select: none;         /* Standard syntax */
}

/* استثنا برای فیلدهای ورودی (مثل پنل ادمین) */
input, textarea {
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}