/* شاشة الزوار — التصميم الكلاسيكي (مطابق للواجهة القديمة) */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  direction: rtl;
  text-align: right;
}

body.display-screen {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  font-size: calc(0.8rem + 0.5vmin);
  color: #333;
}

.display-container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 1vh 1vw;
  height: 100%;
  box-sizing: border-box;
  gap: 1vh;
  min-height: 0;
}

/* الهيدر: الشعار + العنوان */
.header-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
  padding: 2vh 3vw;
  border-radius: 2vh;
  text-align: center;
  box-shadow:
    0 0.8vh 2.5vh rgba(0, 0, 0, 0.12),
    0 0.3vh 1vh rgba(0, 0, 0, 0.08),
    inset 0 0.1vh 0.3vh rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  flex-shrink: 0;
  margin-bottom: 0;
  border: 2px solid rgba(102, 126, 234, 0.15);
  position: relative;
  overflow: hidden;
}

.header-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

.company-logo {
  height: clamp(48px, 10vh, 96px);
  width: clamp(48px, 10vh, 96px);
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 3px solid rgba(102, 126, 234, 0.3);
  box-shadow:
    0 0.5vh 1.5vh rgba(0, 0, 0, 0.15),
    0 0 0 4px rgba(255, 255, 255, 0.8),
    0 0 0 6px rgba(102, 126, 234, 0.1);
  transition: all 0.3s ease;
  filter: brightness(1.05) contrast(1.1) saturate(1.2);
  flex-shrink: 0;
}

.clinic-title {
  color: #2c3e50;
  font-size: calc(2rem + 1.5vmin);
  font-weight: 700;
  margin: 0;
  text-shadow: 0 0.2vh 0.5vh rgba(0, 0, 0, 0.1), 0 0.1vh 0.2vh rgba(0, 0, 0, 0.05);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 100%;
  animation: gradient-text 4s ease-in-out infinite;
  line-height: 1.2;
  letter-spacing: 0.5px;
}

@keyframes gradient-text {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

/* جدول الانتظار */
.waiting-table-container {
  background: white;
  border-radius: 1vh;
  overflow: hidden;
  box-shadow: 0 0.5vh 2vh rgba(0, 0, 0, 0.1);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.waiting-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  display: table;
  table-layout: fixed;
}

.waiting-table th {
  background: #a7c7e7;
  color: #000;
  padding: 0.6vh 1vw;
  text-align: center;
  font-weight: bold;
  font-size: calc(1rem + 1vmin);
  height: 1px;               /* أقل ارتفاع؛ المحتوى يحدّد صف الرأس */
  white-space: nowrap;
  vertical-align: middle;
}

/* صفوف العيادات توزّع الارتفاع المتبقّي بالتساوي فتظهر كلها دائماً */
.waiting-table td {
  padding: 0.4vh 1vw;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
  font-size: calc(0.9rem + 0.8vmin);
  height: auto;
  overflow: hidden;
}

.waiting-table .clinic-number {
  font-weight: bold;
  color: #1e40af;
  font-size: calc(1rem + 1vmin);
}

.waiting-table tbody tr:nth-child(even) { background-color: #f8fafc; }
.waiting-table tbody tr.active-row { background-color: #fff; }

.waiting-table tbody tr.flashing-row {
  background-color: #ffeb3b !important;
  animation: flashingBackground 1s infinite;
}

@keyframes flashingBackground {
  0% { background-color: #ffeb3b; }
  50% { background-color: #fff59d; }
  100% { background-color: #ffeb3b; }
}

.patient-name {
  font-weight: bold;
  color: #1e40af;
  font-size: calc(0.9rem + 1vmin);
  line-height: 1.2;
}

.patient-id {
  font-size: calc(0.7rem + 0.6vmin);
  color: #6b7280;
  font-style: italic;
}

/* الرسالة السفلية */
.bottom-message {
  background: rgba(255, 255, 255, 0.95);
  padding: 1vh 2vw;
  border-radius: 1vh;
  text-align: center;
  box-shadow: 0 0.5vh 1vh rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  height: fit-content;
}

.bottom-message p {
  color: #2c3e50;
  font-size: calc(0.8rem + 0.5vmin);
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
}

/* شاشة تفعيل الصوت */
.audio-activation-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

.audio-activation-overlay.hidden { opacity: 0; pointer-events: none; }

.audio-activation-content {
  text-align: center;
  color: white;
  padding: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: pulse-glow 2s infinite;
}

.audio-activation-content .audio-icon { font-size: 4em; margin-bottom: 20px; animation: bounce-icon 2s infinite; }
.audio-activation-content h2 { font-size: 2.5em; margin-bottom: 15px; font-weight: bold; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); }
.audio-activation-content p { font-size: 1.3em; opacity: 0.9; line-height: 1.6; }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 255, 255, 0.2); }
}

@keyframes bounce-icon {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* شاشات صغيرة */
@media (max-width: 768px) {
  .display-container { padding: 10px; }
  .header-section { flex-direction: row; gap: 0.8vh; padding: 0.8vh 1vw; }
  .company-logo { height: 48px; width: 48px; }
  .clinic-title { font-size: calc(1.2rem + 1vmin); }
  .waiting-table th { font-size: 1.2em; padding: 15px 8px; height: 60px; }
  .waiting-table td { font-size: 1em; padding: 20px 8px; height: 80px; }
  .bottom-message p { font-size: 1.1em; }
}
