/* 1. GLOBALE RETRO-FARBEN UND GEOS-KACHELMUSTER */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    /* Originales GEOS 2.0 Desktop-Hintergrundmuster (Pixel-Dithering via CSS) */
    background-color: #bfbfbf;
    /* C64 Hellgrau */
    background-image:
        linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff),
        linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;

    color: #000000;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    margin: 0;
    padding: 0;
    image-rendering: pixelated;
    overflow: hidden;
    /* Verhindert Scrollbalken auf dem OS-Desktop */
    height: 100vh;
    user-select: none;
}

.geos-desktop {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    box-sizing: border-box;
}

/* Dropdown Logik */
.geos-dropdown-trigger {
    position: relative;
}

.geos-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    border: 2px solid #000000;
    box-shadow: 4px 4px 0px #000000;
    min-width: 180px;
    z-index: 12000;
}

.geos-dropdown-trigger:hover .geos-dropdown-menu {
    display: block;
}

.geos-dropdown-item {
    color: #000000;
    padding: 6px 12px;
    font-weight: normal;
    text-transform: none;
    cursor: pointer;
    white-space: nowrap;
}

.geos-dropdown-item:hover {
    background-color: #000000;
    color: #ffffff;
}

/* GHOST */
.geos-window-ghost {
    display: none;
    position: fixed;
    pointer-events: none;
    box-sizing: border-box;
    border: 3px dashed black;
    background: rgba(255, 255, 255, 0.12);
    z-index: 99999;
}

/* WINDOW */

.geos-window {
    position: absolute;
    transform: none;

    background-color: #fff;
    border: 2px solid #000;
    width: max-content;
    max-width: 90vw;
    box-sizing: border-box;

    box-shadow: 4px 4px 0 #000;
    margin: 0;
    z-index: 10;

    display: block;
    transition: opacity 0.15s ease-out;
    will-change: left, top;
}

/* Wenn das Fenster geschlossen wird */
.geos-window.hidden {
    display: none;
    opacity: 0;
}

.geos-window-title {
    background-color: #ffffff;
    background-image: linear-gradient(0deg, #000000 50%, transparent 50%);
    background-size: 100% 3px;
    /* Simuliert Scanlines */
    border-bottom: 2px solid #000000;
    color: #000000;
    padding: 6px 35px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    position: relative;
    cursor: grab;
}

.geos-window-title:active {
    cursor: grabbing;
}

.geos-window-title span {
    background: #ffffff;
    padding: 1px 8px;
}

/* Schließbox */
.geos-close-box {
    position: absolute;
    left: 8px;
    top: 5px;
    width: 14px;
    height: 14px;
    border: 1px solid #000000;
    background: #ffffff;
    cursor: pointer;
}

.geos-close-box:active {
    background: #000000;
}

.geos-window-content {
    padding: 12px;
    /* min-height: 160px; */
    line-height: 1.4;
}





/* RETRO BUTTONS */
.geos-btn {
    background: #ffffff;
    border: 2px solid #000000;
    color: #000000;
    padding: 4px 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000000;
    margin-right: 5px;
}

.geos-btn:active {
    box-shadow: 0px 0px 0px #000000;
    transform: translate(2px, 2px);
}

/* Die quadratische Box links im Menü */
.geos-status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: 2px solid #000000;
    margin-right: 4px;
    background-color: #ffffff;
}

/* Der innere Statuspunkt */
.geos-status-dot {
    width: 8px;
    height: 8px;
    background-color: #000000;
    /* Standard: Verbunden / Schwarz */
}

/* OPTIONAL: Farbzustände im GEOS-Look */
.geos-status-box.error .geos-status-dot {
    background-color: #000000;
    /* Da GEOS monochrom war, bleibt es schwarz, aber blinkt */
    /* Falls du moderne Farben mischen willst: background-color: #ff0000; */
}

/* Der zweizeilige, kompakte Zeitstempel */
.geos-timestamp {
    position: absolute;
    right: 6px;
    top: 2px;
    font-size: 10px;
    line-height: 1.1;
    font-weight: bold;
    text-align: right;
    border: 1px solid #000000;
    pointer-events: none;
    text-transform: none;
}

.geos-entry {
    position: relative;
    width: fit-content;
    max-width: 100%;
    cursor: default;
}

.geos-entry::after {
    content: attr(data-timestamp);
    position: absolute;
    display: none;
    left: 100%;
    top: 0;
    margin-left: 8px;
    padding: 4px 8px;

    white-space: nowrap;
    color: #111;
    background: #c6c6c6;
    border: 2px solid #222;
    box-shadow: inset 1px 1px 0 #fff;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none;
}

.geos-entry:hover::after {
    display: block;
}

ul.no-bullets {
    list-style-type: none;
    padding-left: 0;
    padding-top: 0;
    margin-top: 0px;
    margin-bottom: 0px;
}

.geos-window-listeners {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-top: 1px solid #555;
    margin-top: 4px;
}

.geos-form-row {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    margin-bottom: 8px;
}

.geos-form-row label {
    padding-top: 4px;
}

.geos-form-row input,
.geos-form-row textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.geos-form-row textarea {
    resize: vertical;
}

.geos-green-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #00aa00;
    border: 1px solid #006600;
    box-sizing: border-box;
    vertical-align: middle;
}

.geos-red-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #cc0000;
    border: 1px solid #800000;
    box-sizing: border-box;
    vertical-align: middle;
}

/* MENU */

.geos-menubar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    z-index: 10000;
    display: flex;
    align-items: stretch;
    gap: 2px;
    background: white;
    border-bottom: 2px solid #222;

}

.geos-menu {
    position: relative;
}

.geos-menu-button {
    height: 100%;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #111;
    cursor: pointer;
    font-weight: bold;
}

.geos-window-menu-item {
        font-weight: bold;
}

.geos-menu-item {
    padding: 2px 12px;
    cursor: pointer;
    position: relative;
        font-weight: bold;
}

.geos-menu-item:hover {
    background-color: #000000;
    color: #ffffff;
}


.geos-menu-button:hover,
.geos-menu:focus-within>.geos-menu-button {
    background: #222;
    color: #fff;
}

.geos-menu:hover .geos-menu-dropdown,
.geos-menu:focus-within .geos-menu-dropdown {
    display: block;
}

/* Trennlinie im Menü */
.geos-menu-divider {
    border-top: 2px dashed #000000;
    margin: 4px 0;
}

.geos-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    padding: 4px;
    background: white;
    border: 2px solid #222;
    box-shadow: 3px 3px 0 #555;
    z-index: 100001;
}

.geos-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: #111;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.geos-menu-dropdown button:hover {
    background: #222;
    color: #fff;
}

.geos-menu.menu-closed .geos-menu-dropdown {
    display: none !important;
}

/* Menübar activities */
.geos-activity-indicator {
    width: 16px;
    height: 16px;
    margin: 7px 7px 0 7px;
    background: #000;
    border: 1px solid #000;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.geos-activity-square {
    width: 8px;
    height: 8px;
    background: #fff;
}

.geos-activity-indicator.active .geos-activity-square {
    animation: geos-flash 5s linear forwards;
}

/* Roter Fehlerblitz */
.geos-activity-indicator.error .geos-activity-square {
    animation: geos-error-flash 5s linear forwards;
}

@keyframes geos-flash {

    0%,
    15% {
        background-color: #000;
    }

    55% {
        background-color: #888;
    }

    100% {
        background-color: #fff;
    }
}

@keyframes geos-error-flash {

    0%,
    15% {
        background-color: #f00;
    }

    55% {
        background-color: #888;
    }

    100% {
        background-color: #fff;
    }
}

/* Mobile */
/* =========================================
   GEOS Responsive Layout: Mobile
   ========================================= */

@media screen and (max-width: 700px) {

    html {
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    body {
        display: block;
        width: 100%;
        height: 100%;
        height: 100dvh;
        margin: 0;
        padding-top: 30px;
        box-sizing: border-box;

        overflow-x: hidden;
        overflow-y: auto !important;

        -webkit-overflow-scrolling: touch;
    }

    .geos-menubar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10000;
        width: 100%;
        box-sizing: border-box;
    }

    .geos-window {
        position: relative !important;

        inset: auto !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;

        display: block !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;

        margin: 0 0 10px 0;
        box-sizing: border-box;

        box-shadow: 2px 2px 0 #000;
    }

    .geos-window-content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;

        overflow-wrap: anywhere;
    }

    .geos-window-content img,
    .geos-window-content video,
    .geos-window-content iframe,
    .geos-window-content canvas {
        max-width: 100%;
        height: auto;
        box-sizing: border-box;
    }

    .geos-window-ghost {
        display: none !important;
    }
}
