* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
}

body {
    font-family:
            Arial,
            Helvetica,
            sans-serif;

    background: #eeeeee;

    color: #111;
}


/* ============================================================
   APPLICATION
   ============================================================ */

.panel-app {
    display: flex;
    width: 100%;
    gap: 8px;
    padding: 4px;
}



/* ============================================================
   SIDE PANELS
   ============================================================ */

.side-title {
    font-size: 11px;

    font-weight: bold;

    padding: 3px;

    border-bottom: 1px solid #999;

    white-space: nowrap;
    width: fit-content;
}


/* ============================================================
   PANELS
   ============================================================ */

.panel-grid {
    display: flex;
    flex-direction: column;
}

.panel-button {
    min-height: 30px;

    padding: 2px;

    background: #eeeeee;

    border: 1px solid #aaa;

    color: #555;

    font-size: 10px;

    cursor: pointer;
}

.panel-button:hover {
    background: #ddd;
}

.panel-button.selected {
    background: #ccc;

    border: 2px solid #000;
}


/* ============================================================
   GLOBALS
   ============================================================ */

.global-grid {
    display: grid;

    grid-template-columns:
        1fr
        1fr;
}

.global-button {
    min-height: 30px;

    padding: 2px;

    background: #eeeeee;

    border: 1px solid #aaa;

    color: #555;

    font-size: 10px;

    cursor: pointer;
}

.global-button:hover {
    background: #ddd;
}

.global-button.selected {
    background: #ccc;

    border: 2px solid #000;
}


/* ============================================================
   MAIN PANEL
   ============================================================ */

.panel-app > .side-panel {
    flex: 0 0 auto;
}

.panel-app > .main-panel {
    flex: 1 1 auto;
    min-width: 0;
}


/* ============================================================
   HEADER
   ============================================================ */

.panel-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    min-height: 30px;
}

#connectionStatus {
    margin-left: 15px;

    font-size: 12px;
}

.connected {
    color: green;
}

.disconnected {
    color: #777;
}

.connecting {
    color: orange;
}

.user-controls {
    display: flex;

    gap: 8px;

    align-items: center;
}


/* ============================================================
   DISPLAY SECTION
   ============================================================ */

.display-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}



/* ============================================================
   TERMINAL
   ============================================================ */

.display-wrapper {
    width: 342px;

    height: 152px;

    padding: 0;

    background: #000;
}

#terminal {
    width: 100%;

    height: 100%;
}


/* ============================================================
   KEYPAD
   ============================================================ */

.keypad {
    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    grid-template-rows:
        repeat(4, 1fr);

    gap: 5px;

    padding: 5px;

    border: 2px solid #0000ff;

    border-radius: 15px;
}

.keypad button {
    min-width: 0;

    aspect-ratio: 1;

    min-height: 30px;

    padding: 2px;

    background: #eeeeee;

    border: 1px solid #aaa;

    font-weight: bold;

    cursor: pointer;
}

.keypad button:hover {
    background: #ddd;
}

.keypad button:active {
    background: #bbb;
}


/* ============================================================
   CONTROLS
   ============================================================ */

.control-area {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;

    gap: 8px;

    align-items: start;
}


.control-group {
    border: 3px solid #0000ff;

    border-radius: 18px;

    padding: 10px;

    background: #eeeeee;

    min-width: 0;
}

.group-title {

    margin-left: 8px;

    margin-bottom: 8px;

    width: fit-content;

    padding: 2px 14px;

    background: #eeeeee;

    color: #0000aa;

    font-weight: bold;

    font-size: 14px;
}


/* ============================================================
   LED
   ============================================================ */

.led-row {
    display: flex;

    align-items: center;

    gap: 8px;

    min-height: 28px;

    font-size: 13px;

    font-weight: bold;
}

.led {
    width: 11px;

    height: 11px;

    flex-shrink: 0;

    border-radius: 50%;

    border: 1px solid #222;

    background: #eeeeee;

    box-shadow:
            inset 1px 1px 2px #777;
}

.led.on {
    background: #ff2222;

    box-shadow:
            0 0 7px #ff0000,
            inset 1px 1px 2px #fff;
}

.led.blinking {
    background: #ff2222;

    animation:
            led-blink 1s infinite;
}

@keyframes led-blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0.2;
    }
}


/* ============================================================
   CONTROL ROW
   ============================================================ */

.control-row {
    display: flex;

    align-items: center;

    gap: 5px;

    min-height: 34px;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.control-button {
    flex: 1;

    min-height: 30px;

    padding: 3px;

    display: flex;

    align-items: center;

    gap: 5px;

    text-align: left;

    background: #eeeeee;

    border: 1px solid #999;

    cursor: pointer;

    font-size: 11px;

    font-weight: bold;
}

.control-button:hover {
    background: #ddd;
}

.control-button:active {
    background: #bbb;
}

.button-symbol {
    min-width: 27px;

    padding: 2px;

    border: 1px solid #777;

    background: #ddd;

    text-align: center;

    font-family: monospace;

    font-size: 10px;
}

.fake-checkbox {
    width: 20px;

    height: 20px;

    flex-shrink: 0;

    border: 1px solid #888;

    background: #eeeeee;
}


/* ============================================================
   EVENT LOG
   ============================================================ */

.event-log {
    border: 1px solid #999;

    min-height: 70px;

    background: #111;

    color: #ddd;

    font-family: monospace;

    overflow: scroll;
    max-height: 45vh;
    flex-grow: 1;
}

.event-log-title {
    padding: 4px;

    background: #ddd;

    color: #111;

    font-family: Arial;

    font-weight: bold;
}

#events {
    height: 55px;

    overflow-y: auto;

    padding: 4px;

    font-size: 11px;
}

.delay-row {
    gap: 8px;
}

.delay-led {
    display: flex;

    align-items: center;

    gap: 4px;

    font-size: 11px;

    font-weight: bold;

    white-space: nowrap;
}

.hidden {
    display: none;
}

#deviceSelector > *,
#deviceSelector > * > *,
#deviceSelector > * > * > *,
#deviceSelector > * > * > * > *,
#deviceSelector > * > * > * > * > *{
    border: black solid 1px;
    border-collapse: collapse;
}

.delay-led .led {
    width: 11px;
    height: 11px;
}

.events-table-container {
    width: 100%;
    overflow-x: auto;
}

#eventsTable {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

#eventsTable th,
#eventsTable td {
    padding: 6px 10px;
    white-space: nowrap;
}

#text-events {
    min-height: 100px;
    overflow-y: scroll;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 800px) {
    .panel-app {
        flex-direction: column;
        width: 100%;
    }


    .panels {
        order: 1;
    }

    .main-panel {
        width: 100%;
        flex: 0 0 auto;
        min-width: 0;
    }

    #addrSelectors {
        display: flex;
        flex-direction: row;
    }

    .globals {
        order: 3;
    }

    .paneladdrs {
        order: 4;
    }



    .display-wrapper {
        padding: 0;

        background: #000;
        overflow: hidden;
    }


    .panel-header {
        flex-wrap: wrap;

        gap: 8px;
    }


    .user-controls {
        width: 100%;

        justify-content: space-between;
    }

}
div[style*="width: 50000px"] {
    left: -50000px !important;
}