/* ============================================================
   components/_frame.css — Public-Frame (0.1.7)
   ------------------------------------------------------------
   Header, Sidebar, Layout-Wrapper, Main, Footer und der mobile
   Hamburger-Toggle. Ersetzt die alte assets/css/style.css.

   Klassennamen bleiben rückwärtskompatibel (.site-header, .sidebar,
   .layout-wrapper, .main-content, .footer, .hamburger, etc.), damit
   bestehende Templates ohne Änderung weiterlaufen. Konsumiert
   ausschließlich `--pub-*`-Tokens.
============================================================ */

/* ----------------------------------------------------------------
   Reset (minimal)
   ---------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--pub-bg-page);
    color: var(--pub-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

/* ----------------------------------------------------------------
   Header (Top-Bar)
   ---------------------------------------------------------------- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--pub-brand);
    color: var(--pub-text-inverse);
    padding: 10px 20px;
    border-bottom: 3px solid var(--pub-brand-soft);
    flex-wrap: wrap;
}

.site-header .logo-area {
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

.site-header .logo-area img {
    display: block;
}

.site-header .site-title {
    font-size: 1.4rem;
    line-height: 1.2;
    font-weight: 600;
}

.site-header .user-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-size: 0.9rem;
    line-height: 1.4;
    gap: 4px;
}

.site-header .login-link,
.site-header .logout-link {
    color: var(--pub-text-inverse);
    text-decoration: none;
    font-weight: 600;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--pub-radius-sm);
    padding: 4px 12px;
    cursor: pointer;
    transition: background var(--pub-transition),
                border-color var(--pub-transition);
}

.site-header .login-link:hover,
.site-header .login-link:focus-visible,
.site-header .logout-link:hover,
.site-header .logout-link:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    outline: none;
}

/* Welcome-Box (eingeloggt) */
.welcome {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.9rem;
}

.welcome p {
    margin: 0 0 4px 0;
}

.welcome strong {
    color: var(--pub-text-inverse);
}

/* Logout als kleines Form (form.u-inline, button.logout-link) */
.u-inline {
    display: inline;
    margin: 0;
    padding: 0;
}

/* Link-Button-Reset für Buttons die wie Links aussehen sollen */
.c-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    color: inherit;
}

/* ----------------------------------------------------------------
   Layout-Wrapper (Sidebar + Main)
   ---------------------------------------------------------------- */
.layout-wrapper {
    display: flex;
    flex: 1;
    flex-direction: row;
    min-height: 0;
}

/* ----------------------------------------------------------------
   Sidebar
   ---------------------------------------------------------------- */
.sidebar {
    background: var(--pub-brand-tint);
    width: 270px;
    padding: 10px;
    border-right: 4px solid var(--pub-brand-soft);
    flex-shrink: 0;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li {
    list-style: none;
    width: 100%;
}

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 8px;
    color: var(--pub-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--pub-radius-sm);
    transition: background var(--pub-transition);
}

.sidebar nav ul li a:hover,
.sidebar nav ul li a:focus-visible {
    background-color: var(--pub-brand-soft);
    color: var(--pub-text);
    text-decoration: none;
    outline: none;
}

/* Submenu */
.sidebar nav ul li ul.submenu {
    display: none;
    max-height: 0;
    overflow: hidden;
    margin-left: 12px;
    padding-left: 8px;
    list-style: none;
    transition: max-height 0.3s ease;
}

.sidebar nav ul li.open > ul.submenu {
    display: block;
    max-height: 500px;
}

/* Submenu-Pfeile — Spezifitäts-Fix aus 0.0.71-Reihe übernommen */
.sidebar nav ul li.has-submenu > a.submenu-toggle::after {
    content: " ▸";
    margin-left: auto;
    color: var(--pub-text);
    font-size: 0.95em;
    float: none;
}

.sidebar nav ul li.has-submenu.open > a.submenu-toggle::after {
    content: " ▾";
}

/* Navigation-Icons (Emoji-Wrapper) */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    margin-right: 0.4em;
}

/* ----------------------------------------------------------------
   Main
   ---------------------------------------------------------------- */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-width: 0;
}

/* ----------------------------------------------------------------
   Footer
   ---------------------------------------------------------------- */
.footer {
    background-color: var(--pub-brand-tint);
    padding: 14px 20px;
    border-top: 3px solid var(--pub-brand-soft);
    font-size: 0.88rem;
    color: var(--pub-text);
}

.footer-3col {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.footer-col   { flex: 1; min-width: 0; }
.footer-left  { text-align: left; }
.footer-center { text-align: center; }
.footer-right  { text-align: right; }

.footer a {
    color: var(--pub-brand-strong);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover,
.footer a:focus-visible {
    text-decoration: underline;
    outline: none;
}

/* ----------------------------------------------------------------
   Hamburger (Mobile-Toggle)
   ---------------------------------------------------------------- */
.hamburger {
    display: none;
    background: var(--pub-brand-soft);
    color: var(--pub-text-inverse);
    padding: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    border: 0;
    border-radius: var(--pub-radius-sm);
}

.hamburger:focus-visible {
    outline: 2px solid var(--pub-text-inverse);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------
   Legacy-Helper — werden von wenigen verbliebenen alten Templates
   noch genutzt. Nicht entfernen bevor sie migriert sind.
   ---------------------------------------------------------------- */

.mb-0 { margin-bottom: 0 !important; }

.hint {
    font-size: 0.8rem;
    color: var(--pub-text-muted);
    font-style: italic;
    display: inline-block;
    margin-left: 6px;
}

/* ----------------------------------------------------------------
   Responsive (< 768px): Sidebar einklappbar
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 3px solid var(--pub-brand-soft);
    }

    .sidebar.active {
        display: block;
    }

    .hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .site-header {
        gap: 8px;
    }

    .site-header .site-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 700px) {
    .footer-3col {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .footer-col {
        flex: none;
        width: 100%;
        text-align: center !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 16px 12px;
    }

    .site-header {
        padding: 8px 12px;
    }

    .site-header .logo-area {
        gap: 12px;
    }

    .site-header .logo-area img {
        height: 56px;
    }
}
