/* Multiple monitor test (views/partials/components/MonitorTest.ejs). The component is a
   size container: text scales with the tile, and the layout drawing shrinks in short tiles. */
.monitor-test-component {
    --mon-accent: #2f80c9;
    --mon-text: #1a202c;
    --mon-muted: #4a5568;
    container: monitors / size;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    background: var(--container-bg, #f8f9fa);
    border: 1px solid var(--container-border, #dee2e6);
    border-radius: 8px;
    overflow: hidden;
}

.mon-body {
    height: 100%;
    box-sizing: border-box;
    padding: clamp(8px, 3cqw, 18px);
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 2cqh, 12px);
    font-size: clamp(12px, 4cqw, 16px);
    line-height: 1.35;
    color: var(--mon-text);
}

.mon-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.2;
    color: #2c3e50;
    text-align: center;
    padding: 0 26px; /* room for the help badge on the home page */
}

.mon-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mon-summary strong {
    font-size: clamp(18px, 7cqw, 32px);
    font-weight: 800;
    color: var(--mon-accent);
}

.mon-summary span {
    color: var(--mon-muted);
    font-size: 0.85em;
}

/* Layout drawing: the inner box is sized by the script to keep the desktop's shape. */
.mon-map {
    flex: 0 0 clamp(50px, 26cqh, 200px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mon-map-inner {
    position: relative;
}

.mon-screen {
    position: absolute;
    box-sizing: border-box;
    margin: 0;
    border: 2px solid #8a97a6;
    border-radius: 4px;
    background: #ffffff;
    color: var(--mon-muted);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 5cqw, 22px);
    transform: scale(0.94); /* a small gap between screens that touch */
}

.mon-screen-current {
    border-color: var(--mon-accent);
    background: #e3effa;
    color: var(--mon-accent);
}

.mon-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13em), 1fr));
    gap: 0.5em;
    align-content: start;
}

.mon-card {
    display: flex;
    flex-direction: column;
    padding: 0.45em 0.65em;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-width: 0;
}

.mon-card-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mon-card-tags,
.mon-card-detail {
    color: var(--mon-muted);
    font-size: 0.82em;
}

.mon-card-res {
    font-size: 1.15em;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mon-note {
    margin: 0;
    color: var(--mon-muted);
    font-size: 0.85em;
    text-align: center;
}

.mon-actions {
    display: flex;
    justify-content: center;
}

.mon-actions:not(:has(:not([hidden]))) {
    display: none;
}

.mon-btn {
    min-height: 36px;
    padding: 0.4em 1.2em;
    border: none;
    border-radius: 6px;
    background: var(--mon-accent);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mon-btn[hidden] {
    display: none;
}

/* When the cards don't fit, the script trims them a level at a time (data-fit):
   position, then scaling and colour; from level 3 each monitor becomes one compact row
   (number and name, resolution on the right); then a smaller drawing, and in the
   tightest spots no drawing. Name and resolution always stay. */
.monitor-test-component[data-fit="1"] .mon-card-position,
.monitor-test-component[data-fit="2"] .mon-card-position,
.monitor-test-component[data-fit="2"] .mon-card-detail {
    display: none;
}

.monitor-test-component:is([data-fit="3"], [data-fit="4"], [data-fit="5"]) .mon-list {
    grid-template-columns: 1fr;
    gap: 0.3em;
}

.monitor-test-component:is([data-fit="3"], [data-fit="4"], [data-fit="5"]) .mon-card {
    flex-direction: row;
    align-items: baseline;
    gap: 0.6em;
    padding: 0.3em 0.6em;
}

.monitor-test-component:is([data-fit="3"], [data-fit="4"], [data-fit="5"]) .mon-card-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monitor-test-component:is([data-fit="3"], [data-fit="4"], [data-fit="5"]) :is(.mon-card-tags, .mon-card-detail) {
    display: none;
}

.monitor-test-component:is([data-fit="3"], [data-fit="4"], [data-fit="5"]) .mon-card-res {
    font-size: 1em;
    white-space: nowrap;
}

.monitor-test-component[data-fit="4"] .mon-map {
    flex-basis: clamp(40px, 15cqh, 120px);
}

.monitor-test-component[data-fit="5"] .mon-map {
    display: none;
}

@container monitors (max-height: 340px) {
    .mon-summary span {
        display: none;
    }
}
