/* ==========================================================
   برنامک «رزرو اقامت» — سامانه رزرواسیون دانشگاه قم
   طراحی موبایل‌اول با هویت بصری بنفش سامانه اصلی
   ========================================================== */

:root {
  --brand-1: #667eea;
  --brand-2: #764ba2;
  --brand-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --ink: #17171f;
  --ink-soft: #55555f;
  --bg: #f6f6fb;
  --card: #ffffff;
  --line: #ececf4;

  --green: #27ae60;
  --green-bg: #e9f9f0;
  --red: #cc0000;
  --red-bg: #f8d7da;
  --red-ink: #721c24;
  --orange: #e67e22;
  --orange-bg: #ffe5b4;
  --orange-ink: #8a5a00;

  --radius: 18px;
  --shadow: 0 6px 24px rgba(93, 74, 156, .10), 0 2px 6px rgba(23, 23, 31, .05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: Vazirmatn, Tahoma, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  padding-bottom: calc(28px + var(--safe-bottom));
  font-size: 15px;
  line-height: 1.9;
}

/* پس‌زمینه ثابت با تصویر حرم — محو و با پرده روشن برای خوانایی کارت‌ها */
body::before {
  content: "";
  position: fixed;
  inset: -24px;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(246, 246, 251, .80), rgba(246, 246, 251, .92)),
    radial-gradient(900px 380px at 50% -160px, rgba(102, 126, 234, .18), transparent 70%),
    url("mashhad.jpg") center 18% / cover no-repeat;
  filter: blur(9px);
}

/* ---------- نوار بالا ---------- */
.appbar {
  max-width: 560px;
  margin: 0 auto;
  background:
    linear-gradient(165deg, rgba(102, 126, 234, .86) 0%, rgba(118, 75, 162, .90) 100%),
    url("mashhad.jpg") center 22% / cover no-repeat;
  color: #fff;
  padding: calc(10px + var(--safe-top)) 16px 42px;
  border-radius: 0 0 26px 26px;
  box-shadow: 0 8px 24px rgba(102, 126, 234, .35);
  position: relative;
  overflow: hidden;
}

/* هاله‌های تزئینی گرادیان */
.appbar::before, .appbar::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  pointer-events: none;
}
.appbar::before { width: 190px; height: 190px; top: -95px; left: -55px; }
.appbar::after  { width: 130px; height: 130px; bottom: -70px; right: -30px; }

.appbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.appbar-title {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  flex: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

/* ---------- منوی کشویی سمت راست ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 31, .45);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fade .2s ease;
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(78vw, 300px);
  background: #fff;
  z-index: 41;
  box-shadow: -8px 0 30px rgba(23, 23, 31, .18);
  transform: translateX(105%);
  transition: transform .28s cubic-bezier(.2, .8, .3, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-header {
  background: linear-gradient(165deg, rgba(102, 126, 234, .92) 0%, rgba(118, 75, 162, .95) 100%),
    url("mashhad.jpg") center 22% / cover no-repeat;
  color: #fff;
  padding: calc(24px + var(--safe-top)) 18px 22px;
}

.drawer-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-right: 4px solid transparent;
  transition: background .15s ease;
}
.drawer-item:active { background: #f4f4fb; }
.drawer-item.active {
  color: var(--brand-2);
  background: linear-gradient(90deg, rgba(102, 126, 234, .10), transparent);
  border-right-color: var(--brand-1);
}
.drawer-icon { font-size: 18px; }

.icon-btn {
  width: 38px; height: 38px;
  border: none; border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.icon-btn:active { transform: scale(.92); background: rgba(255, 255, 255, .28); }
.icon-btn.spin { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.appbar-greeting {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* ---------- چیدمان ---------- */
.container {
  max-width: 560px;
  margin: -26px auto 0;
  padding: 0 14px;
  position: relative;
  z-index: 1;
}

.page-title {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  margin: 14px 0 2px;
  color: var(--ink);
}
.page-subtitle {
  text-align: center;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--brand-2);
  margin: 0 0 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
  animation: rise .35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.card-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: "";
  width: 5px; height: 20px;
  border-radius: 3px;
  background: var(--brand-grad);
  flex: none;
}

.hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 6px 0 10px;
}

/* ---------- انتخاب اقامت ---------- */
.select-wrap { position: relative; }

.select-wrap::after {
  content: "▾";
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--brand-1);
  font-size: 18px;
  pointer-events: none;
}

select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  background: #f7f7fd;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, .15);
}

/* ---------- کارت سهمیه ---------- */
.quota-card { background: linear-gradient(180deg, #fff, #fbfaff); }

.quota-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #fafafd;
  border: 1px dashed var(--line);
  margin-bottom: 8px;
  font-size: 13.5px;
}
.quota-label { flex: 1; color: var(--ink-soft); font-weight: 600; }
.quota-value { font-weight: 800; white-space: nowrap; }
.quota-value strong { color: var(--brand-2); font-size: 16px; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 12px;
  padding: 3px 10px;
  white-space: nowrap;
}
.badge-danger { background: var(--red-bg); color: var(--red-ink); }
.badge-warn   { background: var(--orange-bg); color: var(--orange-ink); }
.badge-ok     { background: var(--green-bg); color: var(--green); }

/* ---------- فیلترها ---------- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 6px;
}

.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: #f3f3fa;
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .18s ease;
}
.chip.active {
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 4px 12px rgba(102, 126, 234, .35);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  align-self: flex-start;
  cursor: pointer;
  user-select: none;
}
.toggle input { accent-color: var(--brand-2); width: 17px; height: 17px; }

.list-meta {
  font-size: 11.5px;
  color: #9a9aa8;
  margin: 4px 2px 8px;
}

/* ---------- کارت بازه‌ها ---------- */
.period-list { display: flex; flex-direction: column; gap: 9px; }

.period {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: 15px;
  padding: 11px 12px;
  background: #fff;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  animation: rise .3s ease both;
}
.period::before {
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
}
.period.available { border-color: #d9f2e4; }
.period.available::before { background: var(--green); }
.period.full { background: #fffdf6; border-color: #f4e8d2; }
.period.full::before { background: linear-gradient(180deg, #e6a23c, #cc0000); }
.period.selected {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, .16), var(--shadow);
  transform: translateY(-1px);
}
.period:active { transform: scale(.985); }

.p-info { flex: 1; min-width: 0; }

.p-num {
  font-size: 10.5px;
  color: #b0b0be;
  font-weight: 700;
  margin-bottom: 1px;
}

.p-dates {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-dates .arrow { color: var(--brand-1); font-weight: 900; margin: 0 2px; }

.p-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.p-cap { font-weight: 800; }
.p-cap.free { color: var(--green); }
.p-cap.zero { color: var(--red); }
.p-cap.many { color: var(--brand-2); }

.p-action { flex: none; }

.btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 11px;
  padding: 8px 16px;
  border: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.94); }

.btn-select {
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 4px 12px rgba(102, 126, 234, .35);
}
.btn-waitlist {
  color: var(--brand-1);
  background: #fff;
  border: 1.5px solid var(--brand-1);
  padding: 7px 12px;
}
.btn-selected {
  color: var(--green);
  background: var(--green-bg);
  border: 1.5px solid #bfe8d2;
}

/* ---------- حالت بارگذاری ---------- */
.skeleton {
  height: 66px;
  border-radius: 15px;
  background: linear-gradient(90deg, #f0f0f6 25%, #fafafe 50%, #f0f0f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.1s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty {
  text-align: center;
  color: #a0a0ae;
  font-size: 13px;
  padding: 26px 0;
}

.footer-note {
  text-align: center;
  font-size: 11px;
  color: #b3b3c0;
  margin: 22px 8px 0;
}

/* ---------- صفحه ورود ---------- */
.login-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 20px;
  margin-top: 18px;
  animation: rise .35s ease both;
}
.login-logo { text-align: center; font-size: 40px; }
.login-title { text-align: center; font-size: 16px; font-weight: 800; margin: 6px 0 2px; }
.login-sub { text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 0 0 16px; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #f7f7fd;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px rgba(102, 126, 234, .15); }

.login-btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.login-error {
  background: var(--red-bg);
  color: var(--red-ink);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  margin-bottom: 10px;
}

/* ---------- صفحه اصلی (فعلاً خالی) ---------- */
.empty-home {
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  padding: 56px 24px;
  margin-top: 18px;
  animation: rise .35s ease both;
}
.empty-home-icon { font-size: 44px; margin-bottom: 10px; }
.empty-home p { margin: 4px 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.empty-home .empty-home-hint { font-size: 12.5px; font-weight: 500; color: #9a9aa8; }

/* ---------- دیالوگ تأیید (فقط خارج از ایتا) ---------- */
.eitaa-dialog-mask {
  position: fixed; inset: 0;
  background: rgba(23, 23, 31, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.eitaa-dialog {
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px 16px;
  width: min(88vw, 340px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: rise .22s ease both;
}
.eitaa-dialog-msg { font-size: 14px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.eitaa-dialog-actions { display: flex; gap: 10px; }
.eitaa-dialog-actions .btn { flex: 1; padding: 10px; font-size: 13.5px; }
.btn-ghost { background: #f1f1f6; color: var(--ink-soft); }
