/* Nur Breite begrenzen — kein overflow-x auf html (würde mit overflow-y:visible → y:auto erzwingen) */
html {
    max-width: 100%;
    /* Verhindert horizontales Layout-Zittern, wenn die Scrollbar ein-/ausblendet (Edge/Windows oft empfindlicher als Chrome). */
    scrollbar-gutter: stable;
}

:root {
    /* Globaler Abstand, damit der fixe Footer nie Inhalt überdeckt */
    --footer-safe-space: 7rem;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    font-style: normal;
    margin: 0;
    padding: 0 0 calc(var(--footer-safe-space) + env(safe-area-inset-bottom, 0px));
    background-color: #eae2e2;
    color: #333;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-weight: 700; /* globale Überschriften fett */
    margin: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 2rem;
    background-color: white;
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.header-left {
    flex: 0 0 25%; /* 25% Breite */
    padding: 0 3rem;
    min-width: 0;
}

.header-left h1 {
    margin: 0;
    font-size: 3em;
    font-weight: 900;
}

.header-right {
    flex: 0 0 45%; /* ca. 2/3 Breite */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    position: relative;
    overflow: visible;
}

.header-nav {
    display: flex;
    gap: 1rem;
    font-size: 0.9em;
    align-items: center;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.header-actions > .menu {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    flex: none;
}

/* Globale Billing-Hinweisleiste (unter Logo/Nav, nicht in der Topbar) */
.billing-grace-banner--site {
    flex: 0 0 100%;
    width: 100%;
    order: 10;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    margin: 0.65rem 0 0;
    padding: 0.55rem 0.85rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 0.88rem;
    line-height: 1.45;
    box-sizing: border-box;
}

.billing-grace-banner--site .billing-grace-banner__icon {
    font-weight: 700;
    color: #856404;
    flex-shrink: 0;
    line-height: 1.45;
}

.billing-grace-banner--site .billing-grace-banner__content {
    flex: 1;
    min-width: 0;
}

.billing-grace-banner--site .billing-grace-banner__line {
    margin: 0;
}

.billing-grace-banner--site .billing-grace-banner__reason {
    display: inline;
}

.billing-grace-banner--site .billing-grace-banner__sep {
    margin: 0 0.35rem;
    color: #856404;
    opacity: 0.65;
}

.billing-grace-banner--site .billing-grace-banner__link {
    margin-left: 0.35rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .billing-grace-banner--site .billing-grace-banner__sep {
        display: none;
    }

    .billing-grace-banner--site .billing-grace-banner__line {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .billing-grace-banner--site .billing-grace-banner__link {
        margin-left: 0;
    }
}



.logged-out .logout-btn {
    display: none;
}

.logged-out .notif-btn,
.logged-out .notif-panel,
.logged-out .focus-topbar-group,
.logged-out .focus-info-panel,
.logged-out .profile-btn {
    display: none;
}

.logged-out .login-btn {
    display: none;
}

.logged-in .login-btn {
    display: none;
}

.logged-in .logout-btn {
    display: block;
}



button {
    margin: 5px;
}

nav {
    display: flex;
    gap: 1rem;
    font-size: 0.9em; /* etwas kleiner */
}

nav a {
    text-decoration: none;
    color: #333;
    padding: 0.3rem 0.5rem;
}

nav a:hover {
    color: #4CAF50;
}

nav a.profile {
    font-size: 1.5rem;
}

.notif-btn {
    position: relative;
    font-size: 1.25rem;
    line-height: 1;
}

.profile-btn {
    font-size: 1.25rem;
    line-height: 1;
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notif-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.5rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.2rem;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    margin-top: 0.35rem;
    width: min(22rem, 86vw);
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.16);
    z-index: 1500;
    overflow: hidden;
}

.notif-panel-header {
    padding: 0.65rem 0.8rem;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.notif-mark-all {
    border: none;
    background: transparent;
    color: #2e6ea8;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    font-family: inherit;
    white-space: nowrap;
}

.notif-mark-all:hover {
    text-decoration: underline;
}

.notif-mark-all:disabled {
    opacity: 0.55;
    cursor: default;
    text-decoration: none;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 22rem;
    overflow-y: auto;
}

.notif-item {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: grid;
    gap: 0.25rem;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.unread {
    background: #eef7ff;
}

.notif-item strong {
    font-size: 0.92rem;
}

.notif-item span {
    font-size: 0.85rem;
    color: #555;
}

.notif-empty {
    padding: 0.8rem;
    color: #666;
}

.focus-topbar-group button {
    margin: 0;
}

.focus-topbar-group label {
    margin: 0;
}

/* Unterrichtsfokus (Topbar) */
.focus-topbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0 0.15rem 0 0;
    padding: 0.2rem 0.35rem 0.2rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(26, 26, 46, 0.12);
    background: rgba(255, 255, 255, 0.72);
    vertical-align: middle;
    flex-shrink: 0;
}

.focus-topbar-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    background: transparent;
    padding: 0.15rem 0.35rem 0.15rem 0;
    cursor: default;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #3d4654;
    line-height: 1;
}

.focus-topbar-label {
    white-space: nowrap;
}

.focus-led {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.focus-led--on {
    background: #2dce89;
}

.focus-led--alert {
    background: #e53935;
}

.focus-led--off {
    background: #b0b8c4;
}

.focus-info-btn {
    border: none;
    background: transparent;
    color: #6a7380;
    font-size: 0.82rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    margin: 0;
    font-family: inherit;
    border-left: 1px solid rgba(26, 26, 46, 0.1);
}

.focus-info-btn:hover {
    color: #1a1a2e;
    background: rgba(26, 26, 46, 0.04);
}

.focus-visibility-btn {
    border: none;
    background: rgba(26, 26, 46, 0.06);
    color: #4a5568;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 0.28rem 0.5rem;
    margin: 0;
    font-family: inherit;
    border-left: 1px solid rgba(26, 26, 46, 0.1);
    border-radius: 0 999px 999px 0;
    white-space: nowrap;
}

.focus-visibility-btn:hover {
    background: rgba(26, 26, 46, 0.1);
    color: #1a1a2e;
}

.focus-visibility-btn--visible {
    background: rgba(45, 206, 137, 0.15);
    color: #1d6b47;
}

.focus-visibility-btn--visible:hover {
    background: rgba(45, 206, 137, 0.22);
}

.focus-info-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    margin-top: 0.35rem;
    width: min(20rem, 86vw);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
    z-index: 1490;
    overflow: hidden;
}

.focus-info-panel__inner {
    padding: 0.75rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #333;
}

.focus-info-panel__inner p {
    margin: 0 0 0.5rem;
}

.focus-info-panel__inner p:last-child {
    margin-bottom: 0;
}

nav .focus-topbar-group,
.header-actions .focus-topbar-group {
    align-self: center;
}

@media (max-width: 720px) {
    .focus-topbar-label {
        display: none;
    }

    .focus-topbar-group {
        padding: 0.2rem 0.25rem;
    }
}

.login-btn, .logout-btn {
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
}

.login-btn:hover, .logout-btn:hover {
    background-color: #45a049;
}

/* Login-Modal: siehe style_login_modal.css */

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1rem;
    position: fixed;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 3;
    box-sizing: border-box;
    transition: transform 0.3s ease-in-out;
    transform: translateY(100%);
    will-change: transform;
}

footer.active {
    transform: translateY(0);
}

.footer-content {
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.footer-content > p {
    margin: 0;
    line-height: 1.45;
}

.footer-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem 0.85rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.footer-nav a {
    color: #93c5fd;
    text-decoration: none;
    font-size: 0.88em;
    line-height: 1.35;
}

.footer-nav a:hover {
    text-decoration: underline;
}

.container {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* flex-start: Content-Spalte nur so hoch wie Inhalt — nicht auf Sidebar-Höhe strecken (sonst leerer Raum unten) */
    align-items: flex-start;
    min-width: 0;
}

/* Mathematik: Sidebar aus dem Fluss — sonst wächst die Flex-Zeile mit der Sidebar-Höhe und lässt unter
   dem kurzen Inhalt einen großen leeren Streifen (max(Sidebar, Content) in der Querachse). */
.container:has(.sidebar) {
    display: block;
    position: relative;
    padding-left: 20vw;
}

.container:has(.sidebar.collapsed) {
    padding-left: 16px;
}

.container:has(.sidebar) > .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    max-height: calc(100vh - 5.5rem);
    max-height: calc(100dvh - 5.5rem);
    overflow-y: auto;
    z-index: 25;
}

/* Hauptspalte: Innenabstand zum Rand der Spalte + optionale Maxbreite (zentriert) */
.container > .content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.container:has(.sidebar) > .content {
    flex: unset;
    width: 100%;
    max-width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}
