/* 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;
}

/* 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 .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;
}

.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;
}

.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;
}

.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;
    z-index: 3;
    transition: transform 0.3s ease-in-out; /* Hinzugefügter Übergang für das transform-Attribut */
    transform: translateY(100%); /* Startposition, der Footer ist außerhalb des sichtbaren Bereichs */
}

footer.active {
    transform: translateY(0); /* Endposition, der Footer ist vollständig sichtbar */
}

.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;
}
