/* ── ERROR STATE ────────────────────────────────────────────────────── */

.chl-loading--error {
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* ── CONNECTED ACCOUNTS MODAL ──────────────────────────────────────── */

.pc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 24px 16px;
}

.pc-modal-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.pc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.pc-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.pc-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    font-family: var(--font);
    transition: color 0.15s, background 0.15s;
}

.pc-modal-close:hover {
    color: var(--text);
    background: var(--surface);
}

/* Primary account block — display name + primary email, above the identity list */
.pc-modal-primary {
    padding: 10px 14px 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.pc-modal-primary-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.pc-modal-primary-email {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pc-modal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pc-modal-loading {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 8px 0;
    text-align: center;
}

.pc-modal-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.pc-modal-row-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pc-modal-provider-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 800;
    flex-shrink: 0;
    /* Email — neutral */
    background: var(--border);
    color: var(--text-secondary);
}

/* Google and Microsoft — primary blue (deuteranopia-safe: meaning not carried by red/green) */
.pc-modal-provider-icon--google,
.pc-modal-provider-icon--azure {
    background: var(--primary);
    color: var(--text-inverse);
}

.pc-modal-provider-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pc-modal-provider-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.pc-modal-provider-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.pc-modal-provider-detail--muted {
    color: var(--text-muted);
}

/* Inline "set a password" form — Email/Password row only */
.pc-modal-password-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.pc-modal-password-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pc-modal-cancel-btn,
.pc-modal-link-btn {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    padding: 6px 4px;
}

.pc-modal-cancel-btn:hover,
.pc-modal-link-btn:hover {
    color: var(--text);
}

/* .pc-modal-link-btn — a small trigger inside an already-Connected row
   (e.g. "Change password"), left-aligned under the row's icon/badge
   line rather than crammed into it. */
.pc-modal-link-btn {
    align-self: flex-start;
    padding-left: 0;
}

/* Connected badge — neutral/muted, not green (deuteranopia-safe) */
.pc-modal-connected {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--border);
    border-radius: var(--radius-xs);
    padding: 3px 8px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Connect button — primary blue, Duolingo-style 3D press (deuteranopia-safe) */
.pc-modal-connect-btn {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-inverse);
    background: var(--primary);
    border: none;
    border-bottom: 2px solid var(--primary-dark);
    border-radius: var(--radius-xs);
    padding: 6px 14px;
    cursor: pointer;
    font-family: var(--font);
    flex-shrink: 0;
    transition: filter 0.15s, transform 0.1s, border-bottom-width 0.1s;
}

.pc-modal-connect-btn:hover:not(:disabled) {
    filter: brightness(1.08);
}

.pc-modal-connect-btn:active:not(:disabled) {
    transform: translateY(1px);
    border-bottom-width: 1px;
}

.pc-modal-connect-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ── JOIN CLASS MODAL ───────────────────────────────────────────
   Uses shared pc-modal-* card, auth-field, and auth-msg classes.
   Only the footer layout and submit button are new.
   ────────────────────────────────────────────────────────────── */
.pc-join-modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.pc-join-modal-submit {
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-inverse);
    background: var(--primary);
    border: none;
    border-bottom: 3px solid var(--primary-dark);
    border-radius: var(--radius-sm);
    padding: 10px 22px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s, border-bottom-width 0.1s;
    white-space: nowrap;
}

.pc-join-modal-submit:hover:not(:disabled) {
    filter: brightness(1.08);
}

.pc-join-modal-submit:active:not(:disabled) {
    transform: translateY(1px);
    border-bottom-width: 1px;
}

.pc-join-modal-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ── DELETE MY ACCOUNT MODAL (student-only) ─────────────────────────
   Uses shared pc-modal-* card/header/close and auth-msg error pattern.
   Warning/confirm colour is amber (#B35C00 light / #EEC252 dark), the
   same sitewide error-amber convention used across the codebase —
   AA-verified against this card's own --bg (#FFFFFF / #0F172A) — never
   red, backed by explicit text labels throughout.
   ────────────────────────────────────────────────────────────────── */
.pc-delete-account-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 12px;
}

.pc-delete-account-list {
    margin: 0 0 14px;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.pc-delete-account-warning {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0 0 16px;
    color: #B35C00;
}

[data-theme="dark"] .pc-delete-account-warning { color: #EEC252; }

.pc-delete-account-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.pc-delete-account-cancel-btn {
    flex: 1;
    background: none;
    border: 2px solid var(--border);
    color: var(--text);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pc-delete-account-cancel-btn:hover  { background: var(--surface); border-color: var(--border-dark); }
.pc-delete-account-cancel-btn:active { background: var(--border); }

.pc-delete-account-confirm-btn {
    flex: 1;
    background: none;
    border: 2px solid #B35C00;
    color: #B35C00;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.pc-delete-account-confirm-btn:hover:not(:disabled)  { background: rgba(179, 92, 0, 0.08); }
.pc-delete-account-confirm-btn:active:not(:disabled) { background: rgba(179, 92, 0, 0.14); }
.pc-delete-account-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

[data-theme="dark"] .pc-delete-account-confirm-btn {
    border-color: #EEC252;
    color: #EEC252;
}

[data-theme="dark"] .pc-delete-account-confirm-btn:hover:not(:disabled)  { background: rgba(238, 194, 82, 0.12); }
[data-theme="dark"] .pc-delete-account-confirm-btn:active:not(:disabled) { background: rgba(238, 194, 82, 0.18); }

.pc-delete-account-success {
    text-align: center;
    padding: 8px 0 4px;
}

.pc-delete-account-success-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}

.pc-delete-account-success-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ── FIRST-RUN PYODIDE LOADING ANIMATION ───────────────────────────── */

.ch-pyodide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 16px 32px;
    gap: 20px;
}

.ch-pyodide-snake {
    font-size: 48px;
    line-height: 1;
    animation: ch-slither 0.6s ease-in-out infinite alternate;
}

@keyframes ch-slither {
    from { transform: translateX(-8px) rotate(-10deg); }
    to   { transform: translateX(8px)  rotate(10deg); }
}

.ch-pyodide-msg {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    max-width: 280px;
    margin: 0;
    animation: ch-msg-fadein 0.4s ease-out 0.3s both;
}

@keyframes ch-msg-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
