/* Lernkompass – gemeinsames Erscheinungsbild (für das iPad optimiert) */

:root {
    /* Schulfarben: Blau als Akzent, Rot nur als Detail (Kompassnadel) */
    --lk-school-blue: #004A7B;
    --lk-school-red: #E52A31;

    --lk-accent: var(--lk-school-blue);
    --lk-accent-pressed: #003A61;
    --lk-accent-soft: #E3EDF5;
    --lk-bg: #F2F2F7;
    --lk-surface: #FFFFFF;
    --lk-label: #1C1C1E;
    --lk-secondary: #6C6C70;
    --lk-tertiary: #AEAEB2;
    --lk-separator: rgba(60, 60, 67, .14);
    --lk-radius: 14px;
    --lk-radius-lg: 20px;
    --lk-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .06);
    --lk-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;

    /* Rückmeldungsfarben */
    --lk-strike: #DC2626;
    --lk-repeat: #2563EB;
    --lk-ok: #16A34A;
    --lk-provisional: #4ADE80;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--lk-bg);
    color: var(--lk-label);
    font-family: var(--lk-font);
    font-size: 17px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--lk-accent); text-decoration: none; }

/* Kopfleiste */
.lk-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 6px max(20px, env(safe-area-inset-left));
    background: rgba(242, 242, 247, .82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--lk-separator);
}

.lk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--lk-label);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.01em;
}

.lk-brand svg { width: 32px; height: 32px; }

.lk-nav-links {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.lk-nav-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    color: var(--lk-secondary);
    font-weight: 600;
    font-size: 16px;
}

.lk-nav-links a[aria-current="page"] {
    color: var(--lk-accent);
    background: var(--lk-accent-soft);
}

.lk-navbar-end {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.lk-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    font-weight: 500;
}

/* Seitenaufbau */
.lk-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px max(20px, env(safe-area-inset-left)) 48px;
}

.lk-large-title {
    margin: 12px 0 4px;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.lk-subtitle {
    margin: 0 0 20px;
    color: var(--lk-secondary);
    font-size: 17px;
}

.lk-section-title {
    margin: 28px 4px 8px;
    color: var(--lk-secondary);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Schaltflächen */
.lk-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--lk-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.lk-button:active { transform: scale(.98); background: var(--lk-accent-pressed); }
.lk-button.is-large { min-height: 54px; padding: 0 28px; font-size: 18px; border-radius: 14px; }
.lk-button.is-secondary { background: var(--lk-accent-soft); color: var(--lk-accent); }
.lk-button.is-plain { background: transparent; color: var(--lk-accent); padding: 0 10px; }
.lk-button[aria-pressed="true"] { background: var(--lk-accent); color: #fff; }
.lk-button svg { width: 20px; height: 20px; }

.lk-icon-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--lk-accent-soft);
    color: var(--lk-accent);
    font-size: 24px;
    cursor: pointer;
}

/* Segment-Umschalter */
.lk-segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 11px;
    background: rgba(118, 118, 128, .12);
}

.lk-segmented button {
    min-height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--lk-label);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.lk-segmented .segment {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 9px;
    color: var(--lk-label);
    font-size: 15px;
    font-weight: 500;
}

.lk-segmented .segment[aria-selected="true"],
.lk-segmented button[aria-selected="true"] {
    background: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* Karten und gruppierte Listen */
.lk-card {
    padding: 20px;
    border-radius: var(--lk-radius-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-shadow);
}

.lk-list {
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    border-radius: var(--lk-radius);
    background: var(--lk-surface);
}

.lk-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 56px;
    padding: 8px 16px;
    color: var(--lk-label);
}

.lk-row + .lk-row { box-shadow: inset 58px 1px 0 -57px var(--lk-separator); }
.lk-list > li + li .lk-row { border-top: 1px solid var(--lk-separator); }

.lk-row-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #fff;
}

.lk-row-icon svg { width: 20px; height: 20px; }
.lk-row-text { flex: 1; min-width: 0; }
.lk-row-title { font-weight: 500; }
.lk-row-detail { color: var(--lk-secondary); font-size: 15px; }
.lk-chevron { color: var(--lk-tertiary); font-size: 22px; }

/* Statuskennzeichen */
.lk-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.lk-pill.is-ok { background: #DCFCE7; color: #166534; }
.lk-pill.is-provisional { background: #F0FDF4; color: #15803D; }
.lk-pill.is-repeat { background: #DBEAFE; color: #1D4ED8; }
.lk-pill.is-strike { background: #FEE2E2; color: #B91C1C; }
.lk-pill.is-gold { background: #FEF3C7; color: #92400E; }
.lk-pill.is-locked { background: #F2F2F7; color: var(--lk-secondary); }
.lk-pill.grade-platinum { background: #EDE9FE; color: #6D28D9; }
.lk-pill.grade-gold { background: #FEF3C7; color: #92400E; }
.lk-pill.grade-silver { background: #E5E7EB; color: #374151; }
.lk-pill.grade-bronze { background: #F3E3D3; color: #784421; }
.lk-pill.grade-failed { background: #F3F4F6; color: #374151; }
.lk-pill.has-strike { background: #FEE2E2; color: #B91C1C; }
.lk-pill.needs-repeat { background: #DBEAFE; color: #1D4ED8; }
.lk-pill.submission-confirmed { background: #DCFCE7; color: #166534; }

/* Blatt, das von unten hereinfährt */
.lk-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, .25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.lk-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 100;
    width: min(640px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 8px 24px calc(24px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--lk-surface);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .18);
    transform: translate(-50%, 105%);
    transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}

.lk-sheet.is-open { transform: translate(-50%, 0); }
.lk-sheet.is-open + .lk-sheet-backdrop,
.lk-sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.lk-sheet-grabber {
    width: 40px;
    height: 5px;
    margin: 4px auto 14px;
    border-radius: 3px;
    background: rgba(60, 60, 67, .25);
}

/* Schritte einer Aufgabe */
.lk-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 18px 0;
    padding: 0;
    list-style: none;
}

.lk-step {
    padding: 12px;
    border-radius: 12px;
    background: var(--lk-bg);
    color: var(--lk-secondary);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.lk-step.is-done { background: #DCFCE7; color: #166534; }
.lk-step.is-current { background: var(--lk-accent-soft); color: var(--lk-accent); box-shadow: inset 0 0 0 2px var(--lk-accent); }

/* Lernlandkarte im Lernkompass-Rahmen */
.lk-map-frame {
    padding: 10px;
    border-radius: var(--lk-radius-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-shadow);
}

.lk-map-frame .map-canvas {
    border-radius: 14px;
    box-shadow: none;
}

.lk-strikes {
    color: var(--lk-strike);
    font-weight: 800;
    letter-spacing: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Kopfleiste: Nutzer */
.lk-user {
    max-width: 260px;
    overflow: hidden;
    color: var(--lk-secondary);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lk-navbar form { margin: 0; }

/* Meldungen */
.lk-messages { margin: 8px 0 16px; padding: 0; list-style: none; }

.lk-message {
    margin-bottom: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--lk-accent-soft);
    color: var(--lk-accent);
    font-weight: 500;
}

.lk-message.success { background: #DCFCE7; color: #166534; }
.lk-message.error { background: #FEE2E2; color: #991B1B; }
.lk-message.warning { background: #FEF3C7; color: #92400E; }

/* Kopf einer Seite mit Titel links und Aktionen rechts */
.lk-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.lk-page-header .lk-subtitle { margin-bottom: 0; }
.lk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Kachelraster */
.lk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.lk-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 120px;
    padding: 20px;
    border-radius: var(--lk-radius-lg);
    background: var(--lk-surface);
    box-shadow: var(--lk-shadow);
    color: var(--lk-label);
    transition: transform .15s, box-shadow .15s;
}

a.lk-tile:active { transform: scale(.985); }
.lk-tile-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.lk-tile-detail { color: var(--lk-secondary); font-size: 15px; }
.lk-tile-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }

.lk-tile-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: var(--lk-accent-soft);
    color: var(--lk-accent);
    font-size: 22px;
    font-weight: 700;
}

/* Leerer Zustand */
.lk-empty {
    padding: 40px 24px;
    border-radius: var(--lk-radius-lg);
    background: var(--lk-surface);
    color: var(--lk-secondary);
    text-align: center;
}

.lk-empty h2 { margin: 0 0 6px; color: var(--lk-label); font-size: 20px; }
.lk-empty p { margin: 0 0 16px; }

/* Formulare */
.lk-form {
    max-width: 720px;
}

.lk-form .lk-card + .lk-card { margin-top: 16px; }
.lk-form h2 { margin: 0 0 12px; font-size: 20px; }

.lk-field { margin-bottom: 18px; }
.lk-field:last-child { margin-bottom: 0; }

.lk-field > label,
.lk-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
}

.lk-field .helptext,
.lk-help {
    display: block;
    margin-top: 6px;
    color: var(--lk-secondary);
    font-size: 14px;
}

.lk-field input[type="text"],
.lk-field input[type="number"],
.lk-field input[type="email"],
.lk-field input[type="url"],
.lk-field input[type="search"],
.lk-field input[type="time"],
.lk-field input:not([type]),
.lk-field select,
.lk-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid rgba(60, 60, 67, .22);
    border-radius: 12px;
    background: #fff;
    color: var(--lk-label);
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.lk-field select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236C6C70' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 18px;
}

.lk-field textarea { min-height: 120px; resize: vertical; }

.lk-field input:focus,
.lk-field select:focus,
.lk-field textarea:focus {
    outline: none;
    border-color: var(--lk-accent);
    box-shadow: 0 0 0 4px rgba(0, 74, 123, .15);
}

.lk-field input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1.5px dashed rgba(60, 60, 67, .3);
    border-radius: 12px;
    background: var(--lk-bg);
    font: inherit;
    font-size: 15px;
}

/* Kontrollkästchen als Liste mit großen Tippflächen */
.lk-field ul { margin: 0; padding: 0; list-style: none; }

.lk-field ul label,
.lk-field div > div > label,
.lk-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 4px;
    font-weight: 500;
    cursor: pointer;
}

.lk-field input[type="checkbox"],
.lk-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--lk-accent);
}

.lk-field .errorlist {
    margin: 6px 0 0;
    padding: 0;
    color: #B91C1C;
    font-size: 14px;
    font-weight: 600;
    list-style: none;
}

/* Merkbox und Wissensschatz */
.merkbox {
    border-left: 5px solid #E0A82E;
    background: linear-gradient(160deg, #FFFBF0, #fff 60%);
}

.merkbox h2 { display: flex; align-items: center; gap: 8px; }
.merkbox ul { margin: 0; padding-left: 20px; }
.merkbox li { padding: 3px 0; overflow-wrap: anywhere; }

.treasure {
    margin-top: 28px;
    padding: 20px 22px;
    border-radius: var(--lk-radius-lg);
    background: linear-gradient(160deg, #FFF8E6, #fff 55%);
    box-shadow: var(--lk-shadow);
}

.treasure-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.treasure-head h2 { margin: 0; font-size: 22px; }
.treasure-head p { margin: 2px 0 0; color: var(--lk-secondary); font-size: 15px; }

.treasure-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(150deg, #F2B544, #C98A12);
    color: #fff;
}

.treasure-icon svg { width: 28px; height: 28px; }

.treasure-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.treasure-group { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .85); border: 1px solid rgba(201, 138, 18, .18); }
.treasure-group h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 15px; }
.treasure-group ul { margin: 0; padding-left: 18px; font-size: 15px; }
.treasure-group li { padding: 2px 0; overflow-wrap: anywhere; }
.treasure-group.is-collected { border-color: rgba(22, 163, 74, .35); }
.treasure-check { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #16A34A; color: #fff; font-size: 12px; }

/* Termine */
.appointments { margin-top: 32px; }
.appointments-empty { color: var(--lk-secondary); }

.appointment-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--lk-accent-soft);
    color: var(--lk-accent);
    line-height: 1.1;
}

.appointment-day { font-size: 13px; font-weight: 700; text-transform: uppercase; }
.appointment-number { font-size: 15px; font-weight: 700; }

/* Klassenauswahl mit aufklappbaren weiteren Klassen */
.class-choices { margin-bottom: 8px; background: var(--lk-bg); }
.class-choices:not(:has(li)) { display: none; }
.class-choices .lk-check { padding: 0 14px; }
.class-choices li + li .lk-check { border-top: 1px solid var(--lk-separator); }

.more-classes summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--lk-accent);
    font-weight: 600;
    cursor: pointer;
}

.lk-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.lk-button.is-danger { background: #FEE2E2; color: #B91C1C; }
.lk-button.is-danger-solid { background: #DC2626; color: #fff; }

/* Startseite */
.lk-welcome {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 60px);
    padding: 32px 0 48px;
    text-align: center;
}

.lk-welcome-logo {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin: 0 auto 20px;
    border-radius: 26px;
    background: linear-gradient(160deg, #ffffff, #EAF1F7);
    box-shadow: var(--lk-shadow), inset 0 0 0 1px var(--lk-separator);
}

.lk-welcome-logo svg {
    width: 88px;
    height: 88px;
    filter: drop-shadow(0 3px 6px rgba(0, 58, 97, .3));
}

.lk-welcome h1 { margin: 0; font-size: 44px; font-weight: 700; letter-spacing: -.025em; }
.lk-tagline { margin: 6px 0 32px; color: var(--lk-secondary); font-size: 21px; }
.lk-hint { margin-top: 14px; color: var(--lk-secondary); font-size: 15px; }

.lk-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 56px auto 0;
    text-align: left;
}

.lk-benefits h3 { margin: 12px 0 4px; font-size: 17px; }
.lk-benefits p { margin: 0; color: var(--lk-secondary); font-size: 15px; }

.lk-benefit-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--lk-accent-soft);
    color: var(--lk-accent);
}

.lk-benefit-icon svg { width: 24px; height: 24px; }

.lk-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 760px) {
    .lk-benefits, .lk-two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .lk-large-title { font-size: 28px; }
    .lk-nav-links { display: none; }
    .lk-steps { grid-template-columns: 1fr; }
    .lk-user { display: none; }
}
