/* ═══════════════════════════════════════════════════════════════════════
   Astro Chart Ultimate PRO — Mobile App Mode
   Version: 1.2 (Stable)
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════
   1) Bottom Bar
   ═══════════════════════════════════════════════════════ */
.ac-mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: none;
  background: var(--ac-bg2);
  border-top: 1px solid var(--ac-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.ac-mobile-nav.ac-mobile-nav-visible {
  transform: translateY(0);
}

.ac-mobile-nav-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 62px;
  max-width: 480px;
  margin: 0 auto;
}

.ac-mobile-nav-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ac-text2);
  font-family: inherit;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
}

.ac-mobile-nav-btn i {
  font-size: 21px;
  line-height: 1;
  display: block;
}

.ac-mobile-nav-btn span {
  font-size: 10.5px;
  line-height: 1.2;
  display: block;
}

.ac-mobile-nav-btn.active {
  color: var(--ac-gold);
}

.ac-mobile-nav-btn.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--ac-gold);
}

.ac-mobile-nav-btn .ac-mobile-loading-dot {
  position: absolute;
  top: 10px;
  right: 50%;
  margin-right: -18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ac-gold);
  animation: ac-mobile-pulse 1.2s ease-in-out infinite;
}

@keyframes ac-mobile-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.15); }
}



/* ═══════════════════════════════════════════════════════
   3) Edit Sheet
   ═══════════════════════════════════════════════════════ */
.ac-mobile-edit-sheet {
  position: fixed;
  inset: 0;
  z-index: 99998;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.3s;
}

.ac-mobile-edit-sheet.open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.ac-mobile-edit-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 28, 0.78);
  opacity: 0;
  transition: opacity 0.25s;
}

.ac-mobile-edit-sheet.open .ac-mobile-edit-scrim {
  opacity: 1;
}

.ac-mobile-edit-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ac-bg2);
  color: var(--ac-text);
  border-top: 1px solid var(--ac-border2);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ac-mobile-edit-sheet.open .ac-mobile-edit-panel {
  transform: translateY(0);
}

.ac-mobile-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--ac-border);
  flex-shrink: 0;
}

.ac-mobile-edit-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ac-gold);
}

.ac-mobile-edit-close {
  background: var(--ac-glass2);
  border: 0;
  color: var(--ac-text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  font-family: inherit;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ac-mobile-edit-close:hover { background: var(--ac-border); }

.ac-mobile-edit-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 24px;
  flex: 1;
}

.ac-mobile-edit-body .ac-card {
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  backdrop-filter: none !important;
}

.ac-mobile-edit-body .ac-divider { display: none; }

/* ═══════════════════════════════════════════════════════
   3.5) Loading Overlay داخل Edit Sheet
   ═══════════════════════════════════════════════════════ */
.ac-mobile-edit-panel {
  position: relative;   /* ✅ مطلوب لاحتواء الـ overlay */
}

.ac-mobile-loading {
  position: absolute;
  inset: 0;
  background: rgba(26, 15, 80, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: 20px 20px 0 0;
  pointer-events: none;
}
.ac-mobile-loading.visible {
  opacity: 1;
  pointer-events: auto;
}
.ac-mobile-loading-inner {
  text-align: center;
  padding: 24px;
  max-width: 280px;
}
.ac-mobile-loading-text {
  color: var(--ac-gold);
  font-size: 14px;
  font-weight: 600;
  margin-top: 18px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   4) App Mode — الجوال فقط
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  body.ac-mobile-app-mode .ac-mobile-section:not(.ac-mobile-active) {
    display: none !important;
  }

    body.ac-mobile-app-mode .ac-mobile-section.ac-mobile-active {
    display: block !important;
    /* ✅ تدفق طبيعي — الصفحة تُمرَّر بشكل عادي */
    padding: 14px 14px calc(80px + env(safe-area-inset-bottom, 0px));
    animation: ac-mobile-fade 150ms ease;
  }

  @keyframes ac-mobile-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  body.ac-mobile-app-mode .ac-header,
  body.ac-mobile-app-mode .ac-card.ac-mobile-hidden,
  body.ac-mobile-app-mode .ac-stars,
  body.ac-mobile-app-mode #ac-loading {
    display: none !important;
  }



  body.ac-mobile-app-mode .ac-mobile-nav.ac-mobile-nav-visible {
    display: block;
  }

  body.ac-mobile-app-mode #ac-map-section .ac-birth-card.ac-mobile-strip-active {
    display: none;
  }

  body.ac-mobile-app-mode .ac-insights-wrap {
    --acx-top: 0px;
  }

  html, body { touch-action: pan-x pan-y; }

  button, a, [role="button"], input[type="checkbox"], input[type="radio"],
  .ac-tab-btn, .ac-mobile-nav-btn, .ac-mobile-strip-edit,
  .ac-card-summary, .ac-card-close, .ac-why-btn {
    touch-action: manipulation;
  }

  input, select, textarea {
    font-size: 16px !important;
    touch-action: auto;
  }
}

/* ═══════════════════════════════════════════════════════
   5) الديسكتوب
   ═══════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .ac-mobile-nav,
  .ac-mobile-edit-sheet {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════
   6) تقليل الحركة
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ac-mobile-nav,
  .ac-mobile-section,
  .ac-mobile-edit-sheet,
  .ac-mobile-edit-panel {
    transition: none !important;
    animation: none !important;
  }
}