@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@2.47.0/tabler-icons.min.css');

:root {
  --bg: #0d1117;
  --bg2: #111827;
  --bg3: #1c2230;
  --bg4: #222a3a;
  --accent: #5b8dee;
  --accent2: #7c6af7;
  --accent3: #4ecdc4;
  --accent-soft: rgba(91,141,238,0.12);
  --accent-glow: rgba(91,141,238,0.3);
  --success: #3fb950;
  --danger: #f85149;
  --warning: #d29922;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #484f58;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.45);
  --t: 0.2s cubic-bezier(.4,0,.2,1);
  --font: 'Vazirmatn', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); direction: rtl; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font); direction: rtl; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--r-md); font-size: 0.875rem; font-weight: 600; transition: var(--t); cursor: pointer; border: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4a7de0; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--bg3); border: 1px solid var(--border2); color: var(--text2); }
.btn-secondary:hover { border-color: var(--border2); color: var(--text); background: var(--bg4); }
.btn-danger { background: rgba(248,81,73,0.12); border: 1px solid rgba(248,81,73,0.25); color: var(--danger); }
.btn-danger:hover { background: rgba(248,81,73,0.22); }
.btn-success { background: rgba(63,185,80,0.12); border: 1px solid rgba(63,185,80,0.25); color: var(--success); }
.btn-ghost { color: var(--text2); padding: 9px 16px; border-radius: var(--r-md); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--r-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== INPUTS ===== */
.input { width: 100%; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 11px 14px; color: var(--text); font-size: 0.9rem; outline: none; transition: var(--t); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text3); }
select.input { cursor: pointer; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.8rem; color: var(--text2); font-weight: 500; }

/* ===== CARD ===== */
.card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r-lg); }

/* ===== BADGE ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: rgba(63,185,80,0.12); color: var(--success); }
.badge-red { background: rgba(248,81,73,0.12); color: var(--danger); }
.badge-yellow { background: rgba(210,153,34,0.12); color: var(--warning); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(8px); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: var(--t); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r-xl); padding: 28px; width: min(500px, 94vw); transform: scale(0.95) translateY(16px); transition: var(--t); box-shadow: var(--shadow); }
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-header h2 { font-size: 1.15rem; font-weight: 700; }
.modal-close { color: var(--text3); font-size: 1.1rem; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: var(--t); }
.modal-close:hover { color: var(--danger); background: rgba(248,81,73,0.1); }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ===== TOAST ===== */
.toast-wrap { position: fixed; bottom: 20px; left: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r-md); padding: 12px 16px; display: flex; align-items: center; gap: 10px; max-width: 300px; box-shadow: var(--shadow); animation: toastIn .3s ease; font-size: 0.875rem; }
.toast.success { border-right: 3px solid var(--success); }
.toast.error { border-right: 3px solid var(--danger); }
.toast.info { border-right: 3px solid var(--accent); }
@keyframes toastIn { from { opacity:0; transform:translateX(-16px); } to { opacity:1; transform:none; } }

/* ===== TOGGLE ===== */
.toggle { position: relative; width: 42px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border2); border-radius: 11px; cursor: pointer; transition: var(--t); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; top: 3px; right: 3px; transition: var(--t); }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(-20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .9rem; color: var(--text2); }
.toggle-row > span { display: flex; align-items: center; flex: 1; min-width: 0; }

/* ===== SPINNER ===== */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; height: 100vh; flex-direction: column; gap: 16px; color: var(--text2); }

/* ===== APP LAYOUT ===== */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar { width: 220px; min-width: 220px; background: var(--bg2); border-left: 1px solid var(--border); display: flex; flex-direction: column; height: 100vh; }
.sidebar-logo { padding: 18px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; }
.sidebar-logo span:first-child { font-size: 1.3rem; }
.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-md); color: var(--text2); font-size: 0.875rem; font-weight: 500; transition: var(--t); cursor: pointer; position: relative; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item i { font-size: 1.1rem; flex-shrink: 0; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.sidebar-user { padding: 10px 8px 14px; }
.sidebar-user-card { background: var(--bg3); border-radius: var(--r-md); border: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.u-av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; color: #fff; flex-shrink: 0; }
.u-av-lg { width: 56px; height: 56px; font-size: 1.4rem; }
.u-name { font-size: 0.825rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-sub { font-size: 0.72rem; color: var(--text3); margin-top: 1px; }
.u-logout { color: var(--text3); font-size: 1rem; margin-right: auto; flex-shrink: 0; transition: var(--t); }
.u-logout:hover { color: var(--danger); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-header { padding: 24px 28px 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }
.page-title { font-size: 1.5rem; font-weight: 800; }
.page-sub { font-size: 0.825rem; color: var(--text2); margin-top: 3px; }
.page-body { flex: 1; overflow-y: auto; padding: 20px 28px 28px; }

/* ===== GRADIENT TEXT ===== */
.g-text { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .page-body { padding: 16px; }
  .page-header { padding: 16px 16px 0; }
}

/* ========================================================
   تم‌های ایرانی — Persian-inspired theme presets
   اعمال می‌شود با data-theme روی <html>
   ======================================================== */

/* 🌙 شب (پیش‌فرض) — همان تم اصلی، نیازی به override نیست */

/* 🟦 فیروزه‌ای — کاشی‌کاری اصفهان */
html[data-theme="firooze"] {
  --bg: #07191c;
  --bg2: #0c2226;
  --bg3: #113136;
  --bg4: #163b41;
  --accent: #2dd4bf;
  --accent2: #38bdf8;
  --accent3: #fbbf24;
  --accent-soft: rgba(45,212,191,0.14);
  --accent-glow: rgba(45,212,191,0.35);
  --border: rgba(45,212,191,0.10);
  --border2: rgba(45,212,191,0.22);
  --text: #e3fbf8;
  --text2: #8fb8b8;
  --text3: #4f7373;
}

/* 🔴 یلدا — شب یلدا، انار و زرشک */
html[data-theme="yalda"] {
  --bg: #1a0a0d;
  --bg2: #220e12;
  --bg3: #321319;
  --bg4: #3d171f;
  --accent: #f43f5e;
  --accent2: #fb923c;
  --accent3: #fbbf24;
  --accent-soft: rgba(244,63,94,0.14);
  --accent-glow: rgba(244,63,94,0.35);
  --border: rgba(244,63,94,0.10);
  --border2: rgba(244,63,94,0.22);
  --text: #fdeeec;
  --text2: #c79a9a;
  --text3: #6e4d4d;
}

/* 🌿 باغ ارم — باغ‌های شیراز */
html[data-theme="eram"] {
  --bg: #0a1410;
  --bg2: #0f1d17;
  --bg3: #15291f;
  --bg4: #1b3327;
  --accent: #34d399;
  --accent2: #facc15;
  --accent3: #a3e635;
  --accent-soft: rgba(52,211,153,0.14);
  --accent-glow: rgba(52,211,153,0.35);
  --border: rgba(52,211,153,0.10);
  --border2: rgba(52,211,153,0.22);
  --text: #eafff4;
  --text2: #94baa9;
  --text3: #4f6e60;
}

/* 🟠 زعفران — زعفران و قالی ایرانی */
html[data-theme="zafaran"] {
  --bg: #1a0f06;
  --bg2: #24150a;
  --bg3: #33200f;
  --bg4: #3f2a15;
  --accent: #f59e0b;
  --accent2: #ef4444;
  --accent3: #fde047;
  --accent-soft: rgba(245,158,11,0.14);
  --accent-glow: rgba(245,158,11,0.35);
  --border: rgba(245,158,11,0.10);
  --border2: rgba(245,158,11,0.22);
  --text: #fff7ed;
  --text2: #cbab8a;
  --text3: #7a624c;
}

/* ========================================================
   انتخاب‌گر تم — Theme picker widget (injected by theme.js)
   ======================================================== */
.theme-fab {
  position: fixed; bottom: 16px; left: 16px; z-index: 400;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow-md);
  transition: var(--t); opacity: .55;
}
.theme-fab:hover { opacity: 1; transform: scale(1.08) rotate(15deg); border-color: var(--accent); }

.theme-panel {
  position: fixed; bottom: 64px; left: 16px; z-index: 400;
  background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--r-lg);
  padding: 14px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; gap: 8px; width: 200px;
  opacity: 0; transform: translateY(8px); transition: var(--t);
}
.theme-panel.open { display: flex; opacity: 1; transform: translateY(0); }
.theme-panel-title { font-size: .8rem; font-weight: 700; color: var(--text2); margin-bottom: 4px; text-align: center; }
.theme-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md);
  cursor: pointer; transition: var(--t); border: 1px solid transparent; font-size: .825rem; color: var(--text);
}
.theme-option:hover { background: var(--bg4); }
.theme-option.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-swatch { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; border: 2px solid rgba(255,255,255,.15); }

@media (max-width: 768px) {
  .theme-fab { bottom: 12px; left: 12px; width: 38px; height: 38px; }
  .theme-panel { bottom: 58px; left: 12px; }
}

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE — بهینه‌سازی گوشی
   ══════════════════════════════════════════════ */

/* ─ Bottom nav for mobile (جایگزین sidebar) ─ */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 300;
  background: var(--bg2); border-top: 1px solid var(--border);
  flex-direction: row; align-items: stretch;
  height: 56px; padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: var(--text3);
  font-size: .6rem; font-weight: 500; transition: var(--t);
}
.mobile-nav a i { font-size: 1.2rem; }
.mobile-nav a.active { color: var(--accent); }

@media (max-width: 768px) {
  /* show bottom nav, hide sidebar */
  .mobile-nav { display: flex; }
  .sidebar { display: none; }

  /* push page content above bottom nav */
  .main-content { padding-bottom: 66px; }
  .page-body { padding: 14px 14px 74px; }
  .page-header { padding: 14px 14px 0; }
  .page-title { font-size: 1.2rem; }

  /* smaller modals */
  .modal { padding: 20px; border-radius: var(--r-lg); width: 96vw; }
  .modal-header h2 { font-size: 1rem; }

  /* rooms grid: single col on small screens */
  .rooms-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .room-card .room-name { font-size: .875rem; }
}

@media (max-width: 480px) {
  .rooms-grid { grid-template-columns: 1fr; }

  /* hero landing */
  .hero { padding: 90px 16px 40px; }
  .hero-title { font-size: 1.7rem; }
  .hero-desc { font-size: .9rem; }
  .hero-btns { flex-direction: column; }
  .preview-card { display: none; }

  /* features */
  .features-grid { grid-template-columns: 1fr; }
  .features, .cta-section { padding: 40px 16px; }
  .poetry-grid { grid-template-columns: 1fr; }
  .poetry { padding: 10px 16px 40px; }

  /* auth */
  .auth-card { padding: 22px 18px; }
}
