/* ── Astro: Subscription AI Astrologer — light/gold theme ─────────────────── */

/* ── Layout ──────────────────────────────────────────────────────────────── */
.astro-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* shrinks with mobile browser chrome */
  background: var(--bg);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.astro-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
  background: rgba(255,251,235,0.97);
  border-bottom: 1px solid rgba(180,83,9,0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 1rem;
}

.astro-header-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.astro-header-brand .ah-star {
  color: var(--gold-light);
  font-size: 1.1rem;
  text-shadow: 0 0 12px rgba(217,119,6,0.55);
}
.astro-header-brand .ah-sub {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 400;
  margin-left: 0.1rem;
}

.astro-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.astro-sub-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.astro-sub-badge.active   { background: rgba(180,83,9,0.12); color: var(--gold-primary); border: 1px solid rgba(180,83,9,0.35); }
.astro-sub-badge.inactive { background: rgba(120,97,74,0.07); color: var(--text-muted); border: 1px solid rgba(120,97,74,0.2); }

.astro-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(180,83,9,0.4);
}
.astro-avatar-fallback {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b45309, #d97706);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff;
}

.astro-btn-logout {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid rgba(120,97,74,0.22);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.astro-btn-logout:hover { color: var(--text); border-color: rgba(180,83,9,0.4); }

/* ── Messages area ────────────────────────────────────────────────────────── */
.astro-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
  background: var(--bg);
}
.astro-messages::-webkit-scrollbar { width: 4px; }
.astro-messages::-webkit-scrollbar-thumb { background: rgba(180,83,9,0.25); border-radius: 2px; }

/* ── Chat bubbles ─────────────────────────────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  max-width: 760px;
  width: 100%;
}
.msg-row.user  { margin-left: auto; flex-direction: row-reverse; }
.msg-row.astro { margin-right: auto; }

.msg-avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(180,83,9,0.35), rgba(217,119,6,0.35));
  border: 1px solid rgba(180,83,9,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}

.msg-bubble {
  max-width: min(72%, 540px);
  padding: 0.8rem 1rem;
  border-radius: 16px;
  font-size: 0.93rem;
  line-height: 1.65;
  word-break: break-word;
}
.msg-row.astro .msg-bubble {
  background: #ffffff;
  border: 1px solid rgba(180,83,9,0.18);
  border-bottom-left-radius: 4px;
  color: var(--text);
  box-shadow: 0 1px 8px rgba(180,83,9,0.07);
}
.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, rgba(180,83,9,0.12), rgba(217,119,6,0.08));
  border: 1px solid rgba(180,83,9,0.22);
  border-bottom-right-radius: 4px;
  color: var(--text);
}

/* ── Typing indicator ─────────────────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.75rem 1rem;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold-light);
  opacity: 0.4;
  animation: td-pulse 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes td-pulse {
  0%,80%,100% { opacity: 0.3; transform: scale(0.85); }
  40%          { opacity: 1;   transform: scale(1.1);  }
}

/* ── Input bar ────────────────────────────────────────────────────────────── */
.astro-input-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: rgba(255,251,235,0.97);
  border-top: 1px solid rgba(180,83,9,0.14);
}

.astro-input {
  flex: 1 1 auto;
  background: #ffffff;
  border: 1px solid rgba(180,83,9,0.22);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.93rem;
  font-family: inherit;
  padding: 0.65rem 0.9rem;
  resize: none;
  min-height: 44px;
  max-height: 130px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.astro-input:focus {
  border-color: rgba(180,83,9,0.5);
  box-shadow: 0 0 0 3px rgba(180,83,9,0.09);
}
.astro-input::placeholder { color: var(--text-faint); }

.astro-send-btn {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #b45309, #d97706);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
}
.astro-send-btn:hover:not(:disabled)  { opacity: 0.88; transform: scale(1.05); }
.astro-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Login gate ───────────────────────────────────────────────────────────── */
.astro-gate {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 1.2rem;
}

.astro-gate-star {
  font-size: 3rem;
  color: var(--gold-light);
  text-shadow: 0 0 18px rgba(217,119,6,0.5), 0 0 40px rgba(180,83,9,0.25);
  animation: td-pulse 3s ease-in-out infinite;
}

.astro-gate h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  background: linear-gradient(135deg, #b45309, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.astro-gate p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 480px;
}

.astro-gate-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 0.5rem 0;
}
.astro-tier-chip {
  background: rgba(180,83,9,0.08);
  border: 1px solid rgba(180,83,9,0.25);
  border-radius: 99px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  color: var(--gold-primary);
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  color: #1f1f1f;
  font-size: 0.93rem;
  font-weight: 600;
  border: 1px solid rgba(120,97,74,0.2);
  border-radius: 10px;
  padding: 0.7rem 1.3rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
}
.btn-google:hover { box-shadow: 0 4px 20px rgba(120,97,74,0.18); transform: translateY(-1px); }
.btn-google svg  { width: 18px; height: 18px; flex: 0 0 18px; }

/* ── Paywall overlay ──────────────────────────────────────────────────────── */
.astro-paywall {
  position: absolute;
  inset: 0;
  background: rgba(255,251,235,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.astro-paywall-card {
  background: #ffffff;
  border: 1px solid rgba(180,83,9,0.28);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(120,97,74,0.18);
}
.astro-paywall-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.astro-paywall-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.plan-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.plan-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(180,83,9,0.06);
  border: 1px solid rgba(180,83,9,0.2);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.plan-btn:hover { background: rgba(180,83,9,0.12); border-color: rgba(180,83,9,0.4); }
.plan-btn .plan-name { font-size: 0.9rem; font-weight: 600; }
.plan-btn .plan-desc { font-size: 0.73rem; color: var(--text-muted); margin-top: 1px; }
.plan-btn .plan-price { font-size: 1rem; font-weight: 700; color: var(--gold-primary); white-space: nowrap; }

/* ── Free counter strip ───────────────────────────────────────────────────── */
.free-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
  border-top: 1px solid rgba(180,83,9,0.1);
  margin-top: auto;
}
.free-counter span { color: var(--gold-primary); font-weight: 600; }

/* ── Logged-out static layout ─────────────────────────────────────────────── */
.astro-wrap--static {
  height: auto;
  min-height: unset;
  overflow: visible;
}
.astro-wrap--static .astro-gate {
  min-height: 88vh;
}

/* ── Scroll hint ──────────────────────────────────────────────────────────── */
.ap-scroll-hint {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.ap-scroll-hint:hover { color: var(--gold-primary); }

/* ── Pricing section ──────────────────────────────────────────────────────── */
.astro-pricing-section {
  padding: 5rem 1.5rem 4rem;
  background: var(--bg);
  border-top: 1px solid rgba(180,83,9,0.14);
}

.ap-heading {
  text-align: center;
  margin-bottom: 3rem;
}
.ap-heading h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  background: linear-gradient(135deg, #b45309, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}
.ap-heading p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 4-col → 2-col → 1-col grid */
.ap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  max-width: 1120px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 960px) {
  .ap-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ap-grid { grid-template-columns: 1fr; }
}

/* Card base */
.ap-card {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(180,83,9,0.18);
  border-radius: 20px;
  padding: 2rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.ap-card:hover {
  border-color: rgba(180,83,9,0.4);
  box-shadow: 0 8px 30px rgba(180,83,9,0.1);
  transform: translateY(-3px);
}

/* Best value card */
.ap-card--best {
  border-color: rgba(217,119,6,0.45);
  box-shadow: 0 0 0 1px rgba(217,119,6,0.2), 0 8px 40px rgba(180,83,9,0.12);
}
.ap-card--best:hover {
  border-color: rgba(217,119,6,0.7);
  box-shadow: 0 0 0 1px rgba(217,119,6,0.45), 0 12px 48px rgba(180,83,9,0.2);
  transform: translateY(-4px);
}

/* Best value badge */
.ap-best-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.85rem;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 0 16px rgba(180,83,9,0.4);
}

.ap-plan-name {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 0.25rem;
}

.ap-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.ap-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.ap-price--gradient {
  background: linear-gradient(135deg, #b45309, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ap-period {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ap-pitch {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.25rem;
}

.ap-divider {
  height: 1px;
  background: rgba(180,83,9,0.14);
  margin: 0.75rem 0;
}

/* Benefit list */
.ap-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}
.ap-benefits li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 1.4rem;
  position: relative;
  line-height: 1.5;
}
.ap-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 0.8rem;
}

/* CTA buttons */
.ap-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.72rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  box-shadow: 0 4px 18px rgba(180,83,9,0.28);
  transition: opacity 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.ap-btn:hover {
  opacity: 0.9;
  background: linear-gradient(135deg, #92400e, #b45309);
  box-shadow: 0 6px 24px rgba(180,83,9,0.42);
  transform: translateY(-1px);
}
.ap-btn--primary {
  background: linear-gradient(135deg, #b45309, #d97706);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px rgba(180,83,9,0.28);
}
.ap-btn--primary:hover {
  opacity: 0.9;
  background: linear-gradient(135deg, #92400e, #b45309);
  box-shadow: 0 6px 24px rgba(180,83,9,0.42);
}
.ap-btn-free {
  background: linear-gradient(135deg, #b45309, #d97706);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px rgba(180,83,9,0.28);
}
.ap-btn-free:hover {
  opacity: 0.9;
  background: linear-gradient(135deg, #92400e, #b45309);
  box-shadow: 0 6px 24px rgba(180,83,9,0.42);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .astro-header { padding: 0.7rem 0.9rem; }
  .astro-header-brand .ah-sub { display: none; }
  .msg-bubble { max-width: 88%; font-size: 0.88rem; }
  .astro-input-bar { padding: 0.65rem 0.7rem; }
  .astro-paywall-card { padding: 1.5rem 1.25rem; }
  .astro-pricing-section { padding: 3.5rem 1rem 3rem; }
  .ap-card { padding: 1.75rem 1.25rem 1.5rem; }
}

/* ── Upgrade bar (shown instead of input when free limit hit) ─────────────── */
.astro-upgrade-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: #fff8ed;
  border-top: 2px solid rgba(180,83,9,0.3);
  flex-shrink: 0;
  overflow-y: auto; /* safety net if content taller than remaining space */
}
@media (prefers-color-scheme: dark) {
  .astro-upgrade-bar { background: #241c12; }
}
.astro-upgrade-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 340px;
}
.astro-upgrade-icon {
  font-size: 2rem;
  line-height: 1;
}
.astro-upgrade-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.astro-upgrade-text strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1c1208);
}
.astro-upgrade-text span {
  font-size: 0.86rem;
  color: rgba(28,18,8,0.6);
}
@media (prefers-color-scheme: dark) {
  .astro-upgrade-text strong { color: #f5f0e8; }
  .astro-upgrade-text span   { color: rgba(245,240,232,0.55); }
}
.astro-upgrade-btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff !important;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none !important;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(180,83,9,0.4);
  letter-spacing: 0.01em;
  transition: opacity 0.15s, transform 0.15s;
}
.astro-upgrade-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* ── Kundli charts ────────────────────────────────────────────────────────── */
.kundli-charts {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0.25rem 0 1rem;
  padding: 1rem 1rem 0.75rem;
  background: rgba(255,251,235,0.7);
  border: 1px solid rgba(180,83,9,0.18);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(180,83,9,0.07);
}
.kundli-chart-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.kundli-chart-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(180,83,9,0.65);
}
.kundli-charts svg {
  display: block;
  border-radius: 6px;
  background: #fffef8;
  max-width: 100%;
  height: auto;
}
@media (max-width: 420px) {
  .kundli-charts { gap: 0.75rem; }
  .kundli-charts svg { width: 140px; height: 140px; }
}
