/* Gesamter Scrollbalken */
::-webkit-scrollbar {
    width: 12px; /* Breite des Balkens */
    background: transparent; /* Hintergrund transparent */
    color: var(--background-transparent-color);
}

/* Hintergrundspur (Track) */
::-webkit-scrollbar-track {
    background: transparent; /* Spur transparent */
    width:10px;
}

/* Daumen (der bewegliche Teil) */
::-webkit-scrollbar-thumb {
    background-color: rgba(100, 100, 100, 0.5); /* halbtransparentes Grau */
    border-radius: 6px; /* abgerundet */
    border: 3px solid transparent; /* Abstand zur Spur */
    background-color: var(--background-transparent-color);
    margin-right: 0.5em;
}


/* =========================
Für mobile Ansicht
========================= */
main.app-view {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 2em; /* Abstand zwischen den Apps */
    padding: 1em; /* optional: Innenabstand */
}

main.app-view .app {
    flex: 0 0 20%; /* jede App nimmt 20% Breite */
    height: calc((100vh - 2.5em) * 0.25);
    min-height: calc((100vh - 2.5em) * 0.25);
    max-height: calc((100vh - 2.5em) * 0.25);
    font-size: 0.25em;
    position: relative;
    top: 0;
    left:0;
    box-shadow: none;
    scroll-snap-align: start;
}

/* =========================
Basis-App Container
========================= */
.app,
.app.mini,
.app:focus,
.app:focus-visible,
.app:focus:not(:focus-visible) {
    background-color: var(--background-transparent-color);
    backdrop-filter: var(--light-glass);
    box-shadow: var(--shadow-light);
    border-radius: 0 0.5em;
    border: var(--light-border);
    color: var(--text-color);
    display: block;
    font-size: 1em;
    height: 50%;
    min-height: 400px;
    max-height: calc(100dvh - 2em);
    position: absolute;
    resize: none;
    width: 50%;
    min-width: 400px;
    max-width: 100dvw;
    outline:none;
    z-index: 7000;
}

.app.active,
.app.mini{
    backdrop-filter: var(--light-glass-active);
}

.app.mini{
    z-index:1010;
    max-width:400px;
    height:auto;
    min-height:0;
}

.app.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100dvw !important;
    height: calc(100%) !important;
    border-radius: 0;
    box-shadow: none;
}

.app.minimized {
    top: 100dvh;
    left: 3.5em;
    height: 0;
    width: 0;
    opacity:0;
    overflow:hidden;
    box-shadow:none;
}

.app.top,
.app.bottom {
    top: 0 !important;
    left: 0 !important;
    height: calc((100dvh - 2em) / 2);
    min-height: calc((100dvh - 2em) / 2);
    max-height: calc((100dvh - 2em) / 2);
    width: 100dvw !important;
}

.app.left,
.app.right{
    left:0 !important;
    width:calc(100dvw / 2) !important;
}

    .app.right {
        left: calc(100dvw / 2) !important;
    }

.app.bottom{
    top:calc((100dvh - 2em) - (100dvh - 2em) / 2) !important;
}

/* =========================
Titel-Leiste
========================= */
.app_title {
    backdrop-filter: var(--light-glass);
    background-color: var(--background-transparent-color);
    border-radius: 0 0.5em 0 0;
    display: block;
    float: left;
    font-size: 0.8em;
    height: 2em;
    line-height: 2em;
    margin: 0;
    padding: 0;
    text-align: left;
    touch-action: none;
    width: 100%;
    user-select: none;
    -webkit-user-select: none; /* für Safari/Chrome */
    -moz-user-select: none; /* für Firefox */
    -ms-user-select: none; /* für ältere IE/Edge */
}

.app_title .iconandname {
    display: block;
    float: left;
    height: 2em;
    line-height: 2em;
    margin-left: 0.5em;
    width: calc(100% - 1em - 6em);
    text-align: center;
    /* Text nicht auswählbar */

}


.app_title .iconandname i{
    display:block;
    float:left;
    height:2em;
    line-height:2em;
    max-height: 2em;
    vertical-align:central;
    width: 2em;
}

.app_title .appbuttons {
    display: block;
    float: right;
    height: 2em;
    line-height: 2em;
    margin-right: 0.5em;
    text-align:right;
}

.app_title .appbuttons a,
.app_title .appbuttons i {
    color: var(--main-txt-color);
    cursor: default;
    display:block;
    height: 2em;
    font-size:0.7em;
    float:left;
    line-height: 2em;
    max-height: 2em;
    margin: 0.43em;
    opacity: 0.6;
    text-align: center;
    vertical-align:central;
    width: 2em;
}

.app_title .appbuttons a:hover,
.app_title .appbuttons i:hover {
    opacity: 1;
    font-weight:bold;
}

/* =========================
App-Navigation
========================= */
.app_navigation {
    display: flex;
    float: left;
    gap: 0 0.5em;
    height: 2em;
    line-height: 2em;
    padding: 0 0.5em;
    font-weight: normal;
    margin: 0;
    text-align: left;
    vertical-align: middle;
    width: calc(100% - 1em);
    user-select: none;
    -webkit-user-select: none; /* für Safari/Chrome */
    -moz-user-select: none; /* für Firefox */
    -ms-user-select: none; /* für ältere IE/Edge */
}

.app_navigation a,
.app_navigation i {
    display: flex;
    align-items: center; /* vertikal zentrieren */
    justify-content: center; /* horizontal zentrieren */
    font-size: 1em;
    height: 2em;
    cursor: default;
    opacity: 0.6;
}

.app_navigation a:hover,
.app_navigation i:hover {
    opacity:1.0;
    font-weight:bold;
}

.app_navigation .toggle_appmenu {
    position:absolute; 
    right:0.5em; 
    width:2em;
    opacity: 0.6;
}

.app_navigation .toggle_appmenu:hover {
    opacity: 1.0;
    font-weight: bold;
}

/* =========================
Buttons
========================= */
.app .confirm-button.bw {
    background-color: var(--main-txt-color);
    color: var(--background-color);
}

.app .confirm-button.bw:hover,
.app .confirm-button.bw:focus {
    background-color: var(--background-color);
    color: var(--main-txt-color);
    box-shadow: none;
}


/* =========================
Content-Bereich
========================= */
.content {
    width: calc(100% - 2em);
    display: block;
    float: left;
    padding: 0 1em 1em 1em;
}

.app_content {
    display: block;
    float: left;
    height: calc(100% - 1em - 4em);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.5em;
    margin: 0;
    width: calc(100% - 1em);
}

.app_content form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.app_content form > div {
    margin: 0;
    flex: 1 1 calc(30% - 0.5em);
}

.app_content form > div.short {
    flex: 0 1 calc(30% - 0.5em);
}

.app_content form > div.half {
    flex: 1 0 calc(50% - 1em);
}

.app_content form > div.full {
    flex: 1 0 calc(100% - 0.5em);
}

.app_content form label {
    left: 5px;
}

.app_content form input[type=text],
.app_content form input[type=password],
.app_content textarea,
.app_content select {
    width: calc(100% - 1em - 2px);
    padding: 0 0.5em;
}

/* =========================
Appmenü
========================= */
.appmenu,
.side_content {
    display: block;
    float: left;
    height: 100%;
    min-width: 10em;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
}

.appmenu {
    max-width: 10em;
    float: right;
}

.appmenu.close {
    opacity: 1;
    min-width: 2em;
    width: 2em;
    overflow: hidden;
}

.appmenu a {
    display: block;
    float: left;
    width: calc(100% - 2em - 5px);
    border-right: solid 5px transparent;
    text-align: right;
    padding: 0 1em;
    height: 2em;
    line-height: 2em;
    opacity:0.8;
}

.appmenu a i {
    display:block;
    float:left;
    height:2em;
    line-height:2em;
}

.appmenu.close a {
    width:2em;
    padding:0 0.5em;
}

.appmenu.close span{
    display:none;
}

.appmenu a:hover {
    border-right: solid 5px var(--system-color);
    background-color: var(--background-transparent-color);
    opacity:1;
}

.appmenu .selected {
    border-right: solid 5px var(--system-color);
    background-color: var(--background-transparent-color);
    opacity:1;
}

/* =========================
Side-Bereiche
========================= */

.side_content {
    width: calc(100% - 11em);
    text-align: center;
    min-width: 10em;
}

.side_content.full {
    width: calc(100% - 2px - 2.5em);
}

.side_content h2 {
    text-align: left;
}

.side_content option {
    text-align: left;
    background-color: var(--main-bgt-color);
    color: var(--main-text-color);
    font-size: 1em;
}

/* =========================
Setup-Felder
========================= */
.setup_field {
    backdrop-filter: blur(30px) saturate(1);
    background-color: var(--main-bgt-color);
    border: solid 1px var(--main-txtt-color);
    border-radius: 0 0.5em;
    display: block;
    float: left;
    min-height: 1em;
    height: auto;
    padding: 0.5em;
    margin-bottom: 0.5em;
    text-align: left;
    width: calc(100% - 1em - 2px);
}

.setup_field_left {
    display: block;
    float: left;
    width: calc(100% - 6em);
    padding-left: 2em;
}

.setup_field_right {
    display: block;
    float: left;
    width: 1.5em;
    padding-left: 0;
}

/* =========================
Expand-Funktionen
========================= */
.expand_container {
    display: block;
    float: left;
    height: auto;
    width: 100%;
}

.expand_toggle {
    cursor: default;
    display: block;
    float: left;
    height: 2.0em;
    line-height: 2.0em;
    justify-content: space-between;
    margin: 0.5em 0;
    width: 100%;
}

.expand_toggle i {
    display: block;
    float: right;
    height: 2.0em;
    line-height: 2.0em;
    opacity: 0.6;
    transition: all 0.3s ease;
    vertical-align: middle;
    width: auto;
}

.expand_toggle.rotated i {
    transform: rotate(-180deg);
}

.expand_button {
    position: absolute;
    right: 0.5em;
    top: 0.5em;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.expand_button:hover,
.expand_toggle i.hover {
    opacity: 1;
    font-weight: bold;
}

.expand_button.rotated {
    transform: rotate(-180deg);
}

.expand_content {
    height: auto;
    transition: all 0.3s ease;
    display: block;
    float: left;
    line-height: 2em;
    width: 100%;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}


.expand_content.open {
    max-height: unset;
    opacity: 1;
}

/* =========================
Form-Binder
========================= */
.form_binder {
    display: block;
    float: left;
    min-height: 3em;
    max-width: 40%;
    min-width: 30em;
    margin-left: 5em;
    height: auto;
}

/* =========================
Resize-Griffe
========================= */
.resize-handle {
    position: absolute;
    z-index: 50;
}

.resize-handle.bottom {
    height: 5px;
    width: 100%;
    cursor: ns-resize;
    bottom: 0;
}

.resize-handle.right {
    width: 5px;
    height: 100%;
    cursor: ew-resize;
    right: 0;
}
