/* auth-v2.css — auth modal (login / signup / reset / plans), paywall cards, plan cards.
   Tokens come from base-v8.css. To update: edit here, bump the filename version, update the <link> in base.html. */

/* ===== Modal ===== */
.auth-modal {
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: auto;
    overscroll-behavior: contain;
}

.auth-modal:has(.auth-view-wide:not([hidden])) {
    width: min(620px, calc(100vw - 32px));
}

.auth-modal[open] {
    animation: modal-in 0.32s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.auth-modal::backdrop {
    background: var(--backdrop);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade-in 0.25s ease-out;
}

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

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    color: var(--muted);
}

.auth-view {
    padding: 2.25rem 2rem 0;
    animation: view-in 0.25s ease-out;
}

@keyframes view-in {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: none; }
}

.auth-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}

.auth-mark {
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    font-size: 1.7rem;
    margin-bottom: 0.4rem;
}

.auth-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-sub {
    margin: 0;
    color: var(--text-2);
    font-size: 0.95rem;
}

.auth-icon-ok {
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    margin-bottom: 0.4rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-icon-ok svg {
    width: 1.6rem;
    height: 1.6rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

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

.auth-form .link-btn {
    align-self: center;
    font-size: 0.9rem;
}

/* View without a footer (e.g. reset) => breathing room below the button */
.auth-form:last-child {
    margin-bottom: 2rem;
}

.auth-foot {
    margin: 1.5rem -2rem 0;
    padding: 1rem 2rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-2);
    font-size: 0.92rem;
    text-align: center;
}

.auth-foot p {
    margin: 0.2rem 0;
}

.auth-view-wide {
    padding-bottom: 1.75rem;
}

/* password field with "Show" pill (like a native app) */
.pw-wrap {
    position: relative;
    display: block;
}

.pw-wrap input {
    padding-right: 4.8rem;
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    padding: 0.35rem 0.7rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pw-toggle:hover {
    background: var(--border);
}

/* "Continue as" chip for a remembered email */
.known-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-2);
}

.known-avatar {
    position: relative;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pro-1), var(--pro-2));
    overflow: hidden;
}

.known-avatar::before,
.known-avatar::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgb(255 255 255 / 0.9);
}

.known-avatar::before {
    top: 22%;
    width: 36%;
    height: 36%;
    border-radius: 50%;
}

.known-avatar::after {
    bottom: -18%;
    width: 72%;
    height: 44%;
    border-radius: 50% 50% 0 0;
}

.known-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.known-label {
    color: var(--muted);
    font-size: 0.78rem;
}

.known-email {
    color: var(--heading);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-form.is-known [data-field="email"] {
    display: none;
}

/* ===== Plans ===== */
.plans {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    text-align: left;
}

.pro-features {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.pro-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 500;
}

.pro-features li::before {
    content: "✓";
    display: grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 800;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.3rem 1.2rem 1.2rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.plan-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.plan-featured {
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(135deg, var(--pro-1), var(--pro-2)) border-box;
}

.plan-badge {
    align-self: flex-start;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.plan-featured .plan-badge {
    background: var(--accent-soft);
    color: var(--accent);
}

.plan-name {
    margin: 0.3rem 0 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.plan-price {
    margin: 0 0 0.8rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.plan-price strong {
    color: var(--heading);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-right: 0.15rem;
}

.plan-trial {
    margin: -0.5rem 0 0.8rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.plan-card .btn {
    margin-top: auto;
}

.trial-note {
    margin: 0;
    text-align: center;
}

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
}

.secure-note svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.panel .plans {
    margin-top: 0.5rem;
}

/* ===== Paywall ===== */
.paywall {
    position: relative;
    margin: -3.5rem 0 2rem;
    display: flex;
    justify-content: center;
}

.paywall-card {
    width: 100%;
    max-width: 540px;
    padding: 2rem 1.75rem 1.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: rise-in 0.5s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

.paywall-pro .paywall-card {
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(135deg, var(--pro-1), var(--pro-2)) border-box;
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

.paywall-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
}

.paywall-icon svg {
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.paywall-title {
    margin: 0.2rem 0 0;
    font-size: 1.45rem;
    font-weight: 800;
}

.paywall-sub {
    margin: 0 0 0.6rem;
    max-width: 26rem;
    color: var(--text-2);
}

.paywall-alt {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ===== Mobile: modal becomes a bottom sheet ===== */
@media (max-width: 560px) {
    .auth-modal,
    .auth-modal:has(.auth-view-wide:not([hidden])) {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        inset-inline: 0;
        margin: auto 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-bottom: 0;
    }
    .auth-modal[open] {
        animation: sheet-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .auth-view {
        padding: 2rem 1.25rem 0;
    }
    .auth-foot {
        margin-inline: -1.25rem;
        padding-inline: 1.25rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
    }
    .paywall-card {
        padding: 1.6rem 1.2rem 1.3rem;
    }
}

@keyframes sheet-in {
    from { transform: translateY(100%); }
    to { transform: none; }
}
