/* Allauth Theme Styles - Applied to all allauth pages via layout templates */

/* Links - Make visible on dark theme */
.card a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.card a:hover {
    color: var(--color-accent-light);
    text-decoration: underline;
}

.card a:visited {
    color: var(--color-accent-light);
}

/* Lists - Style UL elements used in allauth */
.card ul {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.card ul li {
    margin: 0.5rem 0;
    padding-left: 0;
}

.card ul li a {
    display: inline-block;
    padding: 0.25rem 0;
}

/* Nested lists */
.card ul ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.card ul ul li {
    margin: 0.25rem 0;
}

/* Buttons rendered via allauth elements. :not(.btn) — a template that uses the app's own
   .btn / .btn-sm classes (account/email.html) keeps that sizing instead of this page-primary one. */
.card button:not(.btn),
.card input[type="submit"],
.card input[type="button"] {
    background: var(--color-accent);
    color: var(--color-text-light);
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.card button:not(.btn):hover,
.card input[type="submit"]:hover,
.card input[type="button"]:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* Form elements */
.card input[type="text"],
.card input[type="email"],
.card input[type="password"],
.card input[type="number"],
.card textarea,
.card select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.card input[type="text"]:focus,
.card input[type="email"]:focus,
.card input[type="password"]:focus,
.card input[type="number"]:focus,
.card textarea:focus,
.card select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Labels */
.card label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Error messages and alerts */
.card .errorlist,
.card .alert {
    background: var(--color-error-soft);
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    list-style: none;
}

.card .errorlist li {
    margin: 0.25rem 0;
}

/* Paragraphs and text */
.card p {
    color: var(--color-text-primary);
    margin: 1rem 0;
    line-height: 1.6;
}

/* Headings */
.card h1,
.card h2,
.card h3 {
    color: var(--color-text-secondary);
    margin: 1.5rem 0 1rem 0;
}

.card h1 {
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 0.75rem;
}

/* Entrance pages (login / signup / password reset): a centered column,
   not a card spanning the whole viewport. */
.entrance-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    margin: 4rem auto;
    padding: 2rem 1.75rem;
}

/* Backdrop for entrance pages: a hairline grid in the theme's border color with a
   violet glow behind the card — fixed, behind everything, never intercepts clicks. */
.entrance-bg {
    position: fixed;
    inset: 0;
    /* Behind all in-flow content (the header's own background covers it) but still
       above the body background. */
    z-index: -1;
    pointer-events: none;
    /* The grid is dimmed via color-mix instead of an opacity on the container, so the
       beams below can run at full intensity. */
    background-image:
        radial-gradient(700px 380px at 50% 12%, rgba(139, 92, 246, 0.14), transparent 70%),
        linear-gradient(color-mix(in srgb, var(--color-border) 55%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--color-border) 55%, transparent) 1px, transparent 1px);
    background-size: auto, 44px 44px, 44px 44px;
    /* Fade the grid out toward the edges so it frames the card instead of wallpapering. */
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 35%, transparent 80%);
    mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 35%, transparent 80%);
}

/* Animated beams: short violet light segments traveling along the grid lines.
   Two via pseudo-elements, two via the <i> children — different lanes and timings so
   the pattern never reads as a loop. All sit on 44px multiples to ride the grid. */
.entrance-bg::before,
.entrance-bg::after,
.entrance-bg i {
    content: "";
    position: absolute;
    display: block;
}

.entrance-bg::before,
.entrance-bg i:first-child {
    height: 2px;
    width: 220px;
    left: -220px;
    background: linear-gradient(90deg, transparent, #c4b5fd, transparent);
    box-shadow: 0 0 12px 1px rgba(139, 92, 246, 0.7);
    animation: entrance-beam-x 9s linear infinite;
}

.entrance-bg::after,
.entrance-bg i:last-child {
    width: 2px;
    height: 220px;
    top: -220px;
    background: linear-gradient(180deg, transparent, #c4b5fd, transparent);
    box-shadow: 0 0 12px 1px rgba(139, 92, 246, 0.7);
    animation: entrance-beam-y 12s linear infinite;
}

.entrance-bg::before      { top: calc(44px * 4); }
.entrance-bg i:first-child { top: calc(44px * 13); animation-delay: 4.5s; animation-duration: 11s; }
.entrance-bg::after       { left: calc(44px * 5); animation-delay: 2s; }
.entrance-bg i:last-child  { left: calc(44px * 18); animation-delay: 7s; animation-duration: 10s; }

@keyframes entrance-beam-x {
    to { transform: translateX(calc(100vw + 440px)); }
}

@keyframes entrance-beam-y {
    to { transform: translateY(calc(100vh + 440px)); }
}

@media (prefers-reduced-motion: reduce) {
    .entrance-bg::before,
    .entrance-bg::after,
    .entrance-bg i {
        animation: none;
        display: none;
    }
}

/* Compact typography inside the entrance card — the stock allauth sizes read oversized. */
.entrance-card h1 {
    font-size: 1.4rem;
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.entrance-card h1::after {
    content: "";
    display: block;
    width: 2.5rem;
    height: 3px;
    margin-top: 0.6rem;
    border-radius: 2px;
    background: var(--color-accent-gradient);
}

.entrance-card p {
    font-size: 0.9rem;
    margin: 0.75rem 0 1rem;
}

.entrance-card label {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.entrance-card input[type="text"],
.entrance-card input[type="email"],
.entrance-card input[type="password"],
.entrance-card input[type="number"] {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
}

.entrance-card form {
    margin-top: 1.25rem;
}

.entrance-card button[type="submit"] {
    width: 100%;
    margin-top: 0.75rem;
}

/* Divider between the credentials form and the SSO providers */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* SSO provider buttons */
.card ul.provider-list {
    margin: 0;
}

.card .provider-list li {
    margin: 0.5rem 0;
}

.card a.provider-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.card a.provider-btn:hover,
.card a.provider-btn:visited {
    color: var(--color-text-secondary);
}

.card a.provider-btn:hover {
    border-color: var(--color-border-focus);
    background: var(--color-accent-soft);
    text-decoration: none;
    transform: translateY(-1px);
}

.provider-btn .provider-icon {
    flex: none;
}

.provider-btn .provider-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

/* Tables (if used) */
.card table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.card table th,
.card table td {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.card table th {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    font-weight: 600;
}


.totp-setup-lede {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.card ol.totp-steps {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    gap: 1rem;
    align-items: start;
}

.totp-step {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-secondary);
    padding: 1.25rem;
}

.totp-step-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card .totp-step-head h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.totp-step-num {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    color: var(--color-accent-light);
    font-weight: 700;
    font-size: 0.85rem;
}

.card p.totp-step-help {
    margin: 0.5rem 0 1rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.totp-scan {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.totp-qr {
    flex: none;
    background: #ffffff;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 0 0 1px var(--color-border), 0 6px 18px rgba(0, 0, 0, 0.35);
    line-height: 0;
}

.totp-qr img {
    display: block;
    width: 184px;
    height: 184px;
    image-rendering: pixelated;
}

.totp-secret {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.totp-secret-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.totp-secret-value {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    border: 1px dashed var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    word-break: break-all;
    user-select: all;
}

.card button.totp-copy {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    box-shadow: none;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.card button.totp-copy:hover {
    background: var(--color-accent-soft);
    border-color: var(--color-border-focus);
    box-shadow: none;
}

.card button.totp-copy.is-copied {
    color: var(--color-success);
    border-color: var(--color-success);
}

.totp-secret-note {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.totp-verify-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.card input.totp-code-input {
    flex: 1 1 auto;
    max-width: 14rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.15rem;
    letter-spacing: 0.3em;
}

@media (max-width: 520px) {
    .totp-scan {
        flex-direction: column;
        align-items: stretch;
    }

    .totp-qr {
        align-self: center;
    }

    .totp-verify-row {
        flex-direction: column;
    }

    .card input.totp-code-input {
        max-width: none;
    }
}

.mfa-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    border-left-width: 4px;
}

.mfa-banner div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mfa-banner strong {
    color: var(--color-text-primary);
}

.mfa-banner span:not(.mfa-banner-dot) {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.mfa-banner-dot {
    flex: none;
    width: 0.6rem;
    height: 0.6rem;
    margin-top: 0.4rem;
    border-radius: 50%;
}

.mfa-banner--on {
    border-left-color: var(--color-success);
    background: var(--color-success-soft);
}

.mfa-banner--on .mfa-banner-dot {
    background: var(--color-success);
}

.mfa-banner--off {
    border-left-color: var(--color-warning);
    background: rgba(245, 158, 11, 0.10);
}

.mfa-banner--off .mfa-banner-dot {
    background: var(--color-warning);
}

.mfa-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.mfa-method {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-secondary);
}

.mfa-method--active {
    border-top-color: var(--color-success);
}

.mfa-method--warn {
    border-top-color: var(--color-warning);
}

.mfa-method-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card .mfa-method-head h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.mfa-pill {
    /* The app's status-chip box (docs/ui-design-standard.md §7): 4px radius, soft fill, no
       outline — it was an outlined 999px pill, a second chip dialect. */
    flex: none;
    padding: 0.12rem 0.55rem;
    border-radius: 4px;
    border: none;
    background: rgba(148, 163, 184, 0.14);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.mfa-pill--on {
    color: var(--color-success);
    background: var(--color-success-soft);
}

.mfa-pill--warn {
    color: var(--color-warning);
    background: var(--color-warning-soft);
}

.card p.mfa-method-text {
    flex: 1;
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.mfa-method-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.card a.mfa-btn,
.card a.mfa-btn:visited {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.card a.mfa-btn:hover {
    border-color: var(--color-border-focus);
    background: var(--color-accent-soft);
    color: var(--color-text-primary);
    text-decoration: none;
}

.card a.mfa-btn--primary,
.card a.mfa-btn--primary:visited {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-text-light);
}

.card a.mfa-btn--primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: var(--color-text-light);
}

.card a.mfa-btn--danger,
.card a.mfa-btn--danger:visited {
    color: var(--color-error);
    border-color: color-mix(in srgb, var(--color-error) 55%, transparent);
}

.card a.mfa-btn--danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--color-error);
    color: var(--color-error);
}

/* One form field (allauth/elements/fields.html) — the spacing the <p> wrapper used to give it. */
.card .auth-field {
    margin: 1rem 0;
}

.entrance-card .auth-field {
    margin: 0.75rem 0 1rem;
}

.card > h2:first-child {
    margin-top: 0;
}

/* Field help text (allauth/elements/fields.html): a field note, not body copy. Django's password
   validators render as a <ul>, which read as four full-size paragraphs. */
.card .helptext {
    display: block;
    margin-top: 0.35rem;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.card .helptext ul {
    margin: 0;
    padding-left: 1.1rem;
}

.card .helptext li {
    margin: 0.1rem 0;
}

/* Secondary link under an entrance form's full-width submit (Forgot Password?). */
.entrance-card .entrance-foot {
    margin: 0.85rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

.entrance-foot a {
    color: var(--color-info);
}

/* Email addresses (account/email.html): one row per address — radio, address, status chips —
   in a framed list, with the actions as panel-size buttons under it. */
.card .email-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
}

.card .email-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-primary);
    cursor: pointer;
}

.card .email-row + .email-row {
    border-top: 1px solid var(--color-border-subtle);
}

.card .email-row input[type="radio"] {
    flex: none;
    width: auto;
    margin: 0;
    accent-color: var(--color-accent);
}

.card .email-row-address {
    margin-right: auto;
    overflow-wrap: anywhere;
}

.card .email-chip--verified { color: var(--color-success); }
.card .email-chip--unverified { color: var(--color-warning); }
.card .email-chip--primary { color: var(--color-accent-light); }

.card .email-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.card .email-add-form {
    max-width: 32rem;
}
