/*
 * spot_manager/device_manager/devices.css - the Device Manager. Built on the shared kit in /css/adspot-ui.css.
 * Class names start with dm- and never contain ad / ads / banner / promo / sponsor (ad blockers hide those).
 */

.dm [hidden] { display: none !important; }
.dm svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dm .ui-container { padding-bottom: 72px; }

.dm-filters { margin-bottom: 12px; }
.dm-filters .ui-tabs { margin: 0; }
.dm-search { flex: 1 1 280px; max-width: 460px; }

.dm-notes:empty { display: none; }
.dm-notes { display: grid; gap: 8px; margin: 0 0 12px; }
.dm-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dm-note button { margin-left: auto; }

/* list on the left, the opened device on the right (below the list on narrow screens) */
.dm-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.dm-layout.has-detail { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
.dm-list { min-width: 0; }

.dm-table th, .dm-table td { white-space: nowrap; }
.dm-table td.dm-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ui-ink); }
.dm-table tbody tr { cursor: pointer; }
.dm-table tbody tr.is-selected { background: var(--ui-sage-soft); }
.dm-table tbody tr:focus-visible { outline: 3px solid var(--ui-sage-ring); outline-offset: -3px; }
.dm-muted { color: var(--ui-muted); }
.dm-skeleton .ui-skel-row .ui-skel-line { width: 100%; margin: 6px 0; }
#dm_state .ui-empty { padding: 48px 24px; }

/* the opened device */
.dm-detail { position: sticky; top: calc(var(--ui-toolbar-h) + 12px); max-height: calc(100vh - var(--ui-toolbar-h) - 28px); overflow: auto; }
.dm-detail__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 2px solid var(--ui-sage-soft); }
.dm-detail__head .ui-card__title { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
.dm-sync { margin: 0 0 16px; }
.dm-snap { display: grid; gap: 10px; margin-bottom: 18px; }
.dm-snap__frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--ui-radius-sm); background: #eceee9; overflow: hidden; display: grid; place-items: center; }
.dm-snap__frame img { width: 100%; height: 100%; object-fit: contain; background: #111; cursor: zoom-in; }
.dm-snap__empty { margin: 0; padding: 8px 12px; color: var(--ui-muted); font-size: 14px; text-align: center; }
.dm-save { min-height: 42px; border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0; }
.dm-facts { grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.dm-h3 { margin: 20px 0 10px; font-size: 14px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ui-muted); }
.dm-map { display: grid; place-items: center; height: 240px; border-radius: var(--ui-radius-sm); background: #eceee9; overflow: hidden; }

.dm-lightbox { display: grid; place-items: center; background: rgba(20, 24, 20, .82); cursor: zoom-out; }
.dm-lightbox[hidden] { display: none; }
.dm-lightbox img { max-width: 100%; max-height: calc(100vh - 48px); border-radius: 8px; background: #111; }

/* with a device open the list is narrow: keep the columns that identify a device, the rest is in the panel */
.dm-layout.has-detail .dm-col-x { display: none; }

@media (max-width: 1100px) {
    .dm-layout.has-detail .dm-col-x { display: table-cell; }
    .dm-layout.has-detail { grid-template-columns: minmax(0, 1fr); }
    .dm-detail { position: static; max-height: none; }
    .dm-snap { max-width: 520px; }
}
@media (max-width: 760px) {
    .dm-search { max-width: none; }
}

/* header, headings, buttons */
.dm-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.dm-topbar .ui-crumbs { margin: 0; }
.dm-backbtn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dm .ui-pagehead__title, .dm .ui-card__title, .dm .ui-empty__title { font-weight: 700; }
.dm .ui-btn:not(.ui-btn--ghost):not(.ui-btn--secondary):not(.ui-btn--quiet):not(.ui-btn--danger):not(.ui-btn--danger-ghost) { background: var(--ui-sage-dark); color: #fff; }
.dm .ui-btn:not(.ui-btn--ghost):not(.ui-btn--secondary):not(.ui-btn--quiet):not(.ui-btn--danger):not(.ui-btn--danger-ghost):hover { background: #475f44; }
.dm .ui-btn:disabled { opacity: 1; background: #e4e7e2 !important; color: #5d665c !important; cursor: not-allowed; }

/* nothing to filter until a server is linked: show just the explanation */
.dm-noservers .dm-filters, .dm-noservers .ui-table thead { display: none; }
.dm-noservers #dm_refresh { display: none; }
