﻿.module-config-panel {
    display: flex;
    color: white;
    padding: 1rem;
    gap: 1rem;
    margin-top: 0.5rem;
    height: 93%;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
}

.module-config-panel.no-sidebar .module-list {
    display: none;
}

.module-config-panel.no-sidebar .module-details-scroll {
    padding-left: 0;
}

.module-list {
    width: 20%;
    min-width: 15rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0 20px 0 10px;
}

.module-search {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 0.3rem;
    font-size: 0.75rem;
}

.module-list-scroll {
    flex: 1;
    overflow-y: auto;
}

/* search bars above scrollable content */

.search-wrapper {
    padding: 0.25rem 0;
    margin-bottom: 0.5rem;
}

.search-wrapper .module-search {
    margin: 0;
}

.module-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.25rem;
}

.module-list-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    color: #00E5E2;
    font-weight: 600;
}

.module-config-tabs {
    display: flex;
    gap: 0.5rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.module-config-tab {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    cursor: pointer;
    min-width: 8rem;
    text-align: center;
    font-size: 0.9rem;
}

.module-config-tab.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.module-section {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.module-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.module-details-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-left: 0.5rem;
    gap: 0.5rem;
}

.module-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding-right: 1rem;
    position: relative;
}

.module-title-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-title-row.has-image .module-title-main {
    max-width: calc(50% - 4vh);
}

.module-list-item {
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-status {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: #666;
}

.module-list-name {
    font-size: 0.75rem;
}

.module-status.online {
    background: #0f0;
}

.module-status.offline {
    background: #f00;
}

.module-status.unknown {
    background: #666;
}

.view-toggle {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.module-title-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 0;
}

.module-voltage {
    font-size: 1rem;
}

.module-title {
/*    font-weight: bold;*/
    font-size: 1.25rem;
}

.module-title-input {
    font-size: 1.25rem;
    background: transparent;
    color: inherit;
    border: none;
    width: 100%;
}

.module-title-input:focus {
    outline: 1px solid rgba(255, 255, 255, 0.5);
}

.name-toggle {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.name-toggle.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.indicator-toggle {
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.indicator-toggle.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.indicator-toggle span {
    font-size: 0.95rem;
}

.module-table {
    width: 100%;
    border-collapse: collapse;
}

.module-table th,
.module-table td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
}

/* Fixed width columns to avoid resize when state updates */

.module-table .output-col {
    width: 6ch;
    white-space: nowrap;
}

.module-table .state-col {
    width: 11ch;
    white-space: nowrap;
}

.module-table .motor-state-col {
    width: 10ch;
    white-space: nowrap;
}

.module-table .forced-col {
    width: 7ch;
    white-space: nowrap;
}

.module-table .forced-indicator {
    min-width: 0;
}

.module-table .actions-col,
.module-table .output-actions {
    width: 14ch;
    white-space: nowrap;
}

/* Extra space for cover actions on motor modules */

.module-table.motor-module .actions-col,
.module-table.motor-module .output-actions {
    width: 20ch;
}

.module-table th {
    font-weight: 300;
    color: #00E5E2;
    background-color: #111111;
}

.module-table input[type="text"] {
    width: 100%;
    background: transparent;
    color: inherit;
    border: none;
    padding: 0.2rem 0.5rem;
}

.module-table input[type="text"]:focus {
    outline: 1px solid rgba(255, 255, 255, 0.5);
}

.reset-fuses-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.reset-fuses-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.output-actions {
    display: flex;
    justify-content: center;
    gap: 0.5vh;
}

.module-action-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.module-action-button:hover {
    background-color: rgba(0, 229, 226, 0.25);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.module-action-button .checkmark-icon,
.module-action-button .cross-icon {
    font-size: 2vh;
    line-height: 1;
}

.module-action-button.active {
    background: rgba(0, 229, 226, 0.3);
    border-color: #00E5E2;
    color: #E4FFFF;
}

.fuse-state.ok {
    color: #00E5E2;
    font-weight: 300;
}

.fuse-state.bad {
    color: #E32940;
    font-weight: 300;
}

/* Specific styling for sliders in the module configuration panel */

.module-config-panel td[data-label="Brightness"] .slider-range {
    width: 100%;
}

/*.module-config-panel .slider-range {
    width: 100% !important;
    height: 1.5vh !important;
}*/

/*.module-config-panel .slider-range::-webkit-slider-thumb {
   width: 3vh !important;
   height: 3vh !important;
   margin-top: -1vh !important;
}*/

.module-image {
    height: 5vh;
}

.module-image-wrapper {
    margin: 1vh 0;
}

.module-image-container {
    position: relative;
    width: 100%;
    container-type: inline-size;
    font-size: 1.03cqw;
}

.module-view-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.module-image-wrapper .blown-indicator {
    position: absolute;
    top: 1%;
    left: 1%;
}

.module-image-wrapper .forced-indicator {
    position: absolute;
    top: 1%;
    right: 1%;
}

.module-image-wrapper .force-input-zoom-trigger {
    position: absolute;
    border: 2px solid #ff7a00;
    background: rgba(10, 12, 16, 0.8);
    box-shadow: 0 0 0.6em rgba(255, 122, 0, 0.5);
    border-radius: 0.4em;
    cursor: pointer;
    z-index: 3;
    padding: 0.2em 0.35em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4em;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.75em;
    letter-spacing: 0.02em;
    color: #ffe0cc;
}

.module-image-wrapper .force-input-zoom-trigger-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    white-space: nowrap;
}

.module-image-wrapper .force-input-zoom-trigger-count {
    min-width: 1.6em;
    height: 1.6em;
    border-radius: 999px;
    background: rgba(255, 122, 0, 0.25);
    border: 1px solid rgba(255, 122, 0, 0.6);
    color: #ffb07a;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.module-image-wrapper .force-input-zoom-trigger-hint {
    text-transform: none;
    font-weight: 500;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-basis: 100%;
    text-align: center;
    width: 100%;
    margin-top: 0.15em;
    white-space: nowrap;
}

.module-image-wrapper .force-input-zoom-trigger-hint::after {
    content: "\1F50E";
    color: #fff;
    font-size: 1.1em;
    margin-left: 0.35em;
}

.module-image-wrapper .force-input-zoom-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 10, 12, 0.75);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 4;
}

.module-image-wrapper .force-input-zoom-panel {
    background: rgba(16, 20, 24, 0.95);
    border: 1px solid rgba(0, 229, 226, 0.6);
    border-radius: 0.6em;
    padding: 0.8em;
    width: min(98cqw, 980px);
    max-width: 96%;
    box-shadow: 0 0.6em 1.2em rgba(0, 0, 0, 0.4);
}

.module-image-wrapper .force-input-zoom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    color: #e6ffff;
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 0.4em;
}

.module-image-wrapper .force-input-zoom-close {
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #fff;
    border-radius: 0.4em;
    width: 2em;
    height: 2em;
    cursor: pointer;
}

.module-image-wrapper .force-input-zoom-frame {
    width: 100%;
    aspect-ratio: 2.2 / 1;
    min-height: min(32cqw, 320px);
    background: #0a0d10;
    border-radius: 0.5em;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.module-image-wrapper .force-input-zoom-legend {
    margin-top: 0.6em;
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    font-size: 0.85em;
}

.module-image-wrapper .force-input-zoom-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: top right;
    container-type: inline-size;
    font-size: 1.03cqw;
}

.module-image-wrapper .force-input-zoom-stage .forced-output-indicator {
    font-size: 0.4em;
    padding: 0 0.25em;
}


.module-image-wrapper .fuse-indicator,
.module-image-wrapper .forced-output-indicator,
.module-image-wrapper .output-state-indicator,
.module-image-wrapper .input-state-indicator {
    position: absolute;
    font-size: 1em;
    padding: 0 0.4em;
    line-height: 1.6em;
    min-height: 1.6em;
    border-radius: 0.25em;
    font-weight: 600;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.module-image-wrapper .fuse-indicator.ok {
    background: rgba(0, 229, 226, 0.6);
    color: #E4FFFF;
    font-size: 1rem;
}

.module-image-wrapper .fuse-indicator.bad {
    background: rgba(227, 41, 64, 0.6);
    color: #FFEAED;
    font-size: 1rem;
}

.module-image-wrapper .forced-output-indicator {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 2em;
}

.module-image-wrapper .forced-output-indicator.forced {
    background: rgba(255, 217, 0, 0.6);
    color: #FFD900;
}

.module-image-wrapper .forced-output-indicator.manageable {
    background: rgba(0, 229, 226, 0.6);
    color: #b4fffe;
}

.module-image-wrapper .forced-output-indicator::before {
    content: "\2195"; /* up-down arrow */
    font-size: 1.6em;
    line-height: 2;
    font-weight: 900;
    color: white;
}

.module-image-wrapper .output-state-indicator,
.module-image-wrapper .input-state-indicator {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1rem;
}

.module-image-wrapper .fuse-indicator.vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    padding: 0.15em 0;
    height: 2.5em;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.indicator-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    font-size: 0.9em;
    margin-top: 0.5em;
}

.indicator-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.3em;
}

.indicator-legend .legend-arrow {
    width: 1em;
    height: 1em;
    border-radius: 0.2em;
    position: relative;
    display: inline-block;
}

.indicator-legend .legend-arrow::before {
    content: "\2195";
    font-size: 0.7em;
    color: white;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.indicator-legend .legend-arrow.forced {
    background: rgba(255, 235, 59, 0.3);
    border: 1px solid #ffeb3b;
    color: #ffeb3b;
}

.indicator-legend .legend-arrow.manageable {
    background: rgba(0, 229, 226, 0.3);
    border: 1px solid #00E5E2;
    color: #00E5E2;
}





/* === MEDIA === */

/* Mobile  */

@media (max-width: 699px) {
    .module-table {
        border: 0;
    }

    .module-table thead {
        display: none;
    }

    .module-table,
    .module-table tbody,
    .module-table tr {
        display: block;
        width: 100%;
    }

    .module-table tr {
        width: 100%;
        margin-bottom: 0.25rem;
        padding: 0.5rem;
        background: rgba(0,0,0,0.4);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .module-table td {
        padding: 0;
        border: none !important;
        text-align: left;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .module-table td::before {
        content: attr(data-label);
        min-width: 4rem;
        color: #00E5E2;
        flex-shrink: 0;
    }

    .module-title-row {
        flex-direction: column;
        align-items: start;
        gap: 0.5rem;
    }

    .module-config-tabs {
        position: unset;
        transform: unset;
    }

    .output-actions {
        justify-content: start;
        margin-bottom: 0.5rem;
    }

    .module-config-panel {
        height: auto;
        overflow: visible;
        padding: 0;
        background: none;
        border: none;
        flex-direction: column;
        gap: 0.5rem;
    }

    .module-list {
        width: 100%;
        max-height: 10rem;
        padding: 0.25rem 0.5rem;
        background-color: rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0.5rem;
    }

    .module-details {
        padding: 0.25rem 0.5rem;
        background-color: rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0.5rem;
    }

    .module-title-row.has-image .module-title-main {
        max-width: unset;
        width: 100%;
    }

    .module-details-scroll {
        padding: 0;
    }

    .module-title {
        font-size: 1rem;
    }

    .module-title-input {
        font-size: 1rem;
    }

    .module-title-actions {
        margin: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .module-image-wrapper .fuse-indicator.bad,
    .module-image-wrapper .output-state-indicator,
    .module-image-wrapper .input-state-indicator,
    .module-image-wrapper .fuse-indicator.ok {
        font-size: 0.5rem;
    }
}

/* WVGA / WVGA-Narrow (720x480, 800x480) */

@media (min-width: 700px) and (max-width: 880px) {
    .module-config-panel {
        gap: 0rem;
    }

    .module-list {
        min-width: unset;
        width: 30%;
        padding: 0 0.1rem;
    }

    .module-title-row {
        flex-direction: column;
        align-items: start;
    }

    .module-title-row .module-title-main, .module-title-row.has-image .module-title-main {
        max-width: 100%;
        width: 100%;
    }

    .module-title-input, .module-title {
        font-size: 1rem;
        font-weight: 300;
    }

    .module-title-actions {
        margin: 0;
        justify-content: start;
    }

    .module-table {
        border: 0;
    }

    .module-table thead {
        display: none;
    }

    .module-table,
    .module-table tbody,
    .module-table tr {
        display: block;
        width: 100%;
    }

    .module-table tr {
        width: 95%;
        margin-bottom: 0.5rem;
        padding: 1rem;
        background: rgba(0,0,0,0.4);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .module-table td {
        padding: 0;
        border: none;
        text-align: left;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .module-table td::before {
        content: attr(data-label);
        min-width: 5rem;
        color: #00E5E2;
        flex-shrink: 0;
    }

    .module-table .output-actions {
        justify-content: start;
        gap: 0.5rem;
    }

    .module-table input[type="text"] {
        width: 100%;
        text-align: left;
        font-size: 0.85rem;
    }

    .module-config-tabs {
        margin-left: 2rem;
        gap: 0.5rem;
    }

    .module-config-tab {
        min-width: unset;
    }

    .cross-icon {
        line-height: unset;
    }

    .module-action-button .checkmark-icon, .module-action-button .cross-icon {
        font-size: 0.95rem;
        font-weight: 300;
    }

    .module-action-button {
        padding: 0.25rem 0.5rem;
    }

    .module-image-wrapper .fuse-indicator.bad,
    .module-image-wrapper .output-state-indicator,
    .module-image-wrapper .input-state-indicator,
    .module-image-wrapper .fuse-indicator.ok {
        font-size: 0.5rem;
    }

    .module-table .forced-col {
        width: auto;
    }

    .forced-indicator {
        padding: 0.25rem 0.5rem;
    }
}

/* WSVGA / XGA (1024x600, 1024x768) */

@media (min-width: 881px) and (max-width: 1150px) {
    .module-list {
        padding: 0 0.2rem 0 0.1rem;
    }

    .module-details-scroll p {
        padding: 0;
        font-size: 0.95rem;
    }

    .module-config-tab {
        min-width: 6rem;
        padding: 0.25rem;
        font-size: 0.95rem;
    }

    .module-title-input {
        max-width: 80%;
        font-size: 0.95rem;
        text-overflow: ellipsis;
    }

    .module-voltage {
        font-size: 0.85rem;
    }

    .name-toggle, .view-toggle, .indicator-toggle, .reset-fuses-button, .indicator-toggle span, .name-toggle span {
        font-size: 0.95rem;
    }

    .module-table {
        font-size: 0.85rem;
    }

    .module-image-wrapper .fuse-indicator.bad,
    .module-image-wrapper .output-state-indicator,
    .module-image-wrapper .input-state-indicator,
    .module-image-wrapper .fuse-indicator.ok {
        font-size: 0.65rem;
    }
}

/* WXGA / HD720 / SXGA (1280x720/800/1024) */

@media (min-width: 1151px) and (max-width: 1600px) {

    .module-list {
        padding: 0 0.2rem 0 0.1rem;
    }

    .module-details-scroll p {
        padding: 0;
        font-size: 0.85rem;
    }

    .module-config-tab {
        min-width: 6rem;
        padding: 0.25rem;
        font-size: 0.85rem;
    }

    .module-title-input {
        font-size: 1rem;
    }

    .module-voltage {
        font-size: 0.85rem;
    }

    .name-toggle, .view-toggle, .indicator-toggle, .reset-fuses-button {
        font-size: 0.85rem;
    }

    .module-table {
        font-size: 0.85rem;
    }

    .module-image-wrapper .fuse-indicator.bad,
    .module-image-wrapper .output-state-indicator,
    .module-image-wrapper .input-state-indicator,
    .module-image-wrapper .fuse-indicator.ok {
        font-size: 0.65rem;
    }
}

/* HD / WUXGA (1920x1080, 1920x1200) */

@media (min-width: 1601px) and (max-width: 2879px) {
    /* standard styles */
}

/* 4K (3840x2160) */

@media (min-width: 2880px) {

    .module-config-panel p {
        margin: 0;
        font-size: 2rem;
    }

    .module-config-tab {
        padding: 0.75rem 1rem;
        min-width: 15rem;
        font-size: 2rem;
    }

    .module-search {
        font-size: 2rem;
    }

    .module-list-item {
        gap: 1rem;
    }

    .module-list-name {
        font-size: 1.75rem;
    }

    .module-title-row {
        gap: 1rem;
        padding-right: 2rem;
    } 

    .module-title-main {
        gap: 1rem;
    }

    .module-status {
        width: 1rem;
        height: 1rem;
    }  

    .module-title-input {
        font-size: 2.5rem;
    }

    .module-voltage {
        font-size: 2rem;
    }

    .name-toggle {
        gap: 2rem;
        padding: 1rem;
        font-size: 2rem;
    }

    .view-toggle, .reset-fuses-button, .indicator-toggle {
        padding: 1rem;
        font-size: 2rem;
    }

    .module-title-actions {
        gap: 2rem;
    }

    .module-table th, .module-table td {
        font-size: 2rem;
    }

    .module-action-button {
        padding: 0.5rem 1rem;
    }

    .module-table input[type="text"] {
        padding: 0.5rem 1rem;
    }

    .fuse-indicator, .input-state-indicator, .output-state-indicator {
        font-size: 2rem !important;
    }

    .indicator-legend span {
        font-size: 2rem;
    }

    .module-key {
        font-size: 2rem;
    }
}
