/* ==========================================================================
   سامانه خدمات الکترونیکی دندانپزشکی آریا - استایل اختصاصی، لوکس و کاملاً بومی
   ========================================================================== */

@import url('/static/fonts/vazirmatn/vazirmatn.css');

:root {
  --primary-navy: #0b132b;
  --primary-dark: #1c2541;
  --primary-blue: #1e3a8a;
  --accent-teal: #0891b2;
  --accent-cyan: #06b6d4;
  --accent-mint: #10b981;
  --bg-soft: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --warning-amber: #f59e0b;
  --danger-rose: #e11d48;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.35);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  direction: rtl;
  background-color: var(--bg-soft);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* تایپوگرافی و المان‌های عمومی */
a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #ffffff;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* هدر و ناوبری */
.navbar {
  background: var(--primary-navy);
  color: #ffffff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.nav-brand .tooth-icon {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #cbd5e1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-badge {
  background: var(--accent-cyan);
  color: var(--primary-navy);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* لایه‌بندی محتوا */
.main-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

/* کارت‌ها و المان‌های شیشه‌ای */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
}

/* دکمه‌های مدرن */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan));
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  transform: translateY(-1px);
}

.btn-navy {
  background: var(--primary-navy);
  color: #ffffff;
}

.btn-navy:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--accent-mint);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger-rose);
  color: #ffffff;
}

.btn-outline {
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* استایل مانیتور سالن انتظار (Display Mode) */
.display-body {
  background: linear-gradient(135deg, #070e20, #0f1c3f, #070e20);
  color: #ffffff;
  overflow: hidden;
  height: 100vh;
  padding: 0;
  margin: 0;
}

.display-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(6, 182, 212, 0.3);
}

.display-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.display-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.display-subtitle {
  font-size: 14px;
  color: var(--accent-cyan);
  font-weight: 500;
}

.display-time-box {
  text-align: left;
}

.display-clock {
  font-size: 34px;
  font-weight: 900;
  color: #ffffff;
  font-family: monospace, 'Vazirmatn';
}

.display-date {
  font-size: 15px;
  color: #94a3b8;
}

/* باکس نوبت فعال و فراخوانده شده */
.active-call-hero {
  background: radial-gradient(circle at center, rgba(14, 116, 144, 0.4) 0%, rgba(11, 19, 43, 0.8) 100%);
  border: 3px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-glow);
  animation: pulse-glow 2.5s infinite alternate;
  position: relative;
  overflow: hidden;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); border-color: #0891b2; }
  100% { box-shadow: 0 0 50px rgba(6, 182, 212, 0.7); border-color: #38bdf8; }
}

.active-call-label {
  display: inline-block;
  background: var(--accent-cyan);
  color: var(--primary-navy);
  font-weight: 800;
  font-size: 18px;
  padding: 6px 24px;
  border-radius: 30px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ticket-number-display {
  font-size: 86px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 16px;
  text-shadow: 0 4px 20px rgba(6, 182, 212, 0.6);
}

.patient-name-display {
  font-size: 38px;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 20px;
}

.destination-box {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.dest-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 16px 28px;
  border-radius: var(--radius-md);
  text-align: center;
}

.dest-label {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.dest-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* جدول صف انتظار سالن */
.queue-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.queue-table th {
  padding: 12px 16px;
  font-size: 13px;
  color: #94a3b8;
  text-align: right;
  font-weight: 600;
}

.queue-table td {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
}

.queue-table tr td:first-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-weight: 800;
  color: var(--accent-cyan);
}

.queue-table tr td:last-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* نشان وضعیت */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending { background: #fef3c7; color: #b45309; }
.badge-checked_in { background: #e0f2fe; color: #0369a1; }
.badge-called { background: #fef08a; color: #854d0e; }
.badge-in_treatment { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #ffe4e6; color: #9f1239; }

/* تقویم شمسی نوبت‌دهی */
.cal-wrap { direction: rtl; }
.cal-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:8px; }
.cal-title { font-weight:800; color:var(--primary-dark); font-size:15px; }
.cal-weekdays { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:6px; text-align:center; font-size:12px; color:var(--text-muted); font-weight:700; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-cell {
  border:1px solid var(--border-light);
  background:#fff;
  border-radius:10px;
  min-height:54px;
  padding:6px 4px;
  cursor:pointer;
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
}
.cal-cell:hover { border-color:#0d9488; }
.cal-empty { border:none; background:transparent; cursor:default; min-height:54px; }
.cal-daynum { font-weight:800; font-size:14px; color:var(--primary-dark); }
.cal-badge { font-size:10px; background:#ecfdf5; color:#047857; border-radius:999px; padding:1px 6px; font-weight:700; }
.cal-available { background:#f0fdfa; border-color:#99f6e4; }
.cal-full { background:#fff7ed; border-color:#fed7aa; }
.cal-full .cal-badge { background:#ffedd5; color:#c2410c; }
.cal-selected { outline:2px solid #0f766e; background:#ccfbf1; }
.cal-legend { display:flex; gap:12px; flex-wrap:wrap; margin-top:10px; font-size:11px; color:var(--text-muted); }
.cal-dot { display:inline-block; width:10px; height:10px; border-radius:50%; background:#e2e8f0; margin-left:4px; vertical-align:middle; border:1px solid #cbd5e1; }
.cal-dot.cal-available { background:#99f6e4; border-color:#5eead4; }
.cal-dot.cal-full { background:#fed7aa; border-color:#fdba74; }
.time-chip {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:72px; padding:8px 10px; margin:4px; border-radius:10px;
  border:1px solid var(--border-light); background:#fff; cursor:pointer; font-weight:700; font-size:13px;
  font-family:monospace; direction:ltr;
}
.time-chip.active { background:#0f766e; color:#fff; border-color:#0f766e; }
.time-chip.booked { background:#f1f5f9; color:#94a3b8; cursor:not-allowed; text-decoration:line-through; }
.time-chip.available-book { background:#ecfdf5; border-color:#6ee7b7; color:#065f46; }

/* فوتر پیام بهداشتی متحرک — برای فارسی RTL از چپ وارد و به راست می‌رود */
.display-marquee-footer {
  background: rgba(11, 19, 43, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  position: absolute;
  bottom: 0;
  width: 100%;
  overflow: hidden;
}

.marquee-badge {
  background: var(--accent-teal);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 16px;
  white-space: nowrap;
  flex-shrink: 0;
  z-index: 2;
}

.marquee-text {
  font-size: 14px;
  color: #cbd5e1;
  white-space: nowrap;
  display: inline-block;
  animation: marquee-rtl 35s linear infinite;
}

/* شروع از چپ (ابتدای متن فارسی) و حرکت به راست */
@keyframes marquee-rtl {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* کادر کپچای ریاضی شیک، ایمن و کاملاً محصور */
.captcha-card-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 12px 0;
  width: 100%;
  box-sizing: border-box;
}

.captcha-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
}

.captcha-img-preview {
  height: 52px;
  max-width: calc(100% - 64px);
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

.captcha-btn-reload {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  height: 52px;
  width: 52px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--primary-dark);
}

.captcha-btn-reload:hover {
  background: #f1f5f9;
  border-color: var(--accent-cyan);
}

.captcha-bottom-row {
  width: 100%;
}

.captcha-ans-input {
  width: 100%;
  height: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--primary-navy);
  box-sizing: border-box;
}

.captcha-ans-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* واکنش‌گرایی موبایل (Mobile Friendly) */
@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .ticket-number-display {
    font-size: 58px;
  }
  .patient-name-display {
    font-size: 26px;
  }
  .dest-item {
    padding: 10px 16px;
  }
}

/* ==========================================================================
   طراحی پنل مدیریت جامع و سازگار با PWA و موبایل (Enterprise Clinic Dashboard)
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 270px;
  background: var(--primary-navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.3s ease;
}

.sidebar-brand-box {
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-nav-list {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  background: transparent;
  width: 100%;
  text-align: right;
}

.sidebar-item-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-item-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan));
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.sidebar-item-btn .nav-icon {
  font-size: 18px;
}

a.sidebar-item-btn,
a.sidebar-link-btn {
  text-decoration: none;
  color: #94a3b8;
  box-sizing: border-box;
}

.sidebar-footer-box {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shell-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 12px;
}

.shell-page-header h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary-dark);
  margin: 0;
}

.shell-page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.shell-user-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-teal);
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 6px 12px;
  border-radius: 8px;
}

/* تب‌های داخلی هر منوی اصلی (نه منوی دوم در سایدبار) */
.shell-subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 12px;
}
.shell-subtab {
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.shell-subtab.active {
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan));
  color: #fff;
  border-color: transparent;
}

.app-main-content {
  flex: 1;
  padding: 28px 24px 80px 24px;
  max-width: 1350px;
  margin: 0 auto;
  width: 100%;
}

.tab-section-content {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-section-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* نوار دسترسی سریع پایین گوشی (Mobile Bottom Bar) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary-navy);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 10px;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 2px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.mobile-nav-btn.active {
  color: var(--accent-cyan);
}

.mobile-nav-btn span:first-child {
  font-size: 18px;
}

/* مودال‌های پاپ‌آپ مدرن */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  animation: modalScale 0.2s ease;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .app-sidebar {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .app-main-content {
    padding: 16px 12px 90px 12px;
  }
}

/* فیلدهای ورود — جهت یکسان RTL برای نام کاربری و رمز */
.auth-field-input {
  width: 100%;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
}

/* فیلد موبایل با پیش‌شماره ثابت (+۹۸) — جهت LTR برای جلوگیری از افتادگی کد */
.phone-input-group {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  direction: ltr;
  unicode-bidi: isolate;
}
.phone-input-group:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.phone-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0 12px;
  background: #f1f5f9;
  color: #0f766e;
  font-weight: 800;
  font-size: 14px;
  border-left: none;
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  flex-shrink: 0;
}
.phone-input-group input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
  letter-spacing: 0.5px;
}
.phone-input-group input:focus {
  box-shadow: none !important;
}

/* فیلدهای تاریخ شمسی */
input[data-jdp] {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230891b2' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 40px;
}

/* ارقام فارسی در کل UI */
.fa-num, .metric-val, .ticket-number-display, .display-clock, .display-date {
  font-variant-numeric: normal;
}

