/* SBS — shared styles (header, nav, footer, base). Page-specific rules stay inline. */

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

/* Screen-reader-only text (e.g. "opens in new tab" hints) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link: hidden until focused, then appears top-left */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 100;
    background-color: #131a2e;
    color: #ffffff;
    border: 1px solid var(--accent-cyan, #54b9ff);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-cyan, #54b9ff);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: radial-gradient(circle at center, #111a30 0%, #060a13 80%);
}

header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
}

.brand img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid rgba(84, 185, 255, 0.3);
}

.brand span {
    color: var(--accent-cyan);
    font-weight: 600;
    text-shadow: 0 0 12px var(--accent-glow);
}

nav {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Angedeutete Trennlinien: kurze Striche zwischen den Menuepunkten,
   nicht ueber die volle Hoehe. */
nav > a {
    position: relative;
    padding: 0 1.25rem;
}
nav > a + a::before,
nav > #lang-switch::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background: rgba(140, 163, 199, 0.35);
}
nav > #lang-switch { position: relative; margin-left: 1.25rem; }
nav > #lang-switch::before { left: -0.6rem; }

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.2s, text-shadow 0.2s;
}

nav a:hover, nav a.active {
    color: var(--text-main);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

nav .nav-dashboard {
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.2s, text-shadow 0.2s;
}

nav .nav-dashboard:hover {
    color: #8fd2ff;
    text-shadow: 0 0 12px var(--accent-glow);
}

.site-footer {
    width: 100%;
    max-width: 1200px;
    margin: 3rem auto 0;
    padding: 1.5rem 2rem 2rem;
    border-top: 1px solid rgba(84, 185, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    position: relative;
    z-index: 5;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: center;
}

.footer-links a,
.footer-links button {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover,
.footer-links button:hover {
    color: var(--accent-cyan);
}

.footer-disclaimer {
    font-size: 0.75rem;
    color: #7a8fb3; /* >= 4.5:1 on the dark background (WCAG 1.4.3) */
    text-align: center;
    max-width: 700px;
    line-height: 1.5;
}

/* --- Sprachumschalter EN/DE (von i18n.js erzeugt) --- */
#lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.3rem 0.4rem 0.3rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    background: rgba(19, 26, 46, 0.6);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(8px);
}
#lang-switch > svg {
    width: 17px;
    height: 17px;
    margin-right: 0.35rem;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.6;
    flex-shrink: 0;
}
#lang-switch button {
    cursor: pointer;
    border: none;
    background: transparent;
    color: #8ca3c7;
    font: 700 0.85rem/1 "Segoe UI", system-ui, sans-serif;
    letter-spacing: 0.6px;
    padding: 0.4rem 0.65rem;
    border-radius: 2px;
    transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
#lang-switch button:hover { color: #ffffff; background: rgba(255, 255, 255, 0.12); }
#lang-switch button.active {
    background: #ffffff;
    color: #060a13;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}
#lang-switch button:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* Flagge liegt hinter dem Kuerzel im Button und blendet beim Hovern ein.
   overflow: hidden haelt sie in den abgerundeten Ecken. */
#lang-switch button { position: relative; overflow: hidden; }

#lang-switch .lang-code { position: relative; z-index: 2; }

#lang-switch .lang-flag {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transform: scale(1.08);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#lang-switch .lang-flag svg { display: block; width: 100%; height: 100%; }

#lang-switch button:hover .lang-flag,
#lang-switch button:focus-visible .lang-flag {
    opacity: 0.55;
    transform: scale(1);
}

/* Das Kuerzel muss auf der Flagge lesbar bleiben: heller Text bekommt einen
   dunklen Schatten, der dunkle Text der aktiven Sprache einen hellen. */
#lang-switch button:hover .lang-code,
#lang-switch button:focus-visible .lang-code {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

#lang-switch button.active:hover .lang-code,
#lang-switch button.active:focus-visible .lang-code {
    text-shadow: 0 0 4px #ffffff, 0 0 9px #ffffff;
}

/* Variante ohne Navigation (404/502/Weiterleitung): fest unten rechts */
#lang-switch.floating {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    background: rgba(10, 15, 28, 0.92);
}

@media (max-width: 768px) {
    #lang-switch.in-nav { order: -1; }
}
