/* =======================================================
   A Y R A . N E T  -  Basic Layout v3
   Struktur: Sidebar | Content-Shell | Maincontent
   ======================================================= */

/* ---------- 1. Root-Variablen ---------- */
:root {
    --sidebar-w: 250px;
    --sidebar-bg: rgb(25, 25, 25);
    --content-bg: rgb(30, 30, 30);
    --topbar-h: 60px;
    --gap: 1rem;

    --text: #f3f3f3;
    --muted: #a0a0a0;
    --brand: orange;
    --accent: #ffb84d;
    --ok: #3ddc97;
    --warn: #ffb84d;
    --err: #ff6b6b;
    --shadow: 0 8px 24px rgba(0, 0, 0, .4);

    --primary-color: var(--sidebar-bg);
    --primary-dark-color: var(--sidebar-bg);
    --ca-card: var(--sidebar-bg);
    --ca-stroke: rgba(255, 255, 255, 0.10);
    --ca-muted: #b9b9b9;
}

/* ---------- 2. Reset & Grundbasis ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-width: 0;
    min-height: 100%;
    background: var(--content-bg);
    color: white;
    font-family: Calibri, sans-serif;
}

body {
    overflow-x: hidden;
}

img,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    cursor: default;
}

h1,
h2,
h3,
h4 {
    color: orange;
    margin: 0;
}

p {
    margin: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =======================================================
   3. Layout-Struktur
   ======================================================= */

.layout,
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--content-bg);
    overflow: hidden;
}

.content-shell {
    min-width: 0;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--content-bg);
}

.layout .main,
.main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    background: var(--content-bg);
    padding: var(--gap);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Kompatibilitaet fuer alte Table-Layout-Fragmente */
body > table.layout {
    border-collapse: collapse;
    table-layout: fixed;
}

body > table.layout td {
    vertical-align: top;
    padding: 0;
}

.col-sidebar {
    width: var(--sidebar-w);
}

.col-content,
.content-cell {
    width: auto;
    min-width: 0;
}

/* =======================================================
   4. Sidebar
   ======================================================= */

.sidebar {
    width: var(--sidebar-w);
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.sidebar__inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 12px 0;
    overflow: hidden;
}

.sidebar-user {
    position: sticky;
    top: 0;
    z-index: 2;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
    margin-bottom: 8px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user img {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user__text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.sidebar-user .username {
    color: orange;
    font-weight: 600;
    font-size: 15px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user .role {
    color: #ccc;
    font-size: 13px;
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scrollbar-width: none;
    touch-action: pan-y;
}

.sidebar__nav::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar__logout {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* =======================================================
   5. Navigation
   ======================================================= */

.nav-group-title {
    position: relative;
    width: 100%;
    margin: 12px 8px 4px;
    padding: 8px 24px 8px 10px;
    text-align: left;
    background: none;
    border: none;
    outline: none;
    cursor: default;
    color: #bbb;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.nav-group-title:hover {
    color: orange;
}

.nav-group-title::after {
    content: "+";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #bbb;
    transition: transform 0.25s ease, color 0.2s ease;
}

.nav-group:not(.collapsed) > .nav-group-title::after {
    content: "-";
    color: orange;
}

.nav-group-content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.nav-group:not(.collapsed) > .nav-group-content {
    max-height: 800px;
    opacity: 1;
}

.nav-item {
    display: block;
    border: 2px solid transparent;
    background-color: transparent;
    border-radius: 8px;
    padding: 6px 10px;
    color: inherit;
    transition: all 0.25s ease;
}

.nav-item:hover {
    border-color: orange;
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-item-content {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 10px;
    padding: 8px 10px;
    min-width: 0;
}

.nav-item-content img {
    flex: 0 0 auto;
    height: 28px;
    width: auto;
    display: block;
}

.nav-item-content p {
    min-width: 0;
    margin: 0;
    color: white;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item:hover p {
    color: orange;
}

/* =======================================================
   6. Topbar
   ======================================================= */

.layout .topbar,
.topbar {
    display: none;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    flex: 0 0 auto;
}

.topbar-left {
    min-width: 0;
}

.burger {
    cursor: default;
}

/* =======================================================
   7. Responsive Desktop-Kompaktmodus
   ======================================================= */

@media (max-width: 1280px) and (min-width: 901px) {
    :root {
        --sidebar-w: 72px;
    }

    .layout .sidebar p,
    .layout .sidebar span,
    .layout .sidebar .menu-label,
    .layout .sidebar-user__text,
    .layout .nav-group-title {
        display: none;
    }

    .sidebar__logout {
        padding: 12px 8px;
    }

    .nav-item {
        padding: 6px 8px;
    }

    .nav-item-content {
        justify-content: center;
        padding: 8px;
    }

    .nav-group-content {
        max-height: none;
        opacity: 1;
    }
}

/* =======================================================
   8. Message-Box
   ======================================================= */

#standard-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-box {
    position: relative;
    top: 20px;
    right: 20px;
    background-color: var(--primary-dark-color);
    color: white;
    padding: 12px 18px;
    border-left: 4px solid orange;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message-box.show {
    opacity: 1;
    transform: translateY(0);
}

/* =======================================================
   9. Page::getTitle()
   ======================================================= */

.page-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    color: var(--text);
    min-width: 0;
}

.page-titlebar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-weight: 700;
    letter-spacing: .3px;
}

.page-titlebar__logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
    overflow: hidden;
    flex: 0 0 36px;
}

.page-titlebar__logo svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.page-titlebar__logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.page-titlebar__texts {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.page-titlebar__subtitle {
    font-size: 14px;
    color: #bbb;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-titlebar__title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .2px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-titlebar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.page-titlebar__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
}

.page-titlebar__chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 20%, transparent);
}

.page-titlebar__chip.is-ok .page-titlebar__chip-dot {
    background: var(--ok);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 20%, transparent);
}

.page-titlebar__chip.is-warn .page-titlebar__chip-dot {
    background: var(--warn);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--warn) 20%, transparent);
}

.page-titlebar__chip.is-err .page-titlebar__chip-dot {
    background: var(--err);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--err) 20%, transparent);
}

/* =======================================================
   10. Jumpscare Overlay
   ======================================================= */

@font-face {
    font-family: 'ExquisiteCorpse';
    src: url('/assets/generic/exquisite_corpse.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.ui-blocker {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: none;
    align-items: center;
    justify-content: center;
    background-image: url('/assets/system/nomoretyping.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

.ui-blocker__inner {
    display: grid;
    gap: 14px;
    place-items: center;
    text-align: center;
}

.ui-blocker__icon {
    height: 250px;
}

.ui-blocker__quote {
    color: #ffb86b;
    font-weight: 700;
    font-size: 6rem;
    margin: 0;
    font-family: 'ExquisiteCorpse', sans-serif;
}

@keyframes scare-shake {
    0%,
    100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-4px, 4px);
    }

    40% {
        transform: translate(4px, -4px);
    }

    60% {
        transform: translate(-4px, 3px);
    }

    80% {
        transform: translate(4px, 0);
    }
}

body.is-jumpscare {
    animation: scare-shake .12s infinite;
    overflow: hidden;
}

.scanline {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 2147483647;
    background: #000;
    opacity: .85;
    mix-blend-mode: difference;
    pointer-events: none;
}

/* =======================================================
   11. Input Prompt
   ======================================================= */

#ayra-inputprompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 598;
    display: grid;
    place-items: center;
}

#ayra-inputprompt-dialog {
    width: min(520px, 90vw);
    background: var(--content-bg, rgb(30, 30, 30));
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
    padding: 16px;
    z-index: 599;
    transform: translateY(-6px) scale(.98);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}

#ayra-inputprompt-dialog.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

#ayra-inputprompt-title {
    margin: 0 0 8px 0;
    color: orange;
    font-size: 18px;
    font-weight: 800;
}

#ayra-inputprompt-message {
    margin: 0 0 12px 0;
    color: #e8e8e8;
    font-size: 15px;
    line-height: 1.45;
}

#ayra-inputprompt-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

/* =======================================================
   12. Loader
   ======================================================= */

.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.loader-overlay-div {
    padding: 16px 18px;
    display: grid;
    gap: 10px;
    place-items: center;
    min-width: 220px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #fff;
    border-bottom-color: orange;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: loader-rotation 1s linear infinite;
}

@keyframes loader-rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-status {
    margin: 0;
    color: #cfcfcf;
    text-align: center;
    overflow-wrap: anywhere;
}

.p-note {
    font-size: 12px;
    color: #b9b9b9;
    margin: 6px 0 0;
}
