/*
 * Mirrors the mobile app's visit detail (mobile/src/app/features/visitor-invite/detail):
 * Primary page, QR in a white bezel, name in Secondary, one white detail card.
 * Tokens copied from mobile/src/theme/variables.scss.
 */
:root {
    --primary: #19353b;
    --secondary: #3adb91;
    --secondary-rgb: 58, 219, 145;
    --secondary-shade: #32c281;
    --medium: #73888d;
    --light-shade: #d8dade;
    --danger: #e93b4b;
    --danger-rgb: 233, 59, 75;
    --warning-rgb: 255, 196, 9;
    --white: #ffffff;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-icon: 12px;
    --space-md: 16px;
    --space-pad: 20px;
    --space-lg: 24px;
    --space-xl: 32px;

    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--primary);
    color: var(--white);
    font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 22px;
    -webkit-font-smoothing: antialiased;
}

p {
    margin: 0;
}

.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    min-height: 100vh;
    margin: 0 auto;
    padding: max(var(--space-md), env(safe-area-inset-top)) var(--space-lg) max(var(--space-xl), env(safe-area-inset-bottom));
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: var(--space-lg);
}

.brand-logo {
    display: block;
    height: 26px;
    width: auto;
}

.lang-toggle {
    padding: var(--space-xs) var(--space-icon);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-full);
    background: none;
    color: var(--white);
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    cursor: pointer;
}

/* ── Invite ─────────────────────────────────────────────────────────────── */

.invite {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.intro {
    margin-bottom: var(--space-lg);
    text-align: center;
    font-weight: 500;
}

/* The mobile design draws the QR as a 10px white bezel, not a padded card. */
.qr-frame {
    padding: 10px;
    border-radius: var(--radius-lg);
    background: var(--white);
}

.qr-frame canvas {
    display: block;
}

.visitor-block {
    margin-top: var(--space-lg);
    text-align: center;
}

.visitor-role {
    font-size: 18px;
    line-height: 24px;
    font-weight: 700;
}

.visitor-name {
    font-size: 28px;
    line-height: 36px;
    font-weight: 700;
    color: var(--secondary);
    overflow-wrap: anywhere;
}

.detail-card {
    width: 100%;
    margin-top: var(--space-lg);
    padding: var(--space-pad);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
}

/* Each value stacks under its label, as in the redesigned mobile card. */
.detail-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    padding: var(--space-icon) 0;
    border-bottom: 1px solid var(--light-shade);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.detail-row:first-child {
    padding-top: 0;
}

.detail-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.row-label {
    color: var(--medium);
}

.row-value {
    color: var(--primary);
    overflow-wrap: anywhere;
}

.row-code {
    padding: var(--space-xs) 10px;
    border-radius: var(--radius-sm);
    background: rgba(var(--secondary-rgb), 0.12);
    color: var(--secondary-shade);
    font-size: 16px;
    line-height: 22px;
    letter-spacing: 0.08em;
}

.row-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--primary);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.row-link-hint {
    color: var(--secondary-shade);
    font-weight: 700;
}

.row-link-hint::after {
    content: ' ↗';
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.badge {
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    line-height: 16px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(25, 53, 59, 0.08);
}

.badge-active {
    background: rgba(var(--secondary-rgb), 0.16);
    color: var(--secondary-shade);
}

.badge-upcoming {
    background: rgba(var(--warning-rgb), 0.2);
    color: #8a6a00;
}

.badge-expired {
    background: rgba(var(--danger-rgb), 0.12);
    color: var(--danger);
}

.note {
    margin-top: var(--space-md);
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
    font-size: 14px;
    line-height: 20px;
}

/* ── Loading / error ────────────────────────────────────────────────────── */

.state {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding-bottom: 20vh;
    text-align: center;
}

.state-title {
    font-size: 22px;
    line-height: 28px;
    font-weight: 700;
    color: var(--secondary);
}

.state-text {
    max-width: 320px;
    color: rgba(255, 255, 255, 0.85);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 3s;
    }
}
