/* register.css — registrering på eget domene (FysioKI / PsykologKI).
   Avledet fra www.fastlegen.com/registerki/register.css, men temaet er byttet
   til edisjonenes designsystem (se landing.css): marine/kalk ankret i logoen,
   Familjen Grotesk + Source Serif 4, 2px radius, flaggrød som eneste aksent.
   Struktur og klassenavn er uendret fra fastlegen-versjonen — register.js og
   markupen deles, så flyten er den samme utprøvde.

   CSP: style-src 'self' https://fonts.googleapis.com → ingen inline style,
   ingen eksterne stilark utenom Google Fonts. Fila er identisk i fysioki/ og
   psykologki/ (paletten er felles); det som skiller edisjonene ligger i
   index.html. */

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

:root {
    --marine: #16233F;       /* dyp marine — tekst og flater */
    --marine-dyp: #0D1830;   /* mørkeste flate */
    --kalk: #F8F9FB;         /* grunn, kjølig blåstikk */
    --mose: #E8ECF3;         /* sekundær flate */
    --sen: #CBD3DF;          /* linjer og rammer */
    --aske: #55617A;         /* dempet tekst */
    --signal: #B01E28;       /* eneste aksent (flaggrød) */
    --signal-dyp: #8E141D;
    --hvit: #FFFFFF;
    --font-ui: "Familjen Grotesk", "Segoe UI", Arial, sans-serif;
    --font-brod: "Source Serif 4", Georgia, serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
}

body {
    font-family: var(--font-brod);
    color: var(--marine);
    line-height: 1.6;
    background: var(--kalk);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════ */
/* KORT                                           */
/* ══════════════════════════════════════════════ */

.rk-card {
    background: var(--hvit);
    border: 1px solid var(--sen);
    border-radius: 4px;
    box-shadow: 0 20px 55px -25px rgba(13, 24, 48, 0.35);
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    animation: card-in 0.45s var(--ease-out) both;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════ */
/* TOPP                                           */
/* ══════════════════════════════════════════════ */

.rk-header {
    background: var(--marine);
    padding: 26px 24px 22px;
    text-align: center;
    position: relative;
}
.rk-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--signal);
}
.rk-logo { height: 46px; width: auto; display: block; margin: 0 auto 10px; }
.rk-logo.is-hidden { display: none; }
.rk-title {
    font-family: var(--font-ui);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--kalk);
}
.rk-title em { font-style: normal; color: #E8949B; }
.rk-kicker {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8C99B4;
    margin-top: 7px;
}

/* ══════════════════════════════════════════════ */
/* STEGINDIKATOR                                  */
/* ══════════════════════════════════════════════ */

.rk-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px 0;
    background: var(--hvit);
    font-family: var(--font-ui);
}
.rk-steps.is-hidden { display: none; }
.rk-step {
    display: flex;
    align-items: center;
    gap: 7px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}
.rk-step.is-active { opacity: 1; }
.rk-step.is-done { opacity: 0.65; }
.rk-step-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--mose);
    color: var(--aske);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.3s ease, color 0.3s ease;
}
.rk-step.is-active .rk-step-num { background: var(--signal); color: var(--kalk); }
.rk-step.is-done .rk-step-num { background: var(--marine); color: var(--kalk); }
.rk-step-label { font-size: 0.78rem; font-weight: 600; color: var(--aske); }
.rk-step.is-active .rk-step-label { color: var(--marine); }
.rk-step-line {
    width: 30px; height: 1px;
    background: var(--sen);
    margin: 0 8px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════ */
/* SEKSJON (kroppen i hvert steg)                 */
/* ══════════════════════════════════════════════ */

.rk-body { padding: 26px 24px; }
.rk-section { display: none; }
.rk-section.is-active { display: block; animation: fade-up 0.35s var(--ease-out) both; }
@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.rk-section-title {
    font-family: var(--font-ui);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--marine);
    text-align: center;
    margin-bottom: 8px;
    text-wrap: balance;
}
.rk-section-desc {
    font-size: 0.95rem;
    color: var(--aske);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════ */
/* SKJEMA                                         */
/* ══════════════════════════════════════════════ */

.rk-field { margin-bottom: 16px; }
.rk-field label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--marine);
    margin-bottom: 6px;
}
.rk-field input[type="email"],
.rk-field input[type="text"],
.rk-field input[type="password"],
.rk-field input[type="tel"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--sen);
    border-radius: 2px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--marine);
    background: var(--hvit);
    transition: border-color 0.2s ease;
    outline: none;
}
.rk-field input:focus {
    border-color: var(--marine);
    outline: 2px solid var(--signal);
    outline-offset: 1px;
}
.rk-field small {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--aske);
    margin-top: 5px;
}
.rk-field-row { display: flex; gap: 12px; }
.rk-field-half { flex: 1; min-width: 0; }
.rk-field-center { text-align: center; }

/* Kodefelt (SMS) */
.rk-code-input {
    width: 150px;
    padding: 14px;
    border: 1px solid var(--sen);
    border-radius: 2px;
    font-family: var(--font-ui);
    font-size: 1.7rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    color: var(--marine);
    outline: none;
    transition: border-color 0.2s ease;
    margin: 0 auto;
    display: block;
}
.rk-code-input:focus { border-color: var(--signal); }

/* Telefonrad */
.rk-phone-row { display: flex; gap: 8px; }
.rk-country-select { position: relative; }
.rk-country-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 12px 10px;
    border: 1px solid var(--sen);
    border-radius: 2px;
    background: var(--hvit);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    cursor: pointer;
    white-space: nowrap;
    color: var(--marine);
}
.rk-country-btn:hover { background: var(--kalk); }
.rk-arrow { font-size: 0.7rem; color: var(--aske); }
.rk-country-dropdown {
    position: absolute;
    top: calc(100% + 4px); left: 0;
    background: var(--hvit);
    border: 1px solid var(--sen);
    border-radius: 2px;
    box-shadow: 0 12px 30px -12px rgba(13, 24, 48, 0.4);
    z-index: 50;
    min-width: 190px;
    overflow: hidden;
}
.rk-country-dropdown.is-hidden { display: none; }
.rk-country-option {
    padding: 11px 14px;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s;
}
.rk-country-option:hover { background: var(--mose); }
.rk-phone-input { flex: 1; min-width: 0; }

/* Avkrysning */
.rk-checkbox { margin-bottom: 22px; }
.rk-checkbox label {
    display: flex; align-items: flex-start; gap: 9px;
    font-size: 0.9rem; color: var(--aske);
    cursor: pointer;
}
.rk-checkbox input[type="checkbox"] {
    width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0;
    accent-color: var(--signal);
}

/* ══════════════════════════════════════════════ */
/* KNAPPER                                        */
/* ══════════════════════════════════════════════ */

.rk-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: 1px solid transparent;
    border-radius: 2px;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    line-height: 1.4;
}
.rk-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rk-btn-primary { background: var(--signal); color: var(--kalk); }
.rk-btn-primary:hover:not(:disabled) { background: var(--signal-dyp); }
.rk-btn-secondary {
    background: var(--hvit);
    color: var(--marine);
    border-color: var(--marine);
    margin-bottom: 0;
}
.rk-btn-secondary:hover:not(:disabled) { background: var(--mose); }
.rk-btn-marine { background: var(--marine); color: var(--kalk); }
.rk-btn-marine:hover:not(:disabled) { background: var(--marine-dyp); }

.rk-link-btn {
    background: none; border: none;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--marine);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 4px 0;
}
.rk-link-btn:hover { color: var(--signal); }
.rk-back-btn { display: block; margin: 18px auto 0; }

a:focus-visible, button:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 3px;
}

/* ══════════════════════════════════════════════ */
/* FEILMELDING                                    */
/* ══════════════════════════════════════════════ */

.rk-error {
    background: #FBEEEF;
    border: 1px solid #E6BFC3;
    border-left: 3px solid var(--signal);
    border-radius: 2px;
    padding: 11px 14px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--signal-dyp);
    margin-bottom: 18px;
    text-align: left;
}
.rk-error.is-hidden { display: none; }

/* ══════════════════════════════════════════════ */
/* SEND PÅ NYTT                                   */
/* ══════════════════════════════════════════════ */

.rk-resend { text-align: center; margin-top: 18px; }
.rk-resend p {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--aske);
    margin-bottom: 4px;
}

/* ══════════════════════════════════════════════ */
/* FERDIG                                         */
/* ══════════════════════════════════════════════ */

.rk-done-check {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: var(--marine);
    color: var(--kalk);
    font-size: 1.6rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    animation: check-pop 0.4s var(--ease-out) both;
}
@keyframes check-pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

/* Nummererte neste steg — samme grep som .kat-num på landingssiden */
.rk-next-steps {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
    border-top: 1px solid var(--sen);
}
.rk-next-step {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 15px 0;
    border-bottom: 1px solid var(--sen);
}
.rk-next-step-num {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: var(--signal);
    flex: none;
}
.rk-next-step-content strong {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--marine);
    margin-bottom: 4px;
}
.rk-next-step-content p {
    font-size: 0.9rem;
    color: var(--aske);
    line-height: 1.55;
}

.rk-divider { height: 1px; background: var(--sen); margin: 22px 0; }

.rk-mail-reminder { text-align: center; margin-bottom: 18px; }
.rk-mail-reminder p {
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--aske);
    line-height: 1.55;
}

/* ══════════════════════════════════════════════ */
/* LENKER OG BUNN                                 */
/* ══════════════════════════════════════════════ */

.rk-alt-action {
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--aske);
    margin-top: 20px;
}
.rk-link {
    color: var(--marine);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}
.rk-link:hover { color: var(--signal); }

.rk-footer {
    text-align: center;
    margin-top: 20px;
    font-family: var(--font-ui);
    max-width: 460px;
}
.rk-footer a { font-size: 0.85rem; color: var(--aske); }
.rk-footer p { font-size: 0.78rem; color: var(--aske); margin-top: 8px; }
.rk-footer-lenker { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: center; }

/* ══════════════════════════════════════════════ */
/* SPINNER                                        */
/* ══════════════════════════════════════════════ */

.rk-spinner {
    display: inline-block;
    width: 17px; height: 17px;
    border: 2.5px solid rgba(248, 249, 251, 0.35);
    border-top-color: var(--kalk);
    border-radius: 50%;
    animation: rk-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes rk-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════ */
/* RESPONSIVT                                     */
/* ══════════════════════════════════════════════ */

@media (min-width: 600px) {
    body { padding: 44px 24px; }
}
@media (max-width: 380px) {
    .rk-body { padding: 22px 18px; }
    .rk-step-label { display: none; }
    .rk-step-line { width: 22px; }
}
