/* Public sidebar — collapsible: 60px ikoner alltid, utvider til 240px ved hover */
.public-shell {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: 0 1fr auto;
    grid-template-areas:
        "header  header"
        "sidebar main"
        "footer  footer";
    min-height: 100vh;
    transition: grid-template-columns .2s ease;
}
.public-shell .public-main { padding-top: 56px !important; }
/* sidebar-expanded beholder samme grid — sidebar er fixed og overlapper main */

.lx-sidebar {
    /* Sidebar tar 60px i grid (hovedinnhold går til kanten av lukket sidebar),
       men hover-utvider via position:fixed slik at den overlapper main. */
    grid-area: sidebar;
    width: 60px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    left: 0;
    top: 56px;
    height: calc(100vh - 56px);
    transition: width .2s ease;
    z-index: 100;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.lx-sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.public-shell.sidebar-expanded .lx-sidebar { width: 240px; }
.lx-sidebar:hover { width: 240px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
.lx-sidebar-nav { display: flex; flex-direction: column; padding: 12px 0; }

.lx-sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 18px;
    color: var(--text-muted, #9ca3af);
    text-decoration: none;
    font-size: .9em;
    white-space: nowrap;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.lx-sidebar-link:hover { color: var(--text-primary, #fff); background: rgba(255,255,255,0.04); }
.lx-sidebar-link.active { color: var(--accent, #6c63ff); border-left-color: var(--accent, #6c63ff); background: rgba(108,99,255,0.10); }
[data-theme="light"] .lx-sidebar-link:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .lx-sidebar-link.active { background: rgba(108,99,255,0.08); }

.lx-sidebar-icon { flex: 0 0 24px; display: inline-flex; align-items: center; justify-content: center; }
.lx-sidebar-label {
    opacity: 0; transform: translateX(-4px);
    transition: opacity .15s, transform .15s;
    pointer-events: none;
}
.public-shell.sidebar-expanded .lx-sidebar-label,
.lx-sidebar:hover .lx-sidebar-label { opacity: 1; transform: translateX(0); }

/* Header slimmer — sticky on top */
.public-header {
    grid-area: header;
    display: flex !important; align-items: center; gap: 16px;
    padding: 0 24px;
    height: 56px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important;
    z-index: 9998 !important;
}
/* grid har 56px header-rad reservert — ingen ekstra padding */
.public-shell .lx-sidebar { top: 56px !important; }
.public-header .sidebar-brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 600; font-size: 1.05em; }
.public-header .sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.public-header .sidebar-brand-tagline { font-size: .62em; font-weight: 500; letter-spacing: .04em; color: var(--text-secondary); }
.public-header .sidebar-brand-mark {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent, #6c63ff), #8b80ff);
    color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.public-header-search { flex: 1; max-width: 480px; position: relative; }
.lx-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--chrome-bg, #14182a);
    border: 1px solid var(--chrome-border, rgba(255,255,255,0.10));
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 200;
    scrollbar-width: thin;
}
.lx-search-dropdown[hidden] { display: none }
.lx-search-group {
    padding: 8px 12px 4px;
    font-size: .7em;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    font-weight: 600;
}
.lx-search-item {
    display: block;
    padding: 8px 12px;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    font-size: .9em;
}
.lx-search-item:hover, .lx-search-item.active { background: rgba(108,99,255,0.15); color: var(--text-primary, #fff) }
[data-theme="light"] .lx-search-item:hover, [data-theme="light"] .lx-search-item.active { background: rgba(108,99,255,0.10); color: #0f1525 }
.lx-search-item code { font-size: .8em; color: var(--text-muted); margin-right: 6px }
.lx-search-item small { display: block; color: var(--text-muted); font-size: .85em; margin-top: 2px }
.lx-search-empty { padding: 12px; color: var(--text-muted); font-size: .9em; text-align: center }
.lx-search-footer { padding: 8px 12px; border-top: 1px solid var(--chrome-border); font-size: .8em; color: var(--text-muted) }
.public-header-search input {
    width: 100%; padding: 8px 14px; border-radius: 8px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    color: var(--text-secondary);
    font-size: .92em;
}
.public-header-search input::placeholder { color: var(--text-secondary) }
.public-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.public-user-menu { position: relative }
.public-user-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 6px;
    background: var(--chrome-bg); border: 1px solid var(--chrome-border);
    border-radius: 20px; color: inherit; cursor: pointer; font: inherit;
}
.public-user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #6c63ff), #8b80ff);
    color: #fff; font-weight: 700; font-size: .85em;
    display: inline-flex; align-items: center; justify-content: center;
}
.public-user-role { font-size: .85em; font-weight: 500 }
.public-user-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--chrome-bg); border: 1px solid var(--chrome-border);
    border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
    min-width: 180px; z-index: 200; display: none; padding: 6px;
}
.public-user-menu.open .public-user-dropdown { display: block }
.public-user-item {
    display: block; padding: 8px 12px; color: inherit; text-decoration: none;
    border-radius: 6px; font-size: .9em; width: 100%; text-align: left;
    background: transparent; border: 0; cursor: pointer; font: inherit;
}
.public-user-item:hover { background: rgba(108,99,255,0.10); color: var(--accent) }
.public-user-logout { color: #f87171 }
[data-theme="light"] .public-user-logout { color: #b91c1c }
.public-header-actions .btn,
.public-header-actions .btn-primary,
.public-header-actions .btn:hover,
.public-header-actions .btn:focus,
.public-header-actions .btn:active,
.public-header-actions .btn:visited,
.public-header-actions .btn-primary:hover,
.public-header-actions .btn-primary:focus,
.public-header-actions .btn-primary:active,
.public-header-actions .btn-primary:visited {
    padding: 6px 14px;
    font-size: .9em;
    border-radius: 6px;
    text-decoration: none;
    background: var(--chrome-bg) !important;
    border-color: var(--chrome-bg) !important;
    box-shadow: none;
    color: #ffffff !important;
    transform: none !important;
}
[data-theme="light"] .public-header-actions .btn,
[data-theme="light"] .public-header-actions .btn-primary,
[data-theme="light"] .public-header-actions .btn:hover,
[data-theme="light"] .public-header-actions .btn:focus,
[data-theme="light"] .public-header-actions .btn:active,
[data-theme="light"] .public-header-actions .btn:visited,
[data-theme="light"] .public-header-actions .btn-primary:hover,
[data-theme="light"] .public-header-actions .btn-primary:focus,
[data-theme="light"] .public-header-actions .btn-primary:active,
[data-theme="light"] .public-header-actions .btn-primary:visited {
    color: #000000 !important;
}

.public-main { grid-area: main; padding: 24px 32px; min-height: calc(100vh - 56px - 40px); background: var(--main-bg, transparent); }
/* Hindre sentrering — main skal alltid venstre-justere til sidebar-kanten */
.public-main > * { margin-inline-start: 0 !important; }
.public-main > section[style*="margin:48px auto"],
.public-main > section[style*="margin: 48px auto"],
.public-main > div[style*="margin:0 auto"],
.public-main > div[style*="margin: 0 auto"] { margin: 24px 0 !important; max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; }
.public-footer {
    grid-area: footer;
    padding: 10px 24px;
    background: var(--chrome-bg, #14182a);
    border: 0;
    color: var(--text-muted);
    font-size: .85em;
    min-height: 40px !important;
    line-height: 1.3;
    position: fixed !important;
    left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.public-main { padding-bottom: 60px !important; }
.public-footer-row { gap: 8px }
.public-footer-links { gap: 10px }
.public-main { background: var(--main-bg, transparent); }
.public-footer-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-start; width: 100% }
.public-footer-meta { margin-right: auto }
.public-footer-links { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto }
.public-footer-links a { color: var(--text-muted); text-decoration: none }
.public-footer-links a:hover { color: var(--accent) }

/* Mobile: sidebar blir slide-in via hamburger */
@media (max-width: 900px) {
    .public-shell { grid-template-columns: 1fr; grid-template-rows: 56px 1fr auto; grid-template-areas: "header" "main" "footer"; }
    .lx-sidebar {
        position: fixed; left: -260px; top: 56px; width: 260px; height: calc(100vh - 56px);
        transition: left .2s ease;
    }
    .public-shell.sidebar-open .lx-sidebar { left: 0; }
    .public-shell.sidebar-open::after {
        content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90;
    }
    .lx-sidebar:hover { box-shadow: none; }
    .lx-sidebar-label { opacity: 1; transform: none; }
    .public-header-hamburger { display: inline-flex; }
    .public-header-search { display: none; }
    .public-main { padding: 16px; }
}
.public-header-hamburger {
    display: none;
    width: 36px; height: 36px;
    align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border-default); border-radius: 6px;
    color: var(--text-default); cursor: pointer;
}
