/* =====================================================================
   DSGVO-Consulting Portal – Stylesheet
   Mobile-first, responsiv (Smartphone/Tablet/Desktop), barrierearm.
   Funktioniert systemunabhängig in allen modernen Browsern
   (Chrome, Firefox, Safari, Edge auf Windows/macOS/Linux/iOS/Android).
   ===================================================================== */

:root {
    /* Farben sind auf WCAG 2.1 AA Kontrast (>= 4.5:1 für Text) abgestimmt. */
    --c-primary:      #1f4e6b;   /* seriöses Petrol-Blau (weiß darauf: 8.3:1) */
    --c-primary-dark: #163a50;
    --c-accent:       #1f6f6c;   /* Teal für Buttons (weiß darauf: ~4.9:1) */
    --c-bg:           #f4f6f8;
    --c-surface:      #ffffff;
    --c-text:         #1c2733;
    --c-muted:        #51606c;   /* gedämpfter Text (~5:1 auf weiß) */
    --c-border:       #cfd8df;
    --c-success-bg:   #e4f5ec; --c-success-fg: #155d39;
    --c-error-bg:     #fdecec; --c-error-fg:   #962020;
    --c-info-bg:      #e8f1f8; --c-info-fg:    #1f4e6b;
    --c-new:          #146f6c;
    --c-important:    #8a5600;
    --c-done:         #51606c;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16,40,60,.08), 0 4px 16px rgba(16,40,60,.06);
    --maxw: 1160px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --c-bg: #131a21; --c-surface: #1b242d; --c-text: #e8edf1;
        --c-muted: #9fb0bd; --c-border: #2c3942;
        --c-success-bg:#143626; --c-error-bg:#3a1d1d; --c-info-bg:#16303f;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6;
    color: var(--c-text); background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; }
a { color: var(--c-primary); }
a:hover { color: var(--c-accent); }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

/* Barrierefreiheit: sichtbarer Fokus & Skip-Link */
:focus { outline: 3px solid var(--c-accent); outline-offset: 2px; }      /* Fallback */
:focus:not(:focus-visible) { outline: none; }                            /* Maus: dezent */
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.skip-link {
    position: absolute; left: -999px; top: 0; background: var(--c-primary); color:#fff;
    padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Nur für Screenreader sichtbar (visuell ausgeblendet). */
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Höherer Kontrast, wenn das System dies anfordert. */
@media (prefers-contrast: more) {
    :root { --c-muted: #3c4753; --c-border: #9aa7b2; }
    .btn { border-color: currentColor; }
}

/* Windows-Kontrastmodus / Forced Colors: Ränder & Fokus erzwingen. */
@media (forced-colors: active) {
    .btn, .card, .badge, input, select, textarea, .table-wrap { border: 1px solid; }
    :focus-visible { outline: 3px solid; }
}

h1,h2,h3 { line-height: 1.25; color: var(--c-text); }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .65rem 1.15rem; border-radius: var(--radius); border: 1px solid transparent;
    background: var(--c-primary); color: #fff; font-weight: 600; font-size: 1rem;
    text-decoration: none; cursor: pointer; transition: background .15s, transform .05s;
    min-height: 44px;  /* Touch-Ziel */
}
.btn:hover { background: var(--c-primary-dark); color:#fff; }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--c-accent); }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn--ghost:hover { background: var(--c-bg); color: var(--c-text); }
.btn--danger { background: var(--c-error-fg); }
.btn--small { padding: .4rem .7rem; min-height: 36px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn--login { background: var(--c-accent); }

/* ---------------- Public Header ---------------- */
.site-header {
    background: var(--c-surface); border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--c-primary); text-decoration: none; font-size: 1.15rem; }
.brand__mark {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent)); color: #fff; font-weight: 800; font-size: .95rem;
}
.mainnav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.mainnav a { padding: .55rem .8rem; border-radius: 8px; text-decoration: none; color: var(--c-text); font-weight: 500; }
.mainnav a[aria-current="page"] { color: var(--c-primary); background: var(--c-info-bg); }
.mainnav a:hover { background: var(--c-bg); }
.mainnav .btn--login { color: #fff; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { width: 26px; height: 3px; background: var(--c-text); border-radius: 2px; }

@media (max-width: 860px) {
    .nav-toggle { display: flex; }
    .mainnav {
        position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch;
        background: var(--c-surface); border-bottom: 1px solid var(--c-border);
        padding: .5rem 1rem 1rem; gap: .15rem; box-shadow: var(--shadow);
        display: none;
    }
    .mainnav.is-open { display: flex; }
    .mainnav a { padding: .8rem; }
}

/* ---------------- Footer ---------------- */
.site-footer { background: var(--c-primary-dark); color: #cfe0ea; margin-top: 4rem; padding: 2rem 0; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer a { color: #fff; margin-left: 1rem; text-decoration: none; }
.site-footer a:first-child { margin-left: 0; }
.site-footer p { margin: 0; }

/* ---------------- Hero & Sektionen ---------------- */
.hero { padding: clamp(2rem, 6vw, 4.5rem) 0; }
.hero h1 { margin-top: 0; }
.hero p.lead { font-size: 1.2rem; color: var(--c-muted); max-width: 60ch; }
.lead { font-size: 1.1rem; color: var(--c-muted); }
.section { padding: 2.5rem 0; }
.prose { max-width: 72ch; }
.prose p, .prose ul { margin-bottom: 1rem; }

/* ---------------- Cards / Grid ---------------- */
.grid { display: grid; gap: 1.25rem; }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card--stat { text-align: center; }
.card--stat .num { font-size: 2.2rem; font-weight: 800; color: var(--c-primary); display: block; }
.card--stat .label { color: var(--c-muted); }

/* ---------------- Alerts ---------------- */
.alert { padding: .85rem 1.1rem; border-radius: var(--radius); margin: 1rem 0; border: 1px solid transparent; }
.alert--success { background: var(--c-success-bg); color: var(--c-success-fg); border-color: var(--c-success-fg); }
.alert--error   { background: var(--c-error-bg);   color: var(--c-error-fg);   border-color: var(--c-error-fg); }
.alert--info    { background: var(--c-info-bg);     color: var(--c-info-fg);    border-color: var(--c-info-fg); }

/* ---------------- Badges / Status ---------------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--c-bg); color: var(--c-muted); border: 1px solid var(--c-border); }
.badge--new { background: #e2f3f3; color: var(--c-new); border-color: var(--c-new); }
.badge--important { background: #fbf0db; color: var(--c-important); border-color: var(--c-important); }
.badge--done { background: var(--c-bg); color: var(--c-done); }

/* ---------------- Forms ---------------- */
.form { max-width: 560px; }
.form--wide { max-width: 860px; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field .hint { color: var(--c-muted); font-size: .87rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=url], select, textarea {
    width: 100%; padding: .7rem .8rem; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--c-border); border-radius: var(--radius);
    background: var(--c-surface); color: var(--c-text);
}
textarea { min-height: 120px; resize: vertical; }
.field--check { display: flex; align-items: flex-start; gap: .6rem; }
.field--check input { width: 20px; height: 20px; margin-top: .15rem; }
.field--check label { font-weight: 500; margin: 0; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
th { background: var(--c-bg); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--c-muted); }
tr:last-child td { border-bottom: 0; }
td .btn--small { margin-right: .25rem; }

/* Karten-Layout für Tabellen auf sehr kleinen Schirmen */
@media (max-width: 620px) {
    table.responsive, table.responsive thead, table.responsive tbody,
    table.responsive th, table.responsive td, table.responsive tr { display: block; min-width: 0; }
    table.responsive thead { display: none; }
    table.responsive tr { border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: .75rem; padding: .25rem .5rem; }
    table.responsive td { border: 0; padding: .4rem .5rem; display: flex; justify-content: space-between; gap: 1rem; }
    table.responsive td::before { content: attr(data-label); font-weight: 700; color: var(--c-muted); }
}

/* ---------------- App-Layout (Portal/Admin) ---------------- */
.app { display: flex; min-height: 100vh; }
.app__sidebar {
    width: 250px; background: var(--c-primary-dark); color: #dceaf2;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.theme-admin .app__sidebar { background: #1c2733; }
.app__brand { display: flex; align-items: center; gap: .6rem; padding: 1.2rem 1.25rem; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); }
.app__nav { display: flex; flex-direction: column; padding: 1rem .75rem; gap: .2rem; flex: 1; overflow-y: auto; }
.app__nav a { color: #cfe0ea; text-decoration: none; padding: .7rem .85rem; border-radius: 8px; font-weight: 500; }
.app__nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.app__nav a.is-active { background: var(--c-accent); color: #fff; }
.app__sidebar-foot { padding: 1rem .85rem; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: .5rem; }
.app__sidebar-foot a { color: #cfe0ea; text-decoration: none; font-size: .9rem; padding: .3rem; }

.app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app__topbar { display: flex; align-items: center; gap: 1rem; padding: .85rem clamp(16px,3vw,28px); background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 10; }
.app__title { font-size: 1.25rem; margin: 0; flex: 1; }
.app__user { color: var(--c-muted); font-size: .9rem; }
.app__content { padding: clamp(18px, 3vw, 32px); flex: 1; }
.nav-toggle--app { display: none; }
.nav-toggle--app span { background: var(--c-text); }

@media (max-width: 800px) {
    .app { flex-direction: column; }
    .app__sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; height: 100%; z-index: 40;
        transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
    }
    .app__sidebar.is-open { transform: translateX(0); }
    .nav-toggle--app { display: flex; flex-direction: column; gap: 5px; border: 0; background: none; padding: 6px; }
    .nav-toggle--app span { width: 24px; height: 3px; border-radius: 2px; }
}

/* ---------------- Login-Karte ---------------- */
.auth-wrap { min-height: 70vh; display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; margin-bottom: 1.2rem; }

/* ---------------- Dokument-/Videoliste ---------------- */
.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.doc-item { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1rem; }
.doc-item__main { min-width: 0; flex: 1; }
.doc-item__title { font-weight: 700; margin: 0 0 .2rem; }
.doc-item__meta { color: var(--c-muted); font-size: .87rem; display: flex; flex-wrap: wrap; gap: .35rem .8rem; }
.doc-item__actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.filterbar { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); align-items: end; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.25rem; }
.filterbar .field { margin: 0; }

.video-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); }
.video-card video, .video-card .embed { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius) var(--radius) 0 0; display: block; }
.video-card .embed iframe { width: 100%; height: 100%; border: 0; }
.video-card { padding: 0; overflow: hidden; }
.video-card__body { padding: 1rem; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head h1, .page-head h2 { margin: 0; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; }

.inline-form { display: inline; }
.muted { color: var(--c-muted); }
.mt { margin-top: 1.5rem; } .mb { margin-bottom: 1.5rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }

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