/* نمط التطبيق الوطني المدرسي - مِفتاح */
:root {
  --primary-emerald: #065F46;
  --primary-accent: #047857;
  --amber-accent: #D97706;
}

body {
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* صورة وشعار تطبيق مِفتاح الرسمي: نص أبيض على خلفية خضراء */
.miftah-app-icon {
  background: linear-gradient(135deg, #059669 0%, #047857 55%, #064e3b 100%);
  color: #ffffff !important;
  font-family: 'Tajawal', system-ui, sans-serif;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid rgba(167, 243, 208, 0.4);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.25);
  line-height: 1;
  letter-spacing: -0.2px;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.miftah-app-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(4, 120, 87, 0.4);
}

/* تنسيق أزرار التبديل */
.role-switch-btn {
  color: #d1fae5;
}
.role-switch-btn.active {
  background-color: #047857;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  font-weight: 700;
}

/* بطاقات اختيار الحصة */
.period-radio-card input:checked + span {
  color: #065f46;
  font-weight: 800;
}

/* حركات وإشعارات ناعمة */
.toast-slide-in {
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes gentlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(5, 150, 105, 0);
    transform: scale(1.01);
  }
}

.animate-pulse-gentle {
  animation: gentlePulse 2s infinite ease-in-out;
}

/* شاشة محاكاة جوال الإدارة المدرسية */
.phone-mockup {
  position: relative;
  background: #0f172a;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 4px #334155;
  max-width: 360px;
  margin: 0 auto;
}

.phone-screen {
  background: #f8fafc;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.phone-notch {
  width: 130px;
  height: 22px;
  background: #0f172a;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  margin: 0 auto;
}

/* أزرار الإدارة الكبيرة للجوال */
.btn-admin-allow {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  font-weight: 800;
  min-height: 52px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  transition: all 0.2s ease;
}

.btn-admin-allow:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.btn-admin-deny {
  background: #ffffff;
  color: #b91c1c;
  border: 2px solid #f87171;
  font-weight: 800;
  min-height: 52px;
  border-radius: 16px;
  transition: all 0.2s ease;
}

.btn-admin-deny:active {
  background: #fef2f2;
  transform: scale(0.97);
}

/* خيارات أنماط الصوت المريحة */
.audio-mode-option {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

.audio-mode-option:hover {
  border-color: #10b981;
}

/* بطاقات خيارات التوقيت الخمسة */
.timing-option-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.timing-option-card:hover {
  transform: translateY(-1px);
}
.timing-option-card:active {
  transform: scale(0.98);
}

/* =============================================== */
/* نظام الطابور الإلكتروني الذكي لخروج الطلاب */
/* =============================================== */
.queue-digital-display {
  background: radial-gradient(circle at center, #064e3b 0%, #022c22 100%);
  border: 2px solid #34d399;
  box-shadow: 0 8px 24px -4px rgba(6, 95, 70, 0.4), inset 0 2px 6px rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.queue-digital-display::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0px, rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  opacity: 0.4;
}

.queue-ticket-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 2px solid #a7f3d0;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.08);
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.queue-ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(4, 120, 87, 0.14);
  border-color: #10b981;
}

.queue-step-node {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.queue-step-node.active-now {
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
  animation: queueNodePulse 1.8s infinite ease-in-out;
}

@keyframes queueNodePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
}

/* زر التنبيهات والإشعارات: حواف سوداء، داخل أبيض، وشارة تنبيه باللون الأزرق كما في التطبيقات */
.btn-notifications-icon {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background-color: #ffffff !important;
  border: 2px solid #000000 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  padding: 0;
  margin-inline-end: 0 !important;
}

/* إخفاء شريط التمرير الأفقي للأزرار المساعدة لمظهر ناعم */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.btn-notifications-icon:hover {
  background-color: #ffffff !important;
  border-color: #000000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.btn-notifications-icon:active {
  transform: scale(0.95);
  background-color: #f8fafc !important;
}

.bell-svg-icon {
  width: 22px;
  height: 22px;
  stroke: #000000 !important;
  fill: #ffffff !important;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.btn-notifications-icon:hover .bell-svg-icon {
  transform: rotate(12deg);
}

/* شارة التنبيهات باللون الأزرق الصريح */
.btn-notifications-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #2563eb !important; /* لون أزرق زاهٍ ومميز */
  color: #ffffff !important;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 900;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 9999px;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
  animation: bluePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-notifications-badge.hidden {
  display: none !important;
}

/* تصميم شاشة الطابور الهادئة والمنظمة كواجهة مخصصة ومستقلة */
.queue-banner-calm {
  background-color: #0f172a;
  box-shadow: 0 14px 35px -8px rgba(15, 23, 42, 0.5), 0 0 0 2px rgba(16, 185, 129, 0.35);
  animation: queueViewEntrance 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes queueViewEntrance {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* زر إغلاق الطابور (X) الهادئ */
.btn-queue-dismiss {
  transition: all 0.2s ease;
  user-select: none;
}
.btn-queue-dismiss:active {
  transform: scale(0.92);
}

/* وميض هادئ عند الرجوع لقسم الطابور من المربع السابع */
.queue-highlight-pulse {
  animation: calmHighlight 2s ease-in-out forwards;
}

@keyframes calmHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6), 0 10px 25px -5px rgba(15, 23, 42, 0.4);
    transform: scale(0.99);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.4), 0 12px 30px -5px rgba(15, 23, 42, 0.5);
    transform: scale(1.008);
  }
  100% {
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.25);
    transform: scale(1);
  }
}

@keyframes bluePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0);
  }
}

/* زر وصل الطالب لولي الأمر */
.btn-student-arrived {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  color: #ffffff;
  border: 2px solid #34d399;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.35);
  font-weight: 900;
  min-height: 50px;
  border-radius: 16px;
  transition: all 0.2s ease;
}

.btn-student-arrived:active {
  transform: scale(0.98);
}

/* محاكاة إشعار الرسالة النصية التفاعلي (SMS Push Banner) */
.sms-push-banner {
  animation: smsSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes smsSlideDown {
  from {
    transform: translateY(-16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* خانات إدخال أرقام الرمز المؤقت */
.otp-digit-box {
  caret-color: #059669;
  letter-spacing: -1px;
}

.otp-digit-box:focus {
  border-color: #059669;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

/* =============================================== */
/* تنسيق بطاقات القائمة المربعة الستة (The 6 Squares Grid Menu) */
/* =============================================== */
.menu-square-card {
  position: relative;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  cursor: pointer;
  min-height: 175px;
  user-select: none;
}

.menu-square-card:hover {
  transform: translateY(-2px);
  border-color: #10b981;
  box-shadow: 0 12px 24px -6px rgba(4, 120, 87, 0.15);
}

.menu-square-card:active {
  transform: scale(0.98);
}

.menu-square-card.active-sq-glow {
  box-shadow: 0 0 0 2px #10b981, 0 8px 20px -4px rgba(16, 185, 129, 0.2);
}

/* شارات الحضور الملونة */
.badge-status-present {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-status-absent {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-status-excused {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-status-unmarked {
  background-color: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-status-blue {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #93c5fd;
  font-weight: 700;
}

/* =============================================== */
/* تنسيقات ماسح رمز QR وأركان الاستهداف والليزر */
/* =============================================== */
.qr-viewfinder-box {
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  background: rgba(16, 185, 129, 0.04);
}

.qr-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #34d399;
}

.qr-corner-tl {
  top: -2px;
  left: -2px;
  border-top-width: 4px;
  border-left-width: 4px;
  border-top-left-radius: 12px;
}

.qr-corner-tr {
  top: -2px;
  right: -2px;
  border-top-width: 4px;
  border-right-width: 4px;
  border-top-right-radius: 12px;
}

.qr-corner-bl {
  bottom: -2px;
  left: -2px;
  border-bottom-width: 4px;
  border-left-width: 4px;
  border-bottom-left-radius: 12px;
}

.qr-corner-br {
  bottom: -2px;
  right: -2px;
  border-bottom-width: 4px;
  border-right-width: 4px;
  border-bottom-right-radius: 12px;
}

/* خط الليزر الأخضر الذكي المتحرك */
.qr-laser-line {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #34d399, #10b981, #6ee7b7, transparent);
  box-shadow: 0 0 14px 3px rgba(52, 211, 153, 0.85);
  animation: laserScan 2.2s infinite ease-in-out;
  border-radius: 9999px;
}

@keyframes laserScan {
  0% {
    top: 6px;
    opacity: 0.8;
  }
  50% {
    top: calc(100% - 10px);
    opacity: 1;
  }
  100% {
    top: 6px;
    opacity: 0.8;
  }
}

/* تبويبات دليل التطبيق */
.guide-tab-btn {
  transition: all 0.2s ease;
  user-select: none;
}
.guide-tab-btn.active {
  background-color: #065f46;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(6, 95, 70, 0.25);
  font-weight: 800;
}

/* شريط التمرير */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}