/* ═══════════════════════════════════════════════════════════════
   TPH Kursportal — Hovedstilark
   Farger: Teal #1a9988 | Oransje #eb5600 | Lysgrå #f3f3f3
   Tekst: #595959 | Overskrifter: #2d2d2d
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset og base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Ubuntu, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #595959;
    background: #f3f3f3;
}

/* ── Typografi ─────────────────────────────────────────────────── */
h1, h2, h3, h4 {
    color: #2d2d2d;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 0;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin-top: 0; }

a {
    color: #0066cc;
    text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────── */
.senter {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.smal {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ────────────────────────────────────────────────────── */
.siteheader {
    background: #fff;
    border-bottom: 2px solid #1a9988;
    position: sticky;
    top: 0;
    z-index: 100;
}

.siteheader__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.siteheader__logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a9988;
    text-decoration: none;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.siteheader__logo-ikon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: block;
}

.siteheader__nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9375rem;
}

.siteheader__nav a {
    color: #595959;
    font-weight: 500;
}

.siteheader__nav a:hover { color: #0066cc; text-decoration: none; }

.nav-registrer {
    background: #1a9988;
    color: #fff !important;
    padding: 0.375rem 0.875rem;
    border-radius: 4px;
}
.nav-registrer:hover { background: #157a6e !important; }

.nav-loggut { color: #888 !important; }

/* ── Nav-søk-ikon ─────────────────────────────────────────────────── */
.nav-soek-ikon {
    font-size: 1.0625rem;
    color: #888 !important;
    text-decoration: none !important;
    line-height: 1;
}
.nav-soek-ikon:hover { color: #0066cc !important; }

/* ── Nav-dropdown ───────────────────────────────────────────────── */
.nav-dropdown {
    position: relative;
}
.nav-dropdown__trigger {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: default;
}
.nav-dropdown__trigger::after {
    content: '▾';
    font-size: 0.75rem;
    color: #888;
    transition: transform 0.15s;
}
.nav-dropdown:hover .nav-dropdown__trigger::after {
    transform: rotate(180deg);
}
.nav-dropdown__meny {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    min-width: 160px;
    padding: 0.5rem 0 0.375rem;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown__meny,
.nav-dropdown:focus-within .nav-dropdown__meny {
    display: block;
}
.nav-dropdown__meny a {
    display: block !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    color: #595959 !important;
    white-space: nowrap;
    border-bottom: none !important;
}
.nav-dropdown__meny a:hover {
    background: #f3f3f3;
    color: #0066cc !important;
    text-decoration: none;
}
.nav-dropdown__meny a.nav-dropdown__overskrift {
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0 !important;
    color: #2d2d2d !important;
}

/* ── Nav-dropdown sub (nestet) ───────────────────────────────────── */
.nav-dropdown__sub {
    position: relative;
}
.nav-dropdown__sub-trigger {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
}
.nav-dropdown__sub-trigger::after {
    content: '›';
    font-size: 1rem;
    line-height: 1;
    color: #aaa;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.nav-dropdown__sub-meny {
    display: none;
    position: absolute;
    top: -0.5rem;
    left: 100%;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    min-width: 160px;
    padding: 0.5rem 0 0.375rem;
    z-index: 210;
}
.nav-dropdown__sub:hover > .nav-dropdown__sub-meny,
.nav-dropdown__sub:focus-within > .nav-dropdown__sub-meny {
    display: block;
}

/* ── Hovedinnhold ──────────────────────────────────────────────── */
.hovedinnhold {
    min-height: calc(100vh - 60px - 56px);
}

/* ── Sideseksjon ───────────────────────────────────────────────── */
.seksjon {
    padding: 3rem 0;
}

.seksjon--lys { background: #fff; }

/* ── Sidetopp (hvit boks rundt sidetittel) ──────────────────────── */
.sidetopp {
    background: #fff;
    border-radius: 6px;
    padding: 1.25rem 2rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-bottom: 3px solid var(--farge-primaer, #1a9988);
    margin-bottom: 2rem;
}
.sidetopp h1,
.sidetopp h2 { margin-bottom: 0.25rem; }
.sidetopp p  { margin-bottom: 0; color: #888; font-size: 0.9375rem; }

/* ── Kort ──────────────────────────────────────────────────────── */
.kort {
    background: #fff;
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Rammelinje i bunn på kort i hovedninnhold (ikke admin) */
.seksjon .kort,
.seksjon--lys .kort {
    border-bottom: 2px solid var(--farge-primaer, #1a9988);
}

/* ── Skjema ────────────────────────────────────────────────────── */
.skjema-gruppe {
    margin-bottom: 1.25rem;
}

.skjema-gruppe label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: #2d2d2d;
    margin-bottom: 0.375rem;
}

.skjema-gruppe .paakrevd { color: #eb5600; margin-left: 2px; }

.skjema-gruppe input[type="text"],
.skjema-gruppe input[type="email"],
.skjema-gruppe input[type="password"],
.skjema-gruppe select,
.skjema-gruppe textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    color: #2d2d2d;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    transition: border-color 0.15s;
    appearance: none;
}

.skjema-gruppe input:focus,
.skjema-gruppe select:focus,
.skjema-gruppe textarea:focus {
    outline: none;
    border-color: #1a9988;
    box-shadow: 0 0 0 3px rgba(26,153,136,0.15);
}

.skjema-gruppe input.feil,
.skjema-gruppe select.feil,
.skjema-gruppe textarea.feil {
    border-color: #d0312d;
}

.skjema-gruppe .feilmelding {
    font-size: 0.8125rem;
    color: #d0312d;
    margin-top: 0.25rem;
}

.skjema-gruppe .hjelp {
    font-size: 0.8125rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Avkrysningsboks */
.sjekk-gruppe {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.sjekk-gruppe input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    accent-color: #1a9988;
}

.sjekk-gruppe label {
    font-size: 0.9375rem;
    color: #595959;
    cursor: pointer;
}

/* To-kolonne rad */
.skjema-rad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 540px) {
    .skjema-rad { grid-template-columns: 1fr; }
}

/* ── Knapper ───────────────────────────────────────────────────── */
.knapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
}

.knapp--primaer {
    background: #1a9988;
    color: #fff;
}
.knapp--primaer:hover { background: #157a6e; text-decoration: none; color: #fff; }

.knapp--sekundaer {
    background: transparent;
    color: #1a9988;
    border: 2px solid #1a9988;
}
.knapp--sekundaer:hover { background: #f0faf9; text-decoration: none; }

.knapp--full { width: 100%; }

/* ── Varsler ───────────────────────────────────────────────────── */
.varsel {
    padding: 0.875rem 1rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

.varsel--suksess {
    background: #e6f5f3;
    color: #0e6b5e;
    border-left: 4px solid #1a9988;
}

.varsel--feil {
    background: #fdf0f0;
    color: #9c1c1c;
    border-left: 4px solid #d0312d;
}

.varsel--info {
    background: #e8f4fd;
    color: #1a567c;
    border-left: 4px solid #2e86c1;
}

.varsel--advarsel {
    background: #fdf6e3;
    color: #7d5a00;
    border-left: 4px solid #f0ad4e;
}

/* ── Footer ────────────────────────────────────────────────────── */
.sitefooter {
    background: #2d2d2d;
    color: #aaa;
    font-size: 0.875rem;
}

.sitefooter__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .375rem;
    text-align: center;
}

.sitefooter__lenker { margin: 0; }
.sitefooter__lisens {
    margin: 0;
    font-size: .8125rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
    justify-content: center;
}
.sitefooter__lisens a {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: #888;
}
.sitefooter__lisens a:hover { color: #ccc; }

.cc-ikon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    flex-shrink: 0;
}

.sitefooter a { color: #ccc; }
.sitefooter a:hover { color: #fff; }

/* ── Admin rediger-knapp (floating) ─────────────────────────────── */
.admin-rediger-knapp {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #fff;
    color: #1a9988 !important;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 999px;
    text-decoration: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.20);
    border: 1.5px solid #1a9988 !important;
    z-index: 500;
    transition: background 0.15s, color 0.15s;
}
.admin-rediger-knapp:hover {
    background: #1a9988;
    color: #fff !important;
}
.admin-rediger-knapp svg {
    stroke: currentColor;
}
/* Sim-baren vises alltid for adminer (34px uten aktiv sim, 36px med) */
.admin-rediger-knapp--admin {
    bottom: calc(34px + 1.25rem);
}
.admin-rediger-knapp--sim {
    bottom: calc(36px + 1.25rem);
}

/* ── Registrering- og logginn-kortside ─────────────────────────── */
.auth-side {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.auth-kort {
    background: #fff;
    border-radius: 8px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-kort h1 {
    font-size: 1.5rem;
    margin-bottom: 0.375rem;
}

.auth-kort .ingress {
    color: #888;
    font-size: 0.9375rem;
    margin-bottom: 1.75rem;
}

.auth-bytt {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9375rem;
    color: #888;
}

/* ── Separator ─────────────────────────────────────────────────── */
.skille {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 1.5rem 0;
}

/* ── Hjemside ──────────────────────────────────────────────────── */
.hjem-hero {
    background: #1a9988;
    color: #fff;
    padding: 4rem 1.5rem;
    text-align: center;
}

.hjem-hero h1 { color: #fff; font-size: 2.25rem; margin-bottom: 0.75rem; }
.hjem-hero p  { font-size: 1.125rem; opacity: 0.9; margin-bottom: 1.75rem; }

/* ── Passordstyrke ─────────────────────────────────────────────── */
.passord-styrke {
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    margin-top: 6px;
    overflow: hidden;
}
.passord-styrke__bar {
    height: 100%;
    width: 0;
    transition: width 0.3s, background 0.3s;
    border-radius: 2px;
}

/* ── Hamburger-meny ────────────────────────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.hamburger span {
    display: block;
    height: 2px;
    background: #595959;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Admin-layout klasser ──────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 120px);
}

.admin-sidebar {
    width: 220px;
    background: #2d2d2d;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.admin-sidebar__header {
    padding: .875rem 1.25rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-sidebar__toggle {
    display: none;
    background: none;
    border: none;
    color: #888;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.admin-sidebar__nav {
    flex: 1;
    display: block;
}

.admin-sidebar__link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem 1.25rem;
    font-size: .9375rem;
    text-decoration: none;
    transition: background .15s;
}

.admin-sidebar__link--aktiv {
    background: #1a9988;
    color: #fff;
}

.admin-sidebar__link:not(.admin-sidebar__link--aktiv) {
    color: #aaa;
}

.admin-sidebar__link:not(.admin-sidebar__link--aktiv):hover {
    background: #383838;
    text-decoration: none;
    color: #fff;
}

.admin-sidebar__bunn {
    padding: 1.25rem;
    border-top: 1px solid #404040;
}

.admin-sidebar__bunn a {
    font-size: .8125rem;
    color: #888;
}

.admin-innhold {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    background: #f3f3f3;
    min-width: 0;
}

.admin-innhold h1 {
    margin-top: 0;
    font-size: 1.5rem;
}

/* ── Responsivitet ─────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Header og navigasjon */
    .hamburger { display: flex; }

    .siteheader__nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 2px solid #1a9988;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: .5rem 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: 99;
    }

    .siteheader__nav.open { display: flex; }

    .siteheader__nav a {
        padding: .75rem 1.5rem;
        font-size: 1rem;
        border-bottom: 1px solid #f0f0f0;
    }

    .siteheader__nav a:last-child { border-bottom: none; }

    /* Dropdown flates ut i mobilmeny */
    .nav-dropdown { position: static; }
    .nav-dropdown__trigger::after { display: none; }
    .nav-dropdown__meny {
        display: flex !important;
        flex-direction: column;
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        background: #f8f8f8;
        min-width: 0;
    }
    .nav-dropdown__meny a {
        padding-left: 2.5rem !important;
        font-size: 0.9375rem !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }
    .nav-dropdown__meny a.nav-dropdown__overskrift { display: none !important; }

    /* Sub-dropdown flates ut i mobilmeny */
    .nav-dropdown__sub { position: static; }
    .nav-dropdown__sub-trigger::after { display: none; }
    .nav-dropdown__sub-meny {
        display: flex !important;
        flex-direction: column;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        background: #f0f0f0;
        min-width: 0;
    }
    .nav-dropdown__sub-meny a {
        padding-left: 3.75rem !important;
    }

    .nav-registrer {
        margin: .5rem 1.5rem;
        border-radius: 4px;
        text-align: center;
        padding: .75rem;
    }

    .siteheader {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* Typografi */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }

    .hjem-hero { padding: 2.5rem 1.25rem; }
    .hjem-hero h1 { font-size: 1.75rem; }
    .hjem-hero p  { font-size: 1rem; }

    /* Seksjoner og kort */
    .seksjon { padding: 2rem 0; }
    .kort { padding: 1.25rem; }

    /* Auth-sider */
    .auth-side { padding: 1.5rem 1rem; }
    .auth-kort  { padding: 1.75rem 1.25rem; }

    /* Admin-layout: sidebar kollapser */
    .admin-layout { flex-direction: column; }

    .admin-sidebar {
        width: 100%;
        flex-direction: column;
    }

    .admin-sidebar__toggle { display: block; }

    .admin-sidebar__nav {
        display: none;
        border-top: 1px solid #404040;
    }

    .admin-sidebar__nav.open { display: block; }

    .admin-sidebar__bunn { display: none; }

    .admin-innhold { padding: 1.25rem; }

    /* Kollapser inline-stilte grid-kolonner i admin */
    .admin-innhold [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .senter  { padding: 0 1rem; }
    .smal    { padding: 0 1rem; }
    h1       { font-size: 1.375rem; }
    .hjem-hero h1 { font-size: 1.5rem; }
    .kort    { padding: 1rem; }
    .knapp   { font-size: .9375rem; padding: .5625rem 1rem; }
}
