/* ─────────────────────────────────────────────────────────────
   AuthModal — Substack-style sign-in / register modal.
   Used by AuthModalViewComponent. Theme tokens come from the
   host app's stylesheet (--bg-elevated, --text-primary, etc.).

   Per Sidekick UI convention: --border-secondary (not -primary)
   inside elevated surfaces, since elevated bg ≈ border-primary
   in some themes (Ember Dark).
   ───────────────────────────────────────────────────────────── */

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.auth-modal.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 180ms ease, visibility 0s linear 0s;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.auth-modal-panel {
    position: relative;
    width: 100%;
    max-width: 26rem; /* ~416px */
    background-color: var(--bg-elevated, #2D3442);
    color: var(--text-primary, #F9FAFB);
    border: 1px solid var(--border-secondary, #4B5563);
    border-radius: 0.875rem;
    padding: 2rem 1.5rem 1.75rem;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6),
                0 8px 16px -8px rgba(0, 0, 0, 0.4);
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1) 30ms,
                opacity 200ms ease 30ms;
}

.auth-modal.is-open .auth-modal-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.auth-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary, #9CA3AF);
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 150ms ease, color 150ms ease;
}

.auth-modal-close:hover,
.auth-modal-close:focus-visible {
    background-color: var(--bg-secondary, rgba(255, 255, 255, 0.06));
    color: var(--text-primary, #F9FAFB);
    outline: none;
}

.auth-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background-color: color-mix(in srgb, var(--accent-orange, #F97316) 18%, transparent);
    color: var(--accent-orange, #F97316);
}

.auth-modal-title {
    margin: 0 0 0.5rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary, #F9FAFB);
}

.auth-modal-subtitle {
    margin: 0 0 1.5rem;
    text-align: center;
    font-size: 0.9375rem;
    color: var(--text-secondary, #9CA3AF);
}

.auth-modal-subtitle a {
    color: var(--accent-orange, #F97316);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.auth-modal-subtitle a:hover,
.auth-modal-subtitle a:focus-visible {
    text-decoration: underline;
    outline: none;
}

.auth-modal-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-modal-input {
    width: 100%;
    height: 2.875rem; /* 46px - meets 44px touch target */
    padding: 0 0.875rem;
    font-size: 1rem;
    color: var(--text-primary, #F9FAFB);
    background-color: var(--bg-primary, #0A0E14);
    border: 1px solid var(--border-secondary, #4B5563);
    border-radius: 0.5rem;
    box-sizing: border-box;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-modal-input::placeholder {
    color: var(--text-muted, #6B7280);
}

.auth-modal-input:focus {
    border-color: var(--accent-orange, #F97316);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-orange, #F97316) 25%, transparent);
    outline: none;
}

.auth-modal-input:invalid:not(:placeholder-shown) {
    border-color: var(--accent-red, #EF4444);
}

.auth-modal-submit {
    width: 100%;
    height: 2.875rem;
    padding: 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--accent-orange, #F97316);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 150ms ease, transform 100ms ease;
}

.auth-modal-submit:hover,
.auth-modal-submit:focus-visible {
    background-color: var(--accent-orange-hover, #EA580C);
    outline: none;
}

.auth-modal-submit:active {
    transform: translateY(1px);
}

.auth-modal-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* sr-only utility — a copy in case the host doesn't define one */
.auth-modal .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Lock body scroll when open */
body.auth-modal-open {
    overflow: hidden;
}

/* Mobile tweak — give the panel a bit more breathing room on small viewports */
@media (max-width: 480px) {
    .auth-modal-panel {
        padding: 1.75rem 1.25rem 1.5rem;
    }

    .auth-modal-title {
        font-size: 1.125rem;
    }
}
