/* ===========================================================
   التقويم الرقمي لنادي العلا — الأنماط
   هوية بصرية أصلية: كحلي غامق + ذهبي بيج + أبيض
   =========================================================== */

@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap");

:root {
  --navy-950: #061422;
  --navy-900: #0b2a47;
  --navy-800: #123a5e;
  --gold-500: #b99a6b;
  --gold-400: #d3b98a;
  --gold-100: #f3e9d8;
  --white: #ffffff;
  --success: #3ba776;
  --danger: #d9534f;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-modal: 0 25px 60px -15px rgba(6, 20, 34, 0.55);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

body {
  direction: rtl;
  color: var(--white);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #10314f 0%, var(--navy-950) 60%);
  overflow-x: hidden;
}

/* -----------------------------------------------------------
   خلفية الصفحة: نقشة مستوحاة من جلد النمر العربي + نخيل العلا
   ----------------------------------------------------------- */
.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(185, 154, 107, 0.16) 0, transparent 22%),
    radial-gradient(circle at 82% 15%, rgba(185, 154, 107, 0.12) 0, transparent 18%),
    radial-gradient(circle at 30% 70%, rgba(185, 154, 107, 0.14) 0, transparent 20%),
    radial-gradient(circle at 70% 80%, rgba(185, 154, 107, 0.1) 0, transparent 24%),
    radial-gradient(circle at 50% 45%, rgba(185, 154, 107, 0.08) 0, transparent 30%),
    linear-gradient(180deg, #0e2c48 0%, #061422 100%);
  background-color: var(--navy-950);
}

.page-backdrop::after {
  /* نقشة بقع خفيفة تُلمّح إلى جلد النمر العربي بأسلوب مجرد وأصلي بالكامل */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    radial-gradient(circle, rgba(11, 42, 71, 0.9) 38%, transparent 40%),
    radial-gradient(circle, rgba(11, 42, 71, 0.9) 38%, transparent 40%);
  background-size: 140px 140px, 190px 190px;
  background-position: 0 0, 70px 95px;
  mix-blend-mode: multiply;
}

.page-hint {
  position: fixed;
  bottom: 18px;
  right: 50%;
  transform: translateX(50%);
  z-index: 1;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  text-align: center;
  padding: 0 16px;
}

/* -----------------------------------------------------------
   زر الإطلاق (يمثل مكان الويدجت داخل موقع النادي)
   ----------------------------------------------------------- */
.launcher {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px;
}

.launcher h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
  color: var(--gold-100);
}

.launcher p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
  max-width: 420px;
}

.btn-launch {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-950);
  border: none;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 16px 36px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 12px 28px -8px rgba(185, 154, 107, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.btn-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -8px rgba(185, 154, 107, 0.75);
}

/* -----------------------------------------------------------
   الطبقة المعتمة + النافذة المنبثقة
   ----------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 18, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(720px, 92vh);
  background: linear-gradient(180deg, #0f3253 0%, var(--navy-900) 45%, var(--navy-950) 100%);
  border: 1px solid rgba(185, 154, 107, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.overlay.is-open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* -----------------------------------------------------------
   شريط تبديل اللغة (أعلى النافذة)
   ----------------------------------------------------------- */
.lang-toggle {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 10px 10px 0;
  flex-shrink: 0;
}

.lang-btn {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn.active {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: var(--navy-950);
}

/* -----------------------------------------------------------
   رأس النافذة: شريط متدرج + الشعار + أزرار التنقل + شريط التقدم
   ----------------------------------------------------------- */
.modal-header {
  position: relative;
  padding: 20px 20px 0;
  text-align: center;
  flex-shrink: 0;
  background: linear-gradient(160deg, var(--navy-800) 0%, var(--navy-900) 100%);
}

.modal-nav-btn {
  position: absolute;
  top: 18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.modal-nav-btn.back {
  left: 16px;
}

.modal-nav-btn.close {
  right: 16px;
}

.modal-nav-btn[hidden] {
  visibility: hidden;
}

.crest {
  width: 78px;
  height: 78px;
  margin: 0 auto;
  transform: translateY(39px);
  position: relative;
  z-index: 2;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
  border: 3px solid var(--gold-500);
}

.modal-intro {
  text-align: center;
  padding-top: 44px;
}

.crest img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.brand-title {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  color: var(--gold-100);
}

.brand-subtitle {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

.progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 14px;
}

.progress-dot {
  width: 28px;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s ease;
}

.progress-dot.active {
  background: var(--gold-500);
}

.progress-dot.done {
  background: var(--gold-400);
}

/* -----------------------------------------------------------
   جسم النافذة (الشاشات)
   ----------------------------------------------------------- */
.modal-body {
  padding: 4px 22px 22px;
  overflow-y: auto;
  flex: 1;
}

.screen {
  display: none;
  animation: fade-slide-in 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen-title {
  font-size: 1.3rem;
  font-weight: 900;
  text-align: center;
  color: var(--white);
  margin: 6px 0 8px;
}

.screen-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.screen-subtitle a {
  color: var(--gold-400);
}

.divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin: 0 0 20px;
}

/* -----------------------------------------------------------
   الشاشة 1: شبكة الفرق
   ----------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.team-card {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 16px 10px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  color: var(--white);
  font-family: inherit;
}

.team-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.team-card.selected {
  border-color: var(--gold-500);
  background: rgba(185, 154, 107, 0.16);
}

.team-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.team-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
}

.team-fixture-count {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.check-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--navy-950);
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.team-card.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

/* -----------------------------------------------------------
   الشاشة 2: شبكة مزوّدي التقويم
   ----------------------------------------------------------- */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.provider-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  color: var(--white);
  font-family: inherit;
  text-align: start;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.provider-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

.provider-icon {
  font-size: 1.4rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.provider-label {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

/* -----------------------------------------------------------
   الشاشة 3: التأكيد
   ----------------------------------------------------------- */
.success-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--success);
  color: var(--white);
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 18px;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.summary-list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
}

.summary-item .team-icon {
  font-size: 1.2rem;
  margin: 0;
}

.summary-item strong {
  color: var(--gold-100);
}

.summary-count {
  margin-inline-start: auto;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
}

.ics-status {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gold-400);
  min-height: 1.4em;
  margin: 0 0 14px;
  line-height: 1.5;
}

/* -----------------------------------------------------------
   الأزرار المشتركة
   ----------------------------------------------------------- */
.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.98rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-950);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}

/* -----------------------------------------------------------
   التذييل
   ----------------------------------------------------------- */
.modal-footer {
  text-align: center;
  padding: 10px 20px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* -----------------------------------------------------------
   استجابة للشاشات الصغيرة جدًا
   ----------------------------------------------------------- */
@media (max-width: 360px) {
  .modal {
    max-width: 100%;
  }
  .team-icon {
    font-size: 1.6rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
