:root {
  --dl-bg-light: #f8fafc;
  --dl-bg-dark: #0f172a;
  --dl-card-light: rgba(255, 255, 255, 0.85);
  --dl-card-dark: rgba(30, 41, 59, 0.8);
  --dl-primary: #0f766e;
  --dl-primary-hover: #0d9488;
  --dl-accent-gold: #b45309;
  --dl-text-light: #1e293b;
  --dl-text-dark: #f8fafc;
  --dl-sub-light: #64748b;
  --dl-sub-dark: #94a3b8;
  --dl-radius: 30px;
  --dl-shadow: rgba(15, 118, 110, 0.15);
}

/* في الوضع الداكن - يدعم كل الاحتمالات */
html[data-theme="dark"],
html.dark,
html.dark-mode,
body[data-theme="dark"],
body.dark,
body.dark-mode {
  --dl-bg-light: #0f172a;
  --dl-card-light: rgba(30, 41, 59, 0.8);
  --dl-primary: #14b8a6;
  --dl-primary-hover: #02344b;
  --dl-accent-gold: #fbbf24;
  --dl-text-light: #f8fafc;
  --dl-sub-light: #94a3b8;
  --dl-shadow: rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------
   إعدادات الصفحة الأساسية
   ------------------------------------------------ */
body.download-page {
  font-family:
    "Tajawal",
    "Cairo",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: radial-gradient(
    circle at top right,
    var(--dl-primary) 0%,
    var(--dl-bg-light) 60%,
    var(--dl-bg-light) 100%
  );
  color: var(--dl-text-light);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  transition:
    background 0.4s ease,
    color 0.3s ease;
}

/* توهج خفيف أعلى الصفحة */
body.download-page::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -20%;
  width: 60vw;
  height: 60vw;
  background: var(--dl-primary);
  opacity: 0.15;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* ------------------------------------------------
   زر تبديل الوضع
   ------------------------------------------------ */
.theme-toggle {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top));
  left: calc(20px + env(safe-area-inset-left));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--dl-card-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px var(--dl-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 100;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: scale(1.1) rotate(-15deg);
  outline: none;
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ------------------------------------------------
   الـ Wrapper
   ------------------------------------------------ */
.download-wrapper {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------
   الكارد الرئيسي (Glassmorphism)
   ------------------------------------------------ */
.download-card {
  background: var(--dl-card-light);
  padding: 40px 30px;
  border-radius: var(--dl-radius);
  box-shadow: 0 20px 50px var(--dl-shadow);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  animation: dl-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

@keyframes dl-slide-up {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ------------------------------------------------
   أيقونة التطبيق
   ------------------------------------------------ */
.app-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 22px;
}

.app-icon {
  width: 110px;
  height: 110px;
  border-radius: 26px;
  display: flex;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  animation: dl-float 4s ease-in-out infinite;
  align-items: center;
}

@keyframes dl-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.icon-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  background: var(--dl-primary);
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.35;
  z-index: 1;
}

/* ------------------------------------------------
   شارة الإصدار
   ------------------------------------------------ */
.version-badge {
  display: inline-flex;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--dl-primary);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.version-badge::before {
  content: "●";
  font-size: 0.55rem;
  animation: dl-pulse 2s ease-in-out infinite;
}

@keyframes dl-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ------------------------------------------------
   النصوص
   ------------------------------------------------ */
.download-title {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.3;
  color: var(--dl-text-light);
  letter-spacing: -0.5px;
}

.gold-text {
  color: var(--dl-accent-gold);
}

.download-desc {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--dl-sub-light);
  margin: 0 0 28px;
  padding: 0 5px;
}

/* ------------------------------------------------
   زر التحميل
   ------------------------------------------------ */
.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(
    135deg,
    var(--dl-primary) 0%,
    var(--dl-primary-hover) 100%
  );
  color: #ffffff;
  text-decoration: none;
  border-radius: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--dl-shadow);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.download-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  animation: dl-shimmer 3s ease-in-out infinite;
}

@keyframes dl-shimmer {
  0% {
    left: -100%;
  }
  60% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

.download-btn:hover,
.download-btn:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px var(--dl-shadow);
  outline: none;
}

.download-btn:active {
  transform: translateY(1px) scale(0.98);
}

.download-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ------------------------------------------------
   الملاحظة السفلية
   ------------------------------------------------ */
.download-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--dl-sub-light);
  margin-top: 22px;
  opacity: 0.75;
  line-height: 1.5;
  padding: 0 10px;
}

.download-note svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ============================================================
   Responsive Design
   ============================================================ */

/* تابلت */
@media (min-width: 768px) {
  .download-wrapper {
    max-width: 500px;
  }
  .download-card {
    padding: 50px 45px;
  }
  .download-title {
    font-size: 2.1rem;
  }
  .app-icon {
    width: 130px;
    height: 130px;
  }
}

/* ديسكتوب */
@media (min-width: 1024px) {
  .download-wrapper {
    max-width: 520px;
  }
  .download-card {
    padding: 55px 50px;
  }
  .download-title {
    font-size: 2.3rem;
  }
}

/* موبايل صغير */
@media (max-width: 380px) {
  body.download-page {
    padding: 15px;
  }
  .download-card {
    padding: 30px 20px;
    border-radius: 24px;
  }
  .app-icon {
    width: 90px;
    height: 90px;
    border-radius: 22px;
  }
  .download-title {
    font-size: 1.55rem;
  }
  .download-desc {
    font-size: 0.88rem;
  }
  .download-btn {
    padding: 16px 18px;
    font-size: 1rem;
  }
  .theme-toggle {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
}

/* الوضع الأفقي على الموبايل (Landscape) */
@media (max-height: 500px) and (orientation: landscape) {
  body.download-page {
    align-items: flex-start;
    padding-top: 60px;
  }
  .download-card {
    padding: 25px 30px;
  }
  .app-icon {
    width: 70px;
    height: 70px;
  }
  .download-desc {
    display: none;
  }
}

/* دعم prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .app-icon,
  .download-btn::after,
  .download-card {
    animation: none !important;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}
body {
  user-select: none;
}
.card-header{
    display: grid;
    justify-content: space-around;
    align-items: center;
}
.download-btn svg {
  width: 24px !important;
  height: 24px !important;
  fill: currentColor;
  flex-shrink: 0;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}