/* ─────────────────────────────────────────────────────────────────────────
   Account Modal — Silver / Mac-style
   Inspired by macOS system panels: clean whites, subtle grays, blue accents.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.account-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem 2rem;
    overflow-y: auto;
}

/* ── Modal shell ─────────────────────────────────────────────────────────── */
.account-modal {
    background: transparent;
    /* corners: .modal-shell (css/modal-header.css) */
    box-shadow:
        0 0 0 0.5px rgba(0,0,0,0.12),
        0 4px 16px rgba(0,0,0,0.14),
        0 24px 60px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 620px;
    overflow: hidden;
    animation: acctModalIn 0.18s cubic-bezier(0.3, 0, 0.2, 1);
}

@keyframes acctModalIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
/* Header bar: the one header bar (css/modal-header.css). Only the drag
   cursor is this window's own. */
.account-modal-header {
    cursor: grab;
}
.account-modal-header:active {
    cursor: grabbing;
}

/* Sign Out — shared .modal-ctl; the red hover is specific */
.account-btn-signout-header:hover {
    background: rgba(255, 59, 48, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}


/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.account-tabs {
    background: var(--background);
    border-bottom: 1px solid rgba(0, 0, 0, 0.09);
    display: flex;
    padding: 0 1.25rem;
    gap: 0.25rem;
}

.account-tab {
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    padding: 0.65rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.13s, border-color 0.13s;
    white-space: nowrap;
}
.account-tab:hover    { color: var(--text-primary); }
.account-tab.active   { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── Body scroll area ────────────────────────────────────────────────────── */
.account-modal-body {
    background: var(--background);
    border-radius: 0;
    padding: 1rem;
    max-height: calc(100dvh - 14rem);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* ── State messages ──────────────────────────────────────────────────────── */
.account-loading,
.account-error,
.account-empty {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.account-error { color: var(--danger); }

/* ── Section cards ───────────────────────────────────────────────────────── */
.account-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem 1.125rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.account-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin: 0 0 0.75rem;
}
.account-section-title-danger { color: var(--danger); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.account-form {}

.account-field-row {
    margin-bottom: 0.65rem;
}

.account-field-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.account-field-three {
    display: grid;
    grid-template-columns: 1fr 0.65fr 0.65fr;
    gap: 0.65rem;
}

.account-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.28rem;
    letter-spacing: 0.01em;
}
.account-required { color: var(--danger); }

.account-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--surface);
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.13s, box-shadow 0.13s;
}
.account-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}
.account-input:disabled {
    background: var(--background);
    color: var(--text-secondary);
    cursor: default;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.account-actions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Primary — macOS blue */
.account-btn-primary {
    background: var(--primary);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1.1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.13s, transform 0.08s;
}
.account-btn-primary:hover    { background: var(--primary-dark); }
.account-btn-primary:active   { transform: scale(0.97); }
.account-btn-primary:disabled { background: var(--text-secondary); cursor: not-allowed; transform: none; }
.account-btn-primary.account-btn-saved { background: var(--success); }
.account-btn-primary.account-btn-error { background: var(--danger); }

/* Secondary — neutral gray */
.account-btn-secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1.1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.13s;
}
.account-btn-secondary:hover    { background: rgba(0, 0, 0, 0.11); }
.account-btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Danger zone */
.account-section-danger {
    border: 1px solid rgba(255, 59, 48, 0.18);
    background: rgba(255, 59, 48, 0.02);
}

/* ── Subscription info rows ──────────────────────────────────────────────── */
.account-sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.38rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.055);
    font-size: 0.875rem;
    color: var(--text-primary);
    gap: 0.5rem;
}
.account-sub-row:last-child { border-bottom: none; }
.account-sub-label          { color: var(--text-secondary); white-space: nowrap; }

/* Status badges */
.account-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-trial    { background: rgba(255, 159, 10, 0.12); color: var(--gold-text); }
.badge-active   { background: rgba(52,  199, 89, 0.12); color: var(--success); }
.badge-warning  { background: rgba(255,  59, 48, 0.12); color: var(--danger); }
.badge-inactive { background: rgba(142, 142, 147, 0.1); color: var(--text-secondary); }

/* ── Inline feedback messages ────────────────────────────────────────────── */
.account-msg {
    font-size: 0.8rem;
    margin-top: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
}
.account-msg-success { background: rgba(52,  199, 89, 0.1); color: var(--success); }
.account-msg-error   { background: rgba(255,  59, 48, 0.1); color: var(--danger); }

/* ── List items (churches & missions) ────────────────────────────────────── */
.account-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.055);
}
.account-list-item:last-of-type { border-bottom: none; }

.account-list-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.account-list-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}
.account-list-item-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.account-list-item-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-list-item-link:hover { text-decoration: underline; }

.account-list-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.1);
    border: none;
    color: var(--danger);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.13s;
}
.account-list-delete:hover { background: rgba(255, 59, 48, 0.22); }

/* ── Descriptive text ────────────────────────────────────────────────────── */
.account-blurb {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 0.65rem;
}
.account-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}
.account-hint a          { color: var(--primary); text-decoration: none; }
/* A link that is a button (the gift door on the Subscription tab, FEAT-002) */
.account-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}
.account-hint a:hover    { text-decoration: underline; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .account-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .account-modal {
        border-radius: 0;
        max-width: 100%;
    }
    /* Swipeable tab bar — five tabs don't fit portrait widths. Hidden
       scrollbar + a sticky chevron-over-fade pinned at the right edge
       signals "more tabs this way"; JS hides it at scroll end. */
    .account-tabs {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .account-tabs::-webkit-scrollbar { display: none; }
    .account-tabs::after {
        content: '\203A'; /* › */
        position: sticky;
        right: 0;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        padding: 0 0.4rem 0 1.5rem;
        margin-left: -1.25rem;
        background: linear-gradient(to right, rgba(242,242,247,0), var(--background) 55%);
        color: var(--text-secondary);
        font-size: 1.25rem;
        font-weight: 600;
        pointer-events: none;
        opacity: 1;
        transition: opacity 0.15s;
    }
    .account-tabs.tabs-at-end::after { opacity: 0; }
    .account-field-split,
    .account-field-three {
        grid-template-columns: 1fr;
    }
    .account-modal-body {
        max-height: calc(100dvh - 9rem);
    }
}

/* ── Plan cards on the Subscription tab (moved here from css/pricing.css
   2026-09-30, BUG-029: the app never loaded that sheet, so the cards drew
   unstyled inside the app) ─────────────────────────────────────────── */

.account-plan-cards {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
}

.account-plan-card {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    position: relative;
}

.account-plan-featured {
    border-color: #667eea;
}

.account-plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 0.75rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.account-plan-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.account-plan-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
}

.account-plan-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748b;
}

.account-plan-tax {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.15rem 0 0.5rem;
}

.account-plan-savings {
    font-size: 0.78rem;
    color: #16a34a;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
