/* ============================================================================
   account.css — YourSky account page styling
   ----------------------------------------------------------------------------
   Matches the visual language established in order.html: Cinzel for
   headers/labels, Cormorant Garamond for body, gold accents on dark
   backgrounds, indigo for informational notices, red-mira for warnings.
   ============================================================================ */

:root {
    --bg-dark: #000000;
    --bg-frame: #2a1f14;
    --bg-card: #111111;
    --parchment: #e8dcc4;
    --parchment-dark: #d4c4a8;
    --gold: #c9a227;
    --gold-light: #e8c547;
    --gold-dim: rgba(201,162,39,0.15);
    --text-light: #f5f0e6;
    --border-ornate: #8b7355;
    --red-mira: #8b2020;
    --indigo: #2a2d5e;
    --indigo-light: #4a4d8e;
    --star-white: #f0e8d8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================================
   STARFIELD — same subtle backdrop as order page
   ============================================================================ */
.starfield {
    position: fixed; inset: 0; z-index: 0;
    pointer-events: none; overflow: hidden;
}
.starfield .star {
    position: absolute; width: 2px; height: 2px;
    background: var(--star-white); border-radius: 50%;
    animation: twinkle var(--dur) ease-in-out infinite; opacity: 0;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.1; }
    50% { opacity: var(--peak); }
}

section { position: relative; z-index: 2; }

/* ============================================================================
   HERO
   ============================================================================ */
.account-hero {
    margin-top: 62px;
    padding: 4rem 2rem 2rem;
    text-align: center;
    position: relative;
    z-index: 2;
}
.account-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(42,45,94,0.18) 0%, transparent 60%);
    z-index: -1;
}
.hero-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 0.72rem; font-weight: 500;
    letter-spacing: 0.32em; text-transform: uppercase;
    color: var(--gold); opacity: 0.75;
    margin-bottom: 1.5rem;
}
.hero-title {
    font-family: 'Cinzel', serif;
    font-size: 2.4rem; font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--parchment);
    margin-bottom: 0.75rem;
}
.hero-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem; font-style: italic;
    color: var(--gold);
    letter-spacing: 0.04em;
}

/* ============================================================================
   CONTENT WRAP
   ============================================================================ */
.account-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem 2rem 5rem;
    position: relative;
    z-index: 2;
}

/* ============================================================================
   SECTIONS — matches order.html form-section pattern
   ============================================================================ */
.account-section {
    margin-bottom: 3.5rem;
}
.section-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem; font-weight: 500;
    letter-spacing: 0.28em; text-transform: uppercase;
    color: var(--gold); opacity: 0.7;
    margin-bottom: 0.5rem;
}
.section-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem; font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--parchment);
    margin-bottom: 0.5rem;
}
.section-help {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    color: var(--text-light); opacity: 0.7;
    font-style: italic;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: rgba(17,17,17,0.6);
    border: 1px solid rgba(139,115,85,0.2);
    padding: 2rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    margin-bottom: 1rem;
}

/* ============================================================================
   FORM FIELDS — matches order.html exactly
   ============================================================================ */
.form-field {
    margin-bottom: 1.25rem;
}
.form-field label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gold); opacity: 0.85;
    margin-bottom: 0.5rem;
}
.form-field label .optional {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem; font-style: italic;
    text-transform: none; letter-spacing: 0;
    opacity: 0.6;
    margin-left: 0.5rem;
}
.form-field input,
.form-field select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(139,115,85,0.4);
    color: var(--text-light);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    transition: border-color 0.15s;
}
.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--gold);
}
.form-field input::placeholder {
    color: var(--text-light); opacity: 0.35;
    font-style: italic;
}
.form-field input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.field-help {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem; font-style: italic;
    color: var(--text-light); opacity: 0.55;
    margin-top: 0.4rem;
    line-height: 1.5;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
button.btn-primary {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem; font-weight: 500;
    letter-spacing: 0.22em; text-transform: uppercase;
    background: var(--gold);
    color: #000;
    border: none;
    padding: 1rem 2.5rem;
    cursor: pointer;
    transition: background 0.15s;
}
button.btn-primary:hover:not(:disabled) {
    background: var(--gold-light);
}
button.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button.btn-secondary {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    background: transparent;
    color: var(--parchment);
    border: 1px solid rgba(139,115,85,0.5);
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
button.btn-secondary:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
}

button.btn-danger {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    background: transparent;
    color: rgba(232,220,196,0.7);
    border: 1px solid rgba(139,32,32,0.4);
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    transition: all 0.15s;
}
button.btn-danger:hover:not(:disabled) {
    border-color: var(--red-mira);
    color: #d97757;
    background: rgba(139,32,32,0.08);
}

.btn-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================================
   SAVE STATUS
   ============================================================================ */
.save-status {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem; font-style: italic;
    color: var(--text-light); opacity: 0;
    transition: opacity 0.3s ease;
    min-height: 1.2rem;
}
.save-status.shown { opacity: 0.7; }
.save-status.success { color: var(--gold); opacity: 1; }
.save-status.error { color: #d97757; opacity: 1; }

/* ============================================================================
   SUBSCRIPTIONS SECTION
   ============================================================================ */

/* Personal | Gifts toggle */
.subs-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid rgba(139,115,85,0.2);
}
.subs-toggle-btn {
    background: none;
    border: none;
    padding: 0.85rem 1.5rem;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--text-light); opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.subs-toggle-btn:hover { opacity: 0.85; color: var(--gold); }
.subs-toggle-btn.active {
    opacity: 1;
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.subs-view { min-height: 120px; }

/* Subscription list rows (placeholder until Phase D — same shape will populate later) */
.sub-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(139,115,85,0.15);
}
.sub-row:last-child { border-bottom: none; }
.sub-info { flex: 1; min-width: 0; }
.sub-tier {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem; font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--parchment);
    margin-bottom: 0.25rem;
}
.sub-meta {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--text-light); opacity: 0.65;
    line-height: 1.5;
}
.sub-meta .meta-sep {
    color: var(--gold); opacity: 0.4;
    margin: 0 0.5rem;
}

/* Subscription card — the real per-subscription row rendered by account.js
   loadSubscriptionsSection / renderSubCard. Used in both Personal and Gifts
   views. */
.sub-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(139,115,85,0.12);
}
.sub-card:last-child { border-bottom: none; }
.sub-card-main { flex: 1; min-width: 0; }
.sub-tradition {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem; font-style: italic;
    color: var(--text-light); opacity: 0.75;
    margin-bottom: 0.4rem;
}
.sub-status {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem; font-weight: 500;
    letter-spacing: 0.16em; text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.sub-status-gold { color: var(--gold); }
.sub-status-warmgrey { color: var(--parchment-dark); opacity: 0.75; }
.sub-status-dim { color: var(--text-light); opacity: 0.45; }
.sub-status-warning { color: #d97757; }

.sub-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: flex-start;
}

/* Smaller button variant for inline card actions. */
button.btn-sm {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    padding: 0.45rem 0.95rem;
}

/* "Subscribe to another tier" link shown inside a recipient block that
   already has at least one sub. Sits below the sub list. */
.gift-recipient-subscribe-more {
    margin-top: 0.75rem;
    padding-left: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem; font-style: italic;
}
.gift-recipient-subscribe-more a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(201,162,39,0.3);
    padding-bottom: 1px;
    transition: border-color 0.15s;
}
.gift-recipient-subscribe-more a:hover {
    border-bottom-color: var(--gold);
}
.gift-recipient-no-subs a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(201,162,39,0.3);
}
.gift-recipient-no-subs a:hover {
    border-bottom-color: var(--gold);
}

/* Gift recipient block — recipient header + their subscriptions nested */
.gift-recipient-block {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(139,115,85,0.15);
}
.gift-recipient-block:last-child { border-bottom: none; }
.gift-recipient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}
.gift-recipient-info { flex: 1; min-width: 0; }
.gift-recipient-label {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem; font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--parchment);
    margin-bottom: 0.25rem;
}
.gift-recipient-meta {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--text-light); opacity: 0.65;
    line-height: 1.5;
}
.gift-recipient-meta .meta-sep {
    color: var(--gold); opacity: 0.4;
    margin: 0 0.5rem;
}
.gift-recipient-actions {
    display: flex; gap: 0.5rem;
    flex-shrink: 0;
}
.gift-recipient-subs {
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(139,115,85,0.15);
}
.gift-recipient-no-subs {
    margin-top: 0.4rem;
    padding-left: 1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem; font-style: italic;
    color: var(--text-light); opacity: 0.5;
}

.gifts-add-row {
    margin-top: 1.5rem;
    text-align: center;
}

/* Empty state with CurrentSky description and link button.
   Used in Personal view (no subs) and Gifts view (no recipients). */
.empty-state-currentsky {
    text-align: center;
    padding: 1.5rem 1rem 1rem;
}
.empty-state-currentsky .empty-quote {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem; font-style: italic;
    color: var(--text-light); opacity: 0.75;
    line-height: 1.65;
    max-width: 540px;
    margin: 0 auto 2rem;
}
.empty-state-currentsky .empty-link {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem; font-weight: 500;
    letter-spacing: 0.2em; text-transform: uppercase;
    background: var(--gold);
    color: #000;
    padding: 0.85rem 2rem;
    text-decoration: none;
    transition: background 0.15s;
}
.empty-state-currentsky .empty-link:hover {
    background: var(--gold-light);
}

/* ============================================================================
   PERMISSION NOTICE — for the recipient form
   ============================================================================ */
.permission-notice {
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(42,45,94,0.12);
    border-left: 2px solid var(--indigo-light);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.98rem; line-height: 1.55;
    color: var(--text-light); opacity: 0.85;
    font-style: italic;
}

/* ============================================================================
   MODAL — used for recipient add/edit forms
   ============================================================================ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    overflow-y: auto;
    padding: 4rem 1rem;
}
.modal-backdrop.shown { display: block; }
.modal {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid rgba(139,115,85,0.4);
    padding: 2rem;
}
.modal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem; font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--parchment);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(139,115,85,0.2);
}

/* ============================================================================
   ERROR + INFO PANELS
   ============================================================================ */
.form-error {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: rgba(139,32,32,0.15);
    border-left: 2px solid var(--red-mira);
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    color: var(--text-light);
    display: none;
}
.form-error.shown { display: block; }

.placeholder-card {
    padding: 1.75rem 2rem;
    border: 1px dashed rgba(139,115,85,0.3);
    background: rgba(17,17,17,0.3);
    color: var(--text-light); opacity: 0.55;
    font-style: italic;
    text-align: center;
    line-height: 1.6;
}

/* ============================================================================
   LOADING
   ============================================================================ */
.loading {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-light);
    opacity: 0.5;
    font-style: italic;
}

/* ============================================================================
   MOBILE
   ============================================================================ */
@media (max-width: 700px) {
    .account-hero { padding: 3rem 1.25rem 1.5rem; }
    .hero-title { font-size: 1.8rem; letter-spacing: 0.12em; }
    .account-wrap { padding: 0.5rem 1.25rem 3rem; }
    .card { padding: 1.5rem 1.25rem; }
    .form-row { grid-template-columns: 1fr; gap: 0; }

    .subs-toggle-btn { padding: 0.7rem 1rem; font-size: 0.7rem; }

    .gift-recipient-header,
    .sub-row,
    .sub-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .gift-recipient-actions,
    .sub-actions { justify-content: flex-end; }

    .modal { padding: 1.5rem 1.25rem; }
}
