/*
 * Passkeys (WebAuthn) — isolated styles.
 *
 * Self-contained and Bootstrap-free so the eventual TALL rebuild is a wholesale
 * delete + move to Tailwind utilities. Buttons reuse the app's `.btn .btn-primaryx`
 * and inputs the legacy `.form-control` for consistency.
 * Used by: livewire/account/passkeys-form.blade.php and the passkey login block
 * of front/auth/login.blade.php.
 */

:root {
    /* Brand + text + neutral surfaces follow Skilleap's tokens (style.css :root),
       with literal fallbacks. --muted and --border are brand-agnostic UI greys for
       which Skilleap defines no token, so they stay as neutral literals. */
    --pk-ink: var(--PrimaryColor, #545454);
    --pk-muted: #6b7280;
    --pk-border: #e5e7eb;
    --pk-brand: var(--SecondaryColor, #e61c30);
    --pk-danger: #dc2626;
    --pk-success: #16a34a;
    --pk-surface: #ffffff;
    --pk-surface-muted: var(--surface-muted, #f4f4f4);
    --pk-radius: 12px;
}

[x-cloak] {
    display: none !important;
}

/* ---- Settings section ---- */
.pk-settings__lead {
    font-size: 14px;
    color: var(--pk-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}

.pk-card__hint {
    font-size: 14px;
    color: var(--pk-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

.pk-error {
    color: var(--pk-danger);
    font-size: 13px;
    margin: 8px 0 0;
}

.pk-empty {
    font-size: 14px;
    color: var(--pk-muted);
    margin: 0 0 20px;
}

/* ---- Passkey list ---- */
.pk-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pk-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: var(--pk-surface-muted);
    border: 1px solid var(--pk-border);
    border-radius: var(--pk-radius);
}

.pk-list__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pk-list__name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--pk-ink);
}

.pk-list__meta {
    font-size: 13px;
    color: var(--pk-muted);
}

.pk-list__provider {
    font-weight: 500;
}

/* Enforcement note shown in place of the remove button on the last passkey. */
.pk-locked {
    max-width: 240px;
    text-align: right;
}

.pk-list__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    align-self: stretch;
    gap: 8px;
}

@media (max-width: 767px) {
    .pk-list__aside {
        flex-direction: row;
        align-items: center;
        align-self: auto;
        flex: 0 0 100%;
    }
}

.pk-badge-wrap {
    display: inline-flex;
}

.pk-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border: 0;
    border-radius: 999px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    cursor: pointer;
}

.pk-badge > i {
    font-size: 10px;
}

.pk-badge__info {
    opacity: 0.65;
}

/* Intentionally NOT white-labeled: the "synced" badge always uses a fixed green
   to signal a positive/secure state (passkey synced & usable across devices),
   independent of the tenant brand. Do not swap this back to var(--pk-brand). */
.pk-badge--synced {
    color: var(--pk-success);
    background: rgba(22, 163, 74, 0.1);
}

.pk-badge--local {
    color: var(--pk-muted);
    background: var(--pk-border);
}

.pk-badge__popover {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: max-content;
    max-width: min(420px, calc(100vw - 16px));
    padding: 8px 10px;
    background: var(--pk-surface);
    border: 1px solid var(--pk-border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15, 15, 26, 0.12);
    color: var(--pk-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    text-align: left;
}

.pk-badge__arrow {
    position: absolute;
    top: -6px;
    width: 12px;
    height: 12px;
    background: var(--pk-surface);
    border-left: 1px solid var(--pk-border);
    border-top: 1px solid var(--pk-border);
    transform: rotate(45deg);
}

.pk-badge__arrow[data-placement="top"] {
    top: auto;
    bottom: -6px;
    transform: rotate(225deg);
}

@media (min-width: 768px) {
    .pk-badge__popover {
        max-width: 420px;
    }
}

.pk-delete-form {
    flex: 1 1 100%;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--pk-border);
}

/* ---- Add / form primitives ---- */
.pk-add {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--pk-border);
}

.pk-field {
    max-width: 360px;
    margin-bottom: 12px;
}

.pk-add__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.pk-add__row .pk-field {
    flex: 1 1 220px;
    margin-bottom: 0;
}

.pk-add__row .btn {
    flex: 0 0 auto;
}

.pk-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--pk-ink);
    margin-bottom: 6px;
}

.pk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.pk-link {
    padding: 0;
    background: none;
    border: none;
    color: var(--pk-brand);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.pk-link:hover {
    text-decoration: underline;
}

.pk-link--danger {
    color: var(--pk-danger);
}

/* ---- Login page ---- */
/* Forgot-password + passwordless sign-in share one row; the passkey link is a
   de-emphasized fallback (conditional-UI autofill is the primary path). Stacks
   to one link per row on phones. */
.login-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 25px;
}

.login-links__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--pk-brand);
}

.login-links__link:hover {
    color: var(--pk-brand);
    text-decoration: underline;
}

.login-links__passkey i {
    font-size: 15px;
}

/* Anchors the forgot-password link to the right whether or not the passkey link
   renders (unsupported browsers hide it via x-cloak). */
.login-links__forgot {
    margin-left: auto;
}

.login-links__passkey.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.login-links__error {
    flex: 0 0 100%;
    margin: 0;
    text-align: right;
    color: var(--pk-danger);
    font-size: 12px;
}
