/* ============================================
   Auth Forms (Login, Register)
   ============================================ */

.auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

.auth-links {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 8px;
}

.auth-links a {
    color: var(--accent);
}
.auth-links a:hover {
    color: var(--accent-hover);
}

.auth-divider {
    margin: 0 8px;
    color: var(--border-light);
}

/* Alerts (flash messages) */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: var(--success);
}

/* TOTP input */
.totp-input {
    font-family: var(--font-mono, monospace);
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
    padding: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Account Settings Page
   ============================================ */

.account-page {
    max-width: 800px;
    margin: 0 auto;
    /* Top nav is ~80px (var --nav-height) — pad enough that the page title
       isn't clipped by the sticky header. */
    padding: calc(var(--nav-height, 80px) + 32px) 20px 40px;
}

.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.account-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.account-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
}

.account-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 400px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.profile-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-value {
    font-size: 14px;
    font-weight: 500;
}

/* Form messages */
.form-message {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
}

.form-message-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: var(--success);
}

.form-message-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
}

/* 2FA */
.twofa-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.twofa-status p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.qr-container {
    text-align: center;
    margin: 16px 0;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius);
    display: inline-block;
}

.qr-container img {
    width: 200px;
    height: 200px;
}

.secret-manual {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.secret-manual code {
    font-family: var(--font-mono, monospace);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    letter-spacing: 1px;
    word-break: break-all;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
    max-width: 320px;
}

.recovery-code {
    font-family: var(--font-mono, monospace);
    font-size: 14px;
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
    letter-spacing: 1px;
}

/* Storage */
.storage-bar-container {
    margin-bottom: 16px;
}

.storage-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
}

.storage-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.storage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.storage-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.storage-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* Buttons */
.btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ============================================================
 * Billing section (account.php)
 * ============================================================ */
.account-card-billing { grid-column: 1 / -1; }
.billing-beta-tag {
    display: inline-block;
    margin-left: 12px;
    padding: 2px 8px;
    background: rgba(255,160,80,0.15);
    color: #ffa050;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    letter-spacing: 0.4px;
    vertical-align: middle;
}
.billing-h3 {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.billing-help { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.billing-balance {
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 8px;
}
.bill-bal-row { font-size: 15px; }
.bill-bal-num { font-size: 24px; font-weight: 700; color: #ffa050; vertical-align: middle; }
.bill-bal-sep { margin: 0 8px; color: var(--text-muted); }
.bill-bal-meta { color: var(--text-muted); font-size: 12px; margin-top: 6px; }

.billing-tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.bill-tier-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}
.bill-tier-current-card {
    border-color: #ffa050;
    background: rgba(255,160,80,0.06);
}
.bill-tier-name { font-weight: 700; font-size: 13px; letter-spacing: 0.5px; color: var(--text-primary); }
.bill-tier-price { font-size: 18px; font-weight: 700; margin: 6px 0; color: #ffa050; }
.bill-tier-free { color: var(--text-muted); font-weight: 400; font-size: 14px; }
.bill-tier-daily { font-size: 12px; color: var(--text-primary); }
.bill-tier-monthly { font-size: 12px; color: var(--success, #4ade80); margin-top: 2px; }
.bill-tier-quotas {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}
.bill-tier-quotas strong { color: var(--text-primary); }

/* Tier card grid: equal-height cards with consistent feature matrix */
.bill-tier-card {
    display: flex;
    flex-direction: column;
    min-height: 480px;
}
.bill-tier-costcr {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}
.bill-tier-quotas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    margin: 8px 0;
    padding: 8px;
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}
.bill-tier-quotas-grid strong { color: var(--text-primary); margin: 0 2px; }
.bill-tier-quotas-grid > div { display: flex; align-items: center; gap: 3px; }
.bill-q-icon { font-size: 12px; line-height: 1; }

.bill-feat-matrix {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 8px 0;
    flex-grow: 1;
}
.bill-feat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.bill-feat-row:last-child { border-bottom: none; }
.bill-feat-label {
    color: var(--text-muted);
    text-align: left;
    flex: 1;
    line-height: 1.2;
}
.bill-feat-yes { color: #4ade80; font-weight: 700; font-size: 14px; }
.bill-feat-no  { color: #ef4444; font-weight: 700; font-size: 14px; opacity: 0.5; }
.bill-feat-val { color: #ffa050; font-weight: 600; font-size: 11px; }
.bill-tier-action { margin-top: auto; padding-top: 8px; }
.bill-tier-invite {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    background: rgba(180,120,255,0.2);
    color: #cba8ff;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.4px;
    border-radius: 6px;
    text-transform: lowercase;
}
.bill-tier-action { margin-top: 10px; }
.bill-tier-current { color: var(--success, #4ade80); font-weight: 600; font-size: 12px; }
.bill-tier-current-free { color: var(--text-muted); font-weight: 400; }
.bill-tier-disabled { color: var(--text-muted); font-weight: 400; font-style: italic; }

/* Disabled tier card (invite-only when user doesn't have it) */
.bill-tier-card-disabled {
    opacity: 0.55;
    pointer-events: none;
}
.bill-tier-card-disabled .bill-tier-name { color: var(--text-muted); }

/* Mecenas custom-amount card */
.bill-tier-card-custom {
    border-color: rgba(255,160,80,0.6);
    background: rgba(255,160,80,0.04);
}
.bill-tier-card-custom .bill-tier-price { font-size: 14px; }
.bill-tier-price-custom input.bill-mecenas-input {
    width: 70px;
    padding: 2px 4px;
    margin: 0 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    text-align: right;
}

/* Perks bullet list at bottom of tier card */
.bill-tier-perks {
    margin: 8px 0 0 0;
    padding-left: 18px;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}
.bill-tier-perks li { margin-bottom: 2px; }

.billing-patron-block {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 14px;
}

/* Modal centering — account.php doesn't load dashboard.css so we replicate basics here.
   The critical inline style in layout.php only handles display:flex; we add the
   centering + backdrop + content styling. */
.modal {
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 50000;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-tertiary, #1a1a1a);
    border: 1px solid var(--border-light, var(--border));
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-content h2 { margin-top: 0; }

/* F### founder/mecenas serial badge */
.bill-founder-badge {
    display: inline-block;
    padding: 2px 7px;
    background: linear-gradient(135deg, #ffa050, #ff7a30);
    color: #1a0a00;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    border-radius: 4px;
    vertical-align: middle;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 1px 3px rgba(255,160,80,0.4);
}

.billing-topup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.bill-topup-pack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    transition: border-color 150ms;
}
.bill-topup-pack:hover { border-color: #ffa050; }
.bill-pack-amt { font-size: 22px; font-weight: 700; color: #ffa050; }
.bill-pack-cred { font-size: 12px; color: var(--text-muted); }

.billing-transactions { max-height: 320px; overflow-y: auto; }
.btn-block { width: 100%; }
