/* ============================================================
   Passwordless Login by Wootonomous — Front-end UI
   Inspired by X/Twitter login — clean, centered, modern.
   ============================================================ */

/* ── Wrapper ──────────────────────────────────────────────── */
.plwl-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    box-sizing: border-box;
}

.plwl-wrap *,
.plwl-wrap *::before,
.plwl-wrap *::after {
    box-sizing: inherit;
}

.plwl-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Alert ────────────────────────────────────────────────── */
.plwl-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}
.plwl-alert--error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* ── Social buttons ───────────────────────────────────────── */
.plwl-social {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plwl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.plwl-btn:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.plwl-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

/* ── Social buttons — per-button CSS vars, immune to link colour inheritance ── */
.plwl-wrap .plwl-btn--google,
.plwl-wrap .plwl-btn--apple {
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* Google — white bg, black text by default */
.plwl-wrap .plwl-btn--google {
    background: var(--op-google-bg, #ffffff);
    color: var(--op-google-text, #0D0D0D);
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: var(--op-google-radius, 24px);
}
.plwl-wrap .plwl-btn--google:hover,
.plwl-wrap .plwl-btn--google:focus {
    opacity: 0.88;
    text-decoration: none;
    color: var(--op-google-text, #0D0D0D);
}

/* Apple — black bg, white text by default */
.plwl-wrap .plwl-btn--apple {
    background: var(--op-apple-bg, #000000);
    color: var(--op-apple-text, #ffffff);
    border: 1.5px solid var(--op-apple-bg, #000000);
    border-radius: var(--op-apple-radius, 24px);
}
.plwl-wrap .plwl-btn--apple:hover,
.plwl-wrap .plwl-btn--apple:focus {
    opacity: 0.88;
    text-decoration: none;
    color: var(--op-apple-text, #ffffff);
}

/* Icon sizing */
.plwl-wrap .plwl-btn--google .plwl-icon,
.plwl-wrap .plwl-btn--apple .plwl-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Primary (magic link submit) */
.plwl-btn--primary {
    color: #fff;
    border-color: transparent;
}
.plwl-btn--primary:hover {
    opacity: 0.88;
    color: #fff;
    text-decoration: none;
}
.plwl-btn--primary:active {
    opacity: 0.75;
}
.plwl-btn--loading {
    opacity: 0.7;
    pointer-events: none;
}
.plwl-btn--loading::after {
    content: '';
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: op-spin 0.7s linear infinite;
    margin-left: 8px;
}
@keyframes op-spin { to { transform: rotate(360deg); } }

/* ── Divider ──────────────────────────────────────────────── */
.plwl-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #9CA3AF;
    font-size: 13px;
    font-weight: 500;
}
.plwl-divider::before,
.plwl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E5E7EB;
}

/* ── Magic link form ──────────────────────────────────────── */
.plwl-magic-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plwl-field input[type="email"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 1.5px solid #D1D5DB;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.plwl-field input[type="email"]:focus {
    border-color: var(--op-color, #111827);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--op-color, #111827) 12%, transparent);
}

.plwl-field input[type="email"]::placeholder {
    color: #9CA3AF;
}

/* ── Success state ────────────────────────────────────────── */
.plwl-success {
    text-align: center;
    padding: 32px 20px;
}

.plwl-success__icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.plwl-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 10px;
}

.plwl-success p {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
    line-height: 1.6;
}

/* ── Terms ────────────────────────────────────────────────── */
.plwl-terms {
    margin: 16px 0 0;
    font-size: 12px;
    color: #9CA3AF;
    text-align: center;
    line-height: 1.5;
}
.plwl-terms a {
    color: #6B7280;
    text-decoration: underline;
}

/* ── Mobile ───────────────────────────────────────────────── */
@media ( max-width: 480px ) {
    .plwl-btn { padding: 14px 20px; font-size: 15px; }
    .plwl-field input[type="email"] { padding: 14px 16px; font-size: 16px; }
}

@keyframes op-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ── GDPR consent ─────────────────────────────────────────── */
.plwl-gdpr {
    margin-top: 16px;
}

.plwl-gdpr__label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
}

.plwl-gdpr__checkbox {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: #111827;
    cursor: pointer;
}

.plwl-gdpr__label a {
    color: #374151;
    text-decoration: underline;
}

.plwl-gdpr__label a:hover {
    color: #111827;
}

.plwl-gdpr__error {
    font-size: 12px;
    color: #DC2626;
    margin: 6px 0 0 26px;
}

/* Remove the old .plwl-terms now replaced by GDPR block */
.plwl-terms { display: none; }

/* ── GDPR spacing ─────────────────────────────────────────── */
.plwl-gdpr {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #F3F4F6;
}

/* ── Checkout panel ───────────────────────────────────────── */
.plwl-checkout-wrap {
    margin-bottom: 24px;
}

.plwl-checkout-toggle p {
    margin: 0 0 8px;
    font-size: 14px;
}

.plwl-checkout-toggle__link {
    text-decoration: underline;
    cursor: pointer;
}

.plwl-checkout-panel {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    margin-top: 12px;
}

.plwl-wrap--checkout .plwl-inner {
    max-width: 420px;
}

/* ── Passkey button — styled identically to Google/Apple, vars-driven ── */
.plwl-wrap .plwl-btn--passkey {
    background: var(--op-passkey-bg, #1a1a2e);
    color: var(--op-passkey-text, #ffffff);
    border-color: var(--op-passkey-bg, #1a1a2e);
    border-radius: var(--op-passkey-radius, 24px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.plwl-wrap .plwl-btn--passkey:hover,
.plwl-wrap .plwl-btn--passkey:focus {
    opacity: 0.88;
    color: var(--op-passkey-text, #ffffff);
    text-decoration: none;
}
.plwl-wrap .plwl-btn--passkey:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ── Passkey manager (account page) ─────────────────────── */
.op-passkey-manager {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}
.op-passkey-manager h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #111827;
}
.op-passkey-manager p {
    font-size: 13px;
    color: #6B7280;
    margin: 0 0 16px;
}
.op-passkey-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}
.op-passkey-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 13px;
}
.op-passkey-list__item:last-child { border-bottom: none; }
.op-passkey-list__name { font-weight: 600; color: #111827; }
.op-passkey-list__date { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.op-passkey-delete {
    background: none;
    border: 1px solid #FCA5A5;
    color: #DC2626;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.op-passkey-delete:hover { background: #FEF2F2; }
.op-register-passkey-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.op-register-passkey-btn:hover { opacity: 0.88; }
