/*
 * Compact status monitor for a small Convoso Embedded Website iframe.
 *
 * Graphite / navy, dark only. No external resources: no CDN, no web fonts, no
 * remote images. The animated icons are local SVGs in /icons.
 *
 * Colour is always a secondary signal: the state text is what carries meaning.
 */

:root {
  color-scheme: dark;

  --bg: #0b1017;
  --surface: #111821;
  --surface-soft: #17212d;
  --border: #263445;

  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Replaced per state from app.js. */
  --accent: #64748b;

  --radius: 15px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

/* The widget stays centred and compact even when Convoso hands us 1900px. */
.monitor-shell {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  padding: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.28);
  padding: 13px 14px;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------- panel */

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

/* Soft accent halo behind the icon. The SVG keeps its own colour because an
   <img> cannot inherit our custom properties. */
.status-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  flex: none;
}

.status-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.12;
}

.status-icon img {
  position: relative;
  width: 60px;
  height: 60px;
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 14px 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

/* A dot reads better than a border on a rounded pill, and it is decoration
   only: the label text always carries the meaning. */
.status-pill::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.timer {
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  min-width: 0;
}

.timer__label {
  margin: 0 0 3px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer__value {
  margin: 0;
  font-size: 27px;
  font-weight: 600;
  /* Tabular figures stop the digits shifting every second. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.hint--sync {
  margin-top: -4px;
}

/* Discreet text control, never a primary action. */
.link {
  margin: 2px 0 0;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}

.link:hover {
  color: var(--text);
}

/* ---------------------------------------------------------------- selector */

.selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selector__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.selector__search {
  width: 100%;
  height: 41px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.selector__search::placeholder {
  color: var(--text-muted);
}

.selector__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* About five rows, then it scrolls. */
  max-height: 214px;
  overflow-y: auto;
}

.selector__list:empty {
  display: none;
}

.agent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.agent::after {
  content: "›";
  flex: none;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
}

.agent:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: #1c2836;
}

.agent:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ------------------------------------------------------------------ shared */

.selector__search:focus-visible,
.agent:focus-visible,
.link:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* --------------------------------------------------------------- narrow */

@media (max-width: 310px) {
  .monitor-shell { padding: 10px; }
  .card { padding: 13px 11px; }
  .status-icon { width: 64px; height: 64px; }
  .status-icon img { width: 50px; height: 50px; }
  .status-pill { font-size: 14px; padding: 4px 11px 4px 9px; gap: 6px; }
  .status-pill::before { width: 7px; height: 7px; }
  .timer { padding: 8px 6px; }
  .timer__value { font-size: 22px; }
  .timer__label { font-size: 10px; letter-spacing: 0.05em; }
  .timers { gap: 6px; }
}

/* Two columns are kept as long as an eight-character timer still fits inside a
   card. Below this the digits start clipping, so one full-width column is both
   necessary and more readable. */
@media (max-width: 288px) {
  .timers { grid-template-columns: 1fr; }
  .timer { padding: 7px 10px; }
  .timer__value { font-size: 24px; }
  .timer__label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
