/* ================================================ */
/* SCREEN BASE                                      */
/* ================================================ */

.screen {
  position: relative; z-index: 1;
  min-height: 100vh; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: calc(2.5rem + var(--safe-top)) 1.5rem calc(2.5rem + var(--safe-bottom));
}

.screen.active { display: flex; }

/* ================================================ */
/* BRAND BLOCK                                      */
/* ================================================ */

.pair-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 2rem; }

.pair-shield {
  width: 7rem; height: 7rem; object-fit: contain; margin-bottom: 1.1rem;
  filter:
    drop-shadow(0 0 12px rgba(201,162,77,.55))
    drop-shadow(0 0 28px rgba(201,162,77,.32))
    drop-shadow(0 0 56px rgba(201,162,77,.14))
    drop-shadow(0 8px 22px rgba(0,0,0,.38));
}

.pair-wordmark {
  font-family: "Mr De Haviland", "Times New Roman", serif;
  font-size: 4.2rem; font-weight: 400; line-height: .82;
  letter-spacing: .01em; color: #f6f2e9;
  text-shadow: 0 0 28px rgba(201,162,77,.12), 0 0 2px rgba(255,255,255,.04);
}

.pair-sub {
  margin-top: .32rem; font-size: .64rem; font-weight: 600;
  letter-spacing: .26em; text-transform: uppercase; color: rgba(174,182,198,.68);
}

.pair-divider {
  width: 44px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,162,77,.55), transparent);
  margin: .85rem auto 0;
}

.pair-tagline {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-size: 1.05rem; color: var(--text-secondary);
  margin-bottom: 2rem; text-align: center; opacity: .72; letter-spacing: .02em;
}

.pair-footer {
  margin-top: 2rem; font-size: .62rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-secondary); opacity: .28; text-align: center;
}

/* ================================================ */
/* PLAN SELECTION SCREEN                            */
/* ================================================ */

#planScreen {
  justify-content: flex-start;
  padding-top: calc(2rem + var(--safe-top));
  overflow-y: auto;
}

.plan-header { width: 100%; max-width: 520px; text-align: center; margin-bottom: 1.5rem; }

.plan-header-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-weight: 600; font-size: 2rem;
  color: var(--text-primary); line-height: 1.1; margin-bottom: .4rem;
}

.plan-header-sub { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }

.plan-stack { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: .85rem; padding-bottom: 2rem; }

.plan-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.032), rgba(0,0,0,.22)),
    linear-gradient(180deg, rgba(17,24,39,.96), rgba(11,18,30,.98));
  border: 1px solid var(--border); border-radius: 1.1rem; padding: 1.4rem;
  display: flex; flex-direction: column; gap: .75rem;
  position: relative; overflow: hidden; transition: border-color .2s, box-shadow .2s;
}

.plan-card.featured { border-color: var(--accent-gold-border); box-shadow: 0 0 36px rgba(201,162,77,.12); }

.plan-card-badge {
  position: absolute; top: .9rem; right: .9rem;
  font-size: .58rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  padding: .24rem .65rem; border-radius: 999px;
  background: var(--accent-gold-soft); border: 1px solid var(--accent-gold-border); color: var(--accent-gold);
}

.plan-card-top { display: flex; align-items: baseline; gap: .75rem; }

.plan-card-name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-weight: 600; font-size: 1.35rem; color: var(--text-primary);
}

.plan-card-price { font-size: 1.25rem; font-weight: 700; color: var(--accent-gold); }
.plan-card-price span { font-size: .75rem; font-weight: 400; color: var(--text-muted); }

.plan-card-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .38rem; }

.plan-card-features li {
  font-size: .82rem; color: var(--text-muted);
  display: flex; align-items: flex-start; gap: .55rem; line-height: 1.4;
}

.plan-card-features li::before { content: "✦"; color: var(--accent-gold); font-size: .58rem; margin-top: .2rem; flex-shrink: 0; }

.plan-select-btn {
  width: 100%; padding: .78rem; border-radius: var(--radius-md);
  border: 1px solid var(--accent-gold-border); background: var(--accent-gold-soft); color: var(--accent-gold);
  font-family: "Jost", sans-serif; font-weight: 700; font-size: .8rem;
  letter-spacing: .12em; text-transform: uppercase; cursor: pointer; min-height: 0;
  transition: background .18s, border-color .18s, transform .1s;
}

.plan-select-btn.featured-btn {
  background: linear-gradient(135deg, #c9a24d, #a8813a); color: #08101b;
  border-color: rgba(201,162,77,.50);
  box-shadow: 0 0 20px rgba(201,162,77,.24), 0 4px 14px rgba(0,0,0,.24);
}

.plan-select-btn:active   { transform: scale(.985); }
.plan-select-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ================================================ */
/* COMPANION SHELL                                  */
/* ================================================ */

#ah-shell { position: relative; z-index: 1; min-height: 100vh; display: none; flex-direction: column; padding-bottom: 3rem; }
#ah-shell.active { display: flex; }

.ah-content { flex: 1; width: 100%; max-width: 42rem; margin: 0 auto; }

/* ================================================ */
/* HEADER                                           */
/* ================================================ */

#ah-header {
  position: sticky; top: 0; z-index: 100;
  padding: calc(.8rem + var(--safe-top)) 1.05rem .85rem;
  background: rgba(7,12,22,.88);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(214,220,232,.08);
}

.ah-header-inner { width: 100%; max-width: 42rem; margin: 0 auto; }

.ah-brand { display: flex; align-items: center; gap: .9rem; margin-bottom: .95rem; padding-right: 2.4rem; }

.ah-brand-shield {
  width: 2.75rem; height: 2.75rem; object-fit: contain; flex-shrink: 0;
  filter:
    drop-shadow(0 0 10px rgba(201,162,77,.60))
    drop-shadow(0 0 22px rgba(201,162,77,.35))
    drop-shadow(0 0 40px rgba(201,162,77,.18))
    drop-shadow(0 4px 14px rgba(0,0,0,.40));
}

.ah-brand-wording { display: flex; flex-direction: column; justify-content: center; min-width: 0; }

.ah-wordmark {
  font-family: "Mr De Haviland", "Times New Roman", serif;
  font-size: 2.6rem; font-weight: 400; line-height: .82; letter-spacing: .01em; color: #f6f2e9;
  text-shadow: 0 0 22px rgba(201,162,77,.14), 0 0 2px rgba(255,255,255,.04);
}

.ah-brand-sub { margin-top: .18rem; font-size: .62rem; letter-spacing: .24em; text-transform: uppercase; color: rgba(174,182,198,.68); }

/* ================================================ */
/* HAMBURGER                                        */
/* ================================================ */

#hamburgerBtn {
  position: absolute; top: calc(.9rem + var(--safe-top)); right: 1.05rem; z-index: 110;
  width: 2.4rem; height: 2.4rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .28rem;
  cursor: pointer; padding: .3rem; border-radius: .6rem;
  transition: background .18s; -webkit-tap-highlight-color: transparent;
}

#hamburgerBtn:active { background: rgba(201,162,77,.08); }

.hb-bar { width: 1.2rem; height: 2px; border-radius: 2px; background: rgba(174,182,198,.72); transition: background .18s; }
#hamburgerBtn:active .hb-bar { background: var(--accent-gold); }

/* ================================================ */
/* TAB BAR                                          */
/* ================================================ */

.ah-tabs { display: flex; border-bottom: 1px solid rgba(214,220,232,.07); margin: 0 -.1rem; }

.ah-tab {
  flex: 1; padding: .52rem .5rem .62rem; background: transparent; border: none;
  border-bottom: 2px solid transparent; color: var(--text-secondary);
  font-family: "Jost", sans-serif; font-size: .75rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
  transition: color .2s, border-color .2s, box-shadow .2s;
  min-height: 0; border-radius: 0; box-shadow: none; margin-bottom: -1px;
  -webkit-tap-highlight-color: transparent;
}

.ah-tab:active { background: transparent; transform: none; }
.ah-tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); box-shadow: 0 2px 18px rgba(201,162,77,.18); }

/* ================================================ */
/* VIEWS                                            */
/* ================================================ */

#shoppingView, #purchasedView { padding: .4rem 1rem 1.2rem; }

.ah-loading {
  padding: 2rem 1rem; text-align: center;
  font-size: .78rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-muted);
  animation: loadingPulse 1.4s ease-in-out infinite;
}

/* ================================================ */
/* DRAWER                                           */
/* ================================================ */

#drawerOverlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.52); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none;
}

#drawerOverlay.open { display: block; }

#menuDrawer {
  position: fixed; top: 0; right: 0; width: min(82vw, 300px); height: 100%; z-index: 201;
  padding: calc(1.4rem + var(--safe-top)) 1.2rem 2rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,.022), rgba(0,0,0,.10)),
    linear-gradient(180deg, rgba(14,22,36,.97), rgba(8,14,26,.99));
  border-left: 1px solid rgba(214,220,232,.09);
  box-shadow: -18px 0 48px rgba(0,0,0,.36);
  display: flex; flex-direction: column; gap: 1rem;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
  overflow-y: auto;
}

#menuDrawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .4rem; padding-bottom: .75rem;
  border-bottom: 1px solid rgba(214,220,232,.08);
}

.drawer-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; font-size: 1.35rem; font-weight: 600;
  color: var(--accent-gold); text-shadow: 0 0 14px rgba(201,162,77,.10);
}

#drawerCloseBtn {
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: .55rem;
  background: transparent; color: var(--text-secondary);
  font-size: 1rem; cursor: pointer; min-height: 0; padding: 0;
  transition: border-color .18s, color .18s;
}

#drawerCloseBtn:hover { border-color: var(--border-strong); color: var(--text-primary); }

.drawer-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(0,0,0,.18)),
    linear-gradient(180deg, rgba(17,24,39,.92), rgba(11,18,30,.96));
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.018), var(--shadow-card);
}

.drawer-card-title { font-size: .68rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 .75rem; }

.drawer-account-email { font-size: .82rem; color: var(--text-secondary); margin-bottom: .5rem; word-break: break-all; }

.drawer-account-plan { font-size: .70rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-gold); margin-bottom: .85rem; }

.drawer-btn {
  display: block; width: 100%; padding: .78rem 1rem;
  border: 1px solid var(--accent-gold-border); border-radius: var(--radius-md);
  background: var(--accent-gold-soft); color: var(--accent-gold);
  font-family: "Jost", sans-serif; font-size: .76rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer; min-height: 0; text-align: center;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.drawer-btn + .drawer-btn { margin-top: .55rem; }
.drawer-btn:active   { transform: scale(.984); background: rgba(201,162,77,.20); }
.drawer-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.drawer-btn.danger { background: rgba(186,101,91,.10); border-color: rgba(186,101,91,.28); color: #d48f83; }
.drawer-btn.danger:active { background: rgba(186,101,91,.18); }

#photoInput {
  display: block; width: 100%; margin-bottom: .65rem;
  font-size: .78rem; color: var(--text-secondary);
  background: rgba(0,0,0,.18); border: 1px solid var(--border);
  border-radius: .75rem; padding: .55rem .75rem; cursor: pointer;
}

#photoInput::file-selector-button {
  background: rgba(201,162,77,.10); border: 1px solid var(--accent-gold-border);
  border-radius: .5rem; color: var(--accent-gold);
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: .3rem .7rem; margin-right: .65rem; cursor: pointer;
}

#uploadStatus { margin-top: .55rem; font-size: .72rem; letter-spacing: .10em; color: var(--text-muted); min-height: 1rem; }

.drawer-card-desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: -.25rem 0 .75rem;
  opacity: .80;
}

.receipt-upload-status {
  font-size: .78rem;
  min-height: 1.2em;
  margin: .6rem 0 0;
  text-align: center;
  color: var(--text-muted);
}

.receipt-upload-status.success { color: var(--anchor-green, #6db87a); }
.receipt-upload-status.error   { color: #d48f83; }
