/* ==========================================================
   cms-layout.css
   Structural Layout for CMS
   - Sidebar
   - Main area (inner scroll)
   ========================================================== */

/* Body: nur das Panel scrollt, nicht die ganze Seite */
.cms-body {
    height: 100vh;
    overflow: hidden;
}

/* Layout Wrapper */
.cms-layout {
    display: flex;
    min-height: 100vh;
}

/* -------------------------
   Sidebar
------------------------- */
.cms-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--cms-panel-bg);
    border-right: 1px solid var(--cms-border-subtle);

    display: flex;
    flex-direction: column;

    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;

    padding: 1rem 0.75rem; /* vorher kleiner -> wieder wie früher */
}

.cms-sidebar-top {
    padding: 0.35rem 0.25rem 0.85rem 0.25rem;
}

.cms-sidebar-logoLink {
    display: flex;
    justify-content: center; /* Logo horizontal mittig */
    align-items: center;
    text-decoration: none;
}

.cms-sidebar-logo {
    max-width: 100%;
    height: 36px;
    width: auto;
    display: block;
}

/* Logo Switching (nur wenn beide existieren) */
[data-theme="dark"] .cms-logo--switchable.cms-logo--light {
    display: none;
}
[data-theme="light"] .cms-logo--switchable.cms-logo--dark {
    display: none;
}

/* Nav scrollt innerhalb Sidebar */
.cms-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.cms-sidebar-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cms-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;

    padding: 0.6rem 0.75rem; /* etwas luftiger */
    border-radius: 0.65rem;

    font-size: 0.92rem;
    line-height: 1.15;
    color: var(--cms-text-muted);
    text-decoration: none;

    transition: background 0.12s ease, color 0.12s ease;
}

.cms-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cms-text);
    text-decoration: none;
}

.cms-sidebar-link.is-active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--cms-text);
    font-weight: 650;
}

/* Icons */
.cms-nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    opacity: 0.92;
    flex: 0 0 20px;
}

.cms-nav-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.cms-nav-label {
    white-space: nowrap;
}

/* Settings etwas „wertiger“ */
.cms-sidebar-link.is-settings {
    padding-top: 0.62rem;
    padding-bottom: 0.62rem;
}

.cms-sidebar-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--cms-border-subtle);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem; /* wieder mehr Luft */
}

.cms-sidebar-user {
    text-align: center;
}

.cms-sidebar-userName {
    font-size: 0.82rem;
    font-weight: 650;
}

.cms-sidebar-userRole {
    font-size: 0.72rem;
    color: var(--cms-text-muted);
    margin-top: 0.15rem;
}

.cms-sidebar-logout {
    width: 100%;
    justify-content: center;
}

/* Simple theme button (dein bestehender Toggle) */
.cms-theme-toggle {
    width: 86px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--cms-border-subtle);
    background: var(--cms-surface);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    gap: 14px;
}

.cms-theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 120, 120, 120), 0.25);
}

.cms-theme-label {
    opacity: 0.6;
    line-height: 1;
}

body[data-theme="dark"] .cms-theme-label-dark { opacity: 1; }
body[data-theme="light"] .cms-theme-label-light { opacity: 1; }

.cms-sidebar-copyright {
    font-size: 0.72rem;
    color: var(--cms-text-muted);
    text-align: center;
}

/* -------------------------
   Main Area (Panel Scroll)
------------------------- */
.cms-main {
    flex: 1;
    min-width: 0;
    background: var(--cms-bg);

    height: 100vh;
    overflow: hidden;

    display: flex;
    padding: 1.5rem;
    justify-content: center; /* Panel horizontal mittig */
}

.cms-main-inner {
    width: 100%;
    max-width: 1180px;
    position: relative; /* Referenz für absolute Toasts */
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--cms-panel-bg);
    border: 1px solid var(--cms-border-subtle);
    border-radius: var(--cms-radius-md);

    height: 100%;
    overflow-y: auto;

    position: relative; /* für sticky flash/toasts */
}

/* -------------------------
   Responsive: schmal -> nur Icons, Sidebar bleibt
------------------------- */
@media (max-width: 900px) {
    .cms-sidebar {
        width: 68px;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .cms-sidebar-link {
        justify-content: center;
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }

    .cms-nav-label {
        display: none; /* nur Icons */
    }

    .cms-sidebar-logout {
        padding-left: 0;
        padding-right: 0;
    }

    .cms-main {
        padding: 1rem;
    }

    .cms-main-inner {
        padding: 1rem;
    }
}
