/* ==========================================================================
   Planer Webtool - Design-System
   Aufbau: Variablen > Basis > Komponenten > Seiten
   ========================================================================== */


/* === SCHRIFTART === */

@font-face {
    font-family: "Roboto";
    src: url(../webfonts/roboto/Roboto-Regular.ttf) format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url(../webfonts/roboto/Roboto-Medium.ttf) format("truetype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url(../webfonts/roboto/Roboto-Bold.ttf) format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: "Roboto";
    src: url(../webfonts/roboto/Roboto-Italic.ttf) format("truetype");
    font-style: italic;
    font-weight: 400;
    font-display: swap;
}


/* === DESIGN-VARIABLEN === */

:root {
    color-scheme: light dark;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #e8effd;
    --on-primary: #ffffff;

    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #1f2937;
    --muted: #64748b;
    --border: #e2e8f0;

    --danger: #b91c1c;
    --danger-soft: #fdecec;
    --success: #15803d;
    --success-soft: #e7f6ec;

    --termin-eigen-bg: #e8effd;
    --termin-eigen-accent: #2563eb;
    --termin-andere-bg: #e6f6f4;
    --termin-andere-accent: #0f9488;
    --termin-pause-bg: #f1f5f9;
    --termin-pause-accent: #94a3b8;
    --frei-bg: #fef3c7;
    --frei-accent: #d97706;
    --feiertag-bg: #fdecec;
    --feiertag-accent: #b91c1c;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 10px 20px -5px rgba(15, 23, 42, .12);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, .35);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #60a5fa;
        --primary-hover: #93c5fd;
        --primary-soft: #1e3a5f;
        --on-primary: #0b1220;

        --bg: #0f172a;
        --surface: #1e293b;
        --surface-alt: #172033;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --border: #334155;

        --danger: #fca5a5;
        --danger-soft: #3b1d1d;
        --success: #86efac;
        --success-soft: #14301f;

        --termin-eigen-bg: #1e3a5f;
        --termin-eigen-accent: #60a5fa;
        --termin-andere-bg: #123a37;
        --termin-andere-accent: #2dd4bf;
        --termin-pause-bg: #273449;
        --termin-pause-accent: #64748b;
        --frei-bg: #3d2f10;
        --frei-accent: #fbbf24;
        --feiertag-bg: #3b1d1d;
        --feiertag-accent: #fca5a5;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
        --focus-ring: 0 0 0 3px rgba(96, 165, 250, .45);
    }
}


/* === BASIS === */

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.25;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

a {
    color: var(--primary);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

:focus:not(:focus-visible) {
    outline: none;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

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

.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

main {
    flex: 1 0 auto;
    width: 100%;
    padding-bottom: 2.5rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}


/* === BUTTONS === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .6rem 1.1rem;
    font: inherit;
    font-weight: 500;
    line-height: 1.2;
    color: var(--on-primary);
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn-sekundaer {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.btn-sekundaer:hover {
    background: var(--surface-alt);
    border-color: var(--muted);
}

.btn-block {
    width: 100%;
}

.btn-gross {
    min-height: 50px;
    font-size: 1.05rem;
}

.btn[disabled],
.btn[aria-busy="true"] {
    opacity: .7;
    cursor: progress;
}

.btn[aria-busy="true"]::before {
    content: "";
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: drehen .7s linear infinite;
}

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


/* === FORMULARE === */

.feld {
    margin-bottom: 1.1rem;
}

.feld label {
    display: block;
    margin-bottom: .35rem;
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
}

.feld-hinweis {
    margin: .35rem 0 0;
    font-size: .85rem;
    color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select {
    width: 100%;
    min-height: 46px;
    padding: .6rem .85rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}

input:hover,
select:hover {
    border-color: var(--muted);
}

input:focus,
select:focus {
    border-color: var(--primary);
}

input[readonly] {
    color: var(--text);
    background: var(--surface-alt);
    border-style: dashed;
    cursor: default;
}

input[readonly]:hover {
    border-color: var(--border);
}

input.ungueltig {
    border-color: var(--danger);
}

.passwort-feld {
    position: relative;
}

.passwort-feld input {
    padding-right: 3rem;
}

.passwort-umschalter {
    position: absolute;
    top: 50%;
    right: .3rem;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.passwort-umschalter:hover {
    color: var(--text);
    background: var(--surface-alt);
}


/* === MELDUNGEN === */

.meldung {
    display: none;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: 1.1rem;
    padding: .75rem .9rem;
    font-size: .95rem;
    border-radius: var(--radius-sm);
}

.meldung.sichtbar {
    display: flex;
}

.meldung-fehler {
    color: var(--danger);
    background: var(--danger-soft);
}

.meldung-erfolg {
    color: var(--success);
    background: var(--success-soft);
}

.meldung i {
    margin-top: .2rem;
}


/* === KARTEN === */

.karte {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.karte-inhalt {
    padding: 1.5rem;
}


/* === HEADER (App-Leiste) === */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    color: #fff;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    box-shadow: var(--shadow-sm);
}

.topbar .container {
    display: flex;
    align-items: center;
    height: 64px;
}

.marke {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: inherit;
    text-decoration: none;
}

.marke-logo {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, .18);
    border-radius: 11px;
}

.marke small {
    font-size: .8rem;
    font-weight: 400;
    opacity: .8;
}


/* === BENUTZER-LEISTE === */

.benutzerleiste {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.benutzerleiste .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: .75rem;
    padding-bottom: .75rem;
}

.benutzer-info {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 0;
}

.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.benutzer-name {
    font-weight: 500;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.benutzer-rolle {
    font-size: .85rem;
    color: var(--muted);
}

.benutzer-aktionen {
    display: flex;
    gap: .5rem;
}


/* === SEITENKOPF === */

.seitenkopf {
    padding: 1.75rem 0 1.25rem;
}

.seitenkopf p {
    margin: .3rem 0 0;
    color: var(--muted);
}


/* === LOGIN / PASSWORT (zentrierte Karte) === */

.zentrum {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 2.5rem 1rem 0;
}

.zentrum-vorspann {
    margin-bottom: 1.5rem;
    text-align: center;
}

.zentrum-symbol {
    display: inline-grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 18px;
}

.zentrum-vorspann p {
    margin: .35rem 0 0;
    color: var(--muted);
}

body.login main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 4rem;
}


/* === MODUL-KACHELN (Startseite) === */

.kachel-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.modul-kachel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    min-height: 150px;
    padding: 1.4rem;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.modul-kachel:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.modul-kachel-symbol {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 15px;
    transition: background-color .15s, color .15s;
}

.modul-kachel:hover .modul-kachel-symbol {
    color: var(--on-primary);
    background: var(--primary);
}

.modul-kachel-titel {
    margin-top: auto;
    font-size: 1.1rem;
    font-weight: 500;
}

.leer-hinweis {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.leer-hinweis i {
    display: block;
    margin-bottom: .75rem;
    font-size: 2rem;
    opacity: .6;
}


/* === DATENFORMULAR (Meine Daten) === */

.daten-raster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.25rem;
}

.daten-raster .feld:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .daten-raster {
        grid-template-columns: 1fr;
    }
}


/* === TAGESNAVIGATION === */

.tagesnavigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.tagesnavigation .btn-icon {
    min-width: 44px;
    padding: .6rem;
}

.tagesnavigation select {
    width: auto;
    min-width: 170px;
}

.tagesnavigation input[type="date"] {
    width: auto;
    min-width: 160px;
}

.tag-titel {
    margin-left: auto;
    font-weight: 500;
    color: var(--muted);
}

.tag-titel strong {
    color: var(--text);
}

@media (max-width: 560px) {
    .tag-titel {
        flex-basis: 100%;
        margin-left: 0;
        order: -1;
    }
}


/* === TERMINE === */

.termin-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: .85rem;
}

.termin {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .9rem 1rem;
    background: var(--termin-eigen-bg);
    border-left: 5px solid var(--termin-eigen-accent);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.termin-andere {
    background: var(--termin-andere-bg);
    border-left-color: var(--termin-andere-accent);
}

.termin-pause {
    background: var(--termin-pause-bg);
    border-left-color: var(--termin-pause-accent);
}

.termin-zeit {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
}

.termin-therapeut {
    font-size: .85rem;
    font-weight: 500;
    color: var(--muted);
}

.termin-titel {
    font-weight: 500;
}

.termin-details {
    font-size: .92rem;
    color: var(--muted);
}

.legende {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: var(--muted);
}

.legende span::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: .4rem;
    vertical-align: -1px;
    border-radius: 4px;
    background: var(--punkt, var(--primary));
}

.legende .l-eigen {
    --punkt: var(--termin-eigen-accent);
}

.legende .l-andere {
    --punkt: var(--termin-andere-accent);
}

.legende .l-pause {
    --punkt: var(--termin-pause-accent);
}

.legende .l-frei {
    --punkt: var(--frei-accent);
}

.legende .l-feiertag {
    --punkt: var(--feiertag-accent);
}


/* === SCHICHTPLAN === */

.schicht-tag {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.schicht-tag-heute {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm);
}

.schicht-tag-leer {
    background: var(--surface-alt);
    box-shadow: none;
}

.schicht-tag-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

.schicht-tag-leer .schicht-tag-kopf {
    margin-bottom: .6rem;
    padding-bottom: 0;
    border-bottom: 0;
}

.schicht-tag-titel {
    margin: 0 auto 0 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.schicht-tag-titel small {
    margin-left: .6rem;
    font-size: .9rem;
    font-weight: 400;
    color: var(--muted);
}

.schicht-tag-leer .schicht-tag-titel {
    color: var(--muted);
    font-weight: 500;
}

.schicht-badge {
    padding: .2rem .7rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.schicht-badge-feiertag {
    color: var(--feiertag-accent);
    background: var(--feiertag-bg);
}

.schicht-badge-heute {
    color: var(--on-primary);
    background: var(--primary);
    border-color: var(--primary);
}

.schicht-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.schicht {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1rem 1.15rem;
    background: var(--termin-eigen-bg);
    border-left: 5px solid var(--termin-eigen-accent);
    border-radius: var(--radius-sm);
}

.schicht-frei {
    background: var(--frei-bg);
    border-left-color: var(--frei-accent);
}

.schicht-tag-feiertag {
    border-color: var(--feiertag-accent);
}

.schicht-andere {
    background: var(--termin-andere-bg);
    border-left-color: var(--termin-andere-accent);
}

.schicht-zeit {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.schicht-name {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1rem;
    font-weight: 500;
}

.schicht-eigen-marker {
    padding: .05rem .5rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--on-primary);
    background: var(--termin-eigen-accent);
    border-radius: 999px;
}

.schicht-notiz {
    padding-top: .5rem;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--muted);
    border-top: 1px dashed var(--border);
}

.schicht-leer {
    margin: 0;
    font-size: .92rem;
    color: var(--muted);
}

/* Stundenplan-Ansicht (Desktop/Tablet) */

.schichtplan-desktop {
    display: block;
}

.schichtplan-mobil {
    display: none;
}

.schichtplan-scroll {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.schichtplan-tabelle {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    table-layout: fixed;
}

.schichtplan-tabelle th,
.schichtplan-tabelle td {
    padding: .6rem .5rem;
    vertical-align: top;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.schichtplan-tabelle th:last-child,
.schichtplan-tabelle td:last-child {
    border-right: 0;
}

.schichtplan-tabelle tbody tr:last-child th,
.schichtplan-tabelle tbody tr:last-child td {
    border-bottom: 0;
}

.schichtplan-tabelle thead th {
    padding: .8rem .5rem;
    text-align: center;
    background: var(--surface-alt);
    border-bottom: 2px solid var(--border);
}

.schichtplan-tabelle .sp-person-kopf,
.schichtplan-tabelle .sp-person {
    width: 190px;
    text-align: left;
}

.schichtplan-tabelle .sp-person-kopf {
    padding-left: 1rem;
}

.schichtplan-tabelle .sp-person {
    padding-left: 1rem;
    font-weight: 500;
    background: var(--surface-alt);
}

.sp-tag-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.sp-tag-datum {
    display: block;
    font-size: .8rem;
    font-weight: 400;
    color: var(--muted);
}

.schichtplan-tabelle td.sp-wochenende,
.schichtplan-tabelle thead th.sp-wochenende {
    background: var(--surface-alt);
}

.schichtplan-tabelle td.sp-heute {
    background: var(--primary-soft);
}

.schichtplan-tabelle td.sp-feiertag {
    background: var(--feiertag-bg);
}

.schichtplan-tabelle thead th.sp-feiertag {
    color: var(--feiertag-accent);
    background: var(--feiertag-bg);
}

.schichtplan-tabelle thead th.sp-feiertag .sp-tag-datum {
    color: var(--feiertag-accent);
}

.sp-feiertag-name {
    display: block;
    margin-top: .15rem;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.schichtplan-tabelle thead th.sp-heute {
    color: var(--on-primary);
    background: var(--primary);
}

.schichtplan-tabelle thead th.sp-heute .sp-tag-datum {
    color: var(--on-primary);
    opacity: .85;
}

.schichtplan-tabelle .sp-zeile-eigen .sp-person {
    border-left: 4px solid var(--termin-eigen-accent);
}

.sp-schicht {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .4rem .55rem;
    font-size: .85rem;
    background: var(--termin-eigen-bg);
    border-left: 4px solid var(--termin-eigen-accent);
    border-radius: var(--radius-sm);
}

.sp-schicht + .sp-schicht,
.sp-frei + .sp-schicht {
    margin-top: .4rem;
}

.sp-frei {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .4rem .55rem;
    font-size: .85rem;
    background: var(--frei-bg);
    border-left: 4px solid var(--frei-accent);
    border-radius: var(--radius-sm);
}

.sp-frei-text {
    font-weight: 700;
}

.sp-schicht-andere {
    background: var(--termin-andere-bg);
    border-left-color: var(--termin-andere-accent);
}

.sp-zeit {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sp-notiz {
    font-size: .78rem;
    line-height: 1.35;
    color: var(--muted);
    overflow-wrap: anywhere;
}

@media (max-width: 860px) {
    .schichtplan-desktop {
        display: none;
    }

    .schichtplan-mobil {
        display: block;
    }
}

@media (max-width: 560px) {
    .schicht-tag {
        padding: 1rem;
    }

    .schicht-liste {
        grid-template-columns: 1fr;
    }
}


/* === FOOTER === */

.site-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 1.25rem 0;
    font-size: .875rem;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.site-footer i {
    margin-right: .35rem;
}


/* === SMARTPHONE === */

@media (max-width: 560px) {
    h1 {
        font-size: 1.4rem;
    }

    .benutzerleiste .container {
        flex-direction: column;
        align-items: stretch;
    }

    .benutzer-aktionen .btn {
        flex: 1;
    }

    .karte-inhalt {
        padding: 1.15rem;
    }
}
