/* ============================================================================
 * MTDZ Viewer — page-specific widgets that aren't shared with the rest of
 * the config-tools stylesheet. The page itself uses .card / .card-title /
 * .drop-zone / .btn from style.css for chrome; this file carries pieces
 * unique to the MTDZ pages: the tool-catalog grid, info/error/progress
 * banners, form inputs, day tabs/checkboxes, system selector, and the graph
 * loading skeleton.
 * ============================================================================ */

/* ── File-status action links ───────────────────────────────────────── */

.mode-card-actions {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.85rem;
}

.back-link   { color: var(--red); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.delete-link { color: var(--red); text-decoration: none; }
.delete-link:hover { text-decoration: underline; }

/* ── Banners ────────────────────────────────────────────────────────── */

.info-banner {
  background: #f0f7ff;
  border: 1px solid #b8d4f0;
  border-left: 4px solid #4a90d9;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #2c5282;
  margin-bottom: 16px;
}

.privacy-notice { font-size: 0.82rem; }

/* ── Upload progress ────────────────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
  display: none;
}

.progress-bar.visible { display: block; }

.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  width: 0%;
  animation: mtdz-indeterminate 1.4s infinite;
}

@keyframes mtdz-indeterminate {
  0%   { width: 0%;  margin-left: 0; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 0%;  margin-left: 100%; }
}

/* ── File-status meta row ───────────────────────────────────────────── */

.mtdz-file-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Forms (job-info, equipment table, sensor controls) ─────────────── */

label { font-size: 0.875rem; font-weight: 500; display: block; margin-bottom: 4px; }
label .optional { font-weight: 400; color: var(--muted); }

input[type=text], input[type=email], input[type=date], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  font-family: inherit;
}

input[type=text]:focus, input[type=email]:focus, input[type=date]:focus,
textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.checkbox-group label { font-weight: 400; display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ── Day tabs (viewer) ─────────────────────────────────────────────── */

.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.day-tab {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.day-tab.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ── System selector (viewer) ──────────────────────────────────────── */

.system-select { margin-bottom: 16px; }
.system-select select { width: auto; min-width: 220px; }

/* ── Day checkboxes (report) ───────────────────────────────────────── */

.day-checkboxes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.day-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.day-check-label input { accent-color: var(--red); }

/* ── Graph skeleton (viewer loading state) ─────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #e8ecf0 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: mtdz-shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes mtdz-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================================
 * Styles extracted from MTDZ templates (MF-12: inline-style extraction)
 * ============================================================================ */

/* ===== Report page: section divider & DSB upload ===== */

.section-divider { border-top: 2px solid var(--border); margin-top: 20px; padding-top: 18px; }
.section-divider h3 {
  font-size: 0.9rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--gray); margin-bottom: 12px;
}
.optional-label {
  font-size: 0.75rem; font-weight: 400; color: var(--muted);
  text-transform: none; letter-spacing: 0; margin-left: 6px;
}
.dsb-upload-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dsb-upload-btn {
  display: inline-block; padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--red); background: transparent; color: var(--red);
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: opacity 0.15s; font-family: inherit; white-space: nowrap; margin-bottom: 0;
}
.dsb-upload-btn:hover { opacity: 0.75; }
.dsb-status-text { font-size: 0.82rem; color: var(--muted); }
.dsb-status-text.success { color: #2a7a2a; }
.dsb-status-text.warning { color: #b36000; }
.dsb-status-text.error   { color: var(--red); }

/* ===== Report page: equipment table ===== */

.equipment-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-top: 4px; }
.equipment-table th {
  text-align: left; padding: 5px 8px; background: var(--light-gray);
  border: 1px solid var(--border); font-weight: 600; color: var(--gray); white-space: nowrap;
}
.equipment-table td { padding: 3px 6px; border: 1px solid var(--border); vertical-align: middle; }
.equipment-table tr.system-header-row td {
  background: #f0f0f0; font-weight: 600; font-size: 0.78rem;
  color: var(--gray); letter-spacing: 0.04em; padding: 4px 8px;
}
.equipment-table tr.system-name-row td { padding: 6px 8px 2px; border-bottom: none; }
.equipment-table tr.system-name-row td.sys-name-label {
  font-size: 0.75rem; color: var(--muted); font-weight: 500; vertical-align: middle;
}
.equipment-table .system-name-input { font-weight: 600; font-size: 0.88rem; }
.equipment-table input[type=text] {
  width: 100%; padding: 3px 6px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.82rem; margin-bottom: 0; font-family: inherit;
}
.equipment-table input[type=text]:focus { outline: none;  border-color: var(--red);}

/* ===== Report page: action buttons & spinner ===== */

.action-buttons-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.action-status-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.action-spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin 0.75s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.action-status-text { font-size: 0.82rem; color: var(--muted); }

/* ===== Hub page: upload processing indicator ===== */

.upload-processing-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-top: 8px;
  background: var(--surface, #f7f7f9); border: 1px solid var(--border);
  border-radius: 6px;
}
.upload-processing-text { font-size: 0.9rem; color: var(--muted); }

/* ===== Report page: system-picker modal ===== */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: var(--white); border-radius: 8px; padding: 24px;
  max-width: 520px; width: 100%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.modal-box h3 { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.modal-box p  { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
#systemPickerOptions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.system-picker-option {
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.system-picker-option:hover {  border-color: var(--red);background: #fff8f8; }
.system-picker-option strong { font-size: 0.9rem; display: block; margin-bottom: 2px; }
.system-picker-option .picker-systems { font-size: 0.8rem; color: var(--muted); }
.deviation-detail { font-size: 0.76rem; color: #b36000; margin-top: 4px; }

/* ===== Report page: changelog & known issues ===== */

.changelog-link-row { display: flex; justify-content: flex-start; margin-top: 8px; margin-bottom: 8px; }
.changelog-link {
  background: none; border: none; color: var(--muted); font-size: 0.85rem;
  cursor: pointer; padding: 0; text-decoration: underline;
  font-family: inherit; transition: color 0.15s;
}
.changelog-link:hover { color: var(--red); }
.modal-box--wide { max-width: 620px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-close {
  background: none; border: none; font-size: 1.2rem; color: var(--muted);
  cursor: pointer; padding: 0 2px; line-height: 1; flex-shrink: 0;
}
.modal-close:hover { color: var(--red); }
.changelog-section-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin: 10px 0 4px;
}
.changelog-version {
  font-size: 0.78rem; font-weight: 700; color: var(--red); margin: 16px 0 2px;
  display: flex; align-items: center; gap: 8px;
}
.changelog-version:first-child { margin-top: 0; }
.changelog-badge {
  font-size: 0.65rem; background: var(--red); color: #fff;
  border-radius: 3px; padding: 1px 5px; font-weight: 700; letter-spacing: 0.04em;
}
.changelog-list { list-style: none; padding: 0; margin: 0 0 6px; }
.changelog-list li {
  font-size: 0.81rem; color: var(--gray); padding: 2px 0 2px 14px;
  position: relative; line-height: 1.45;
}
.changelog-list li::before { content: '•'; position: absolute; left: 0; color: var(--muted); }
.known-issue {
  background: #fff8f0; border-left: 3px solid #e8901a;
  border-radius: 0 4px 4px 0; padding: 7px 10px; margin-bottom: 7px;
}
.known-issue-title { font-size: 0.81rem; font-weight: 600; color: var(--gray); }
.known-issue-fix   { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }

/* ===== Sysinfo page: SVG topology classes ===== */

/* Sysinfo banner: red-toned because this file type carries no monitoring
   data, just topology. Overrides the blue .info-banner from mtdz.css. */
#sysinfo-banner.info-banner {
  background: #fff3f3;
  border: 1px solid #ffb3b3;
  border-left: 4px solid var(--red);
  color: var(--dark);
  font-size: 0.9rem;
  padding: 12px 16px;
  margin-bottom: 20px;
}
#sysinfo-banner.info-banner strong { display: block; margin-bottom: 2px; }

/* Topology SVG renderer */
.topo-scroll { overflow-x: auto; padding-bottom: 8px; }
.oc-box  { fill: #1a1a1a; }
.os-box  { fill: #2d2d2d; stroke: #888; stroke-width: 1; stroke-dasharray: 3 2; }
.bc-box  { fill: #555; }
.ic-box  { fill: #2a7a52; }
.unit-label-single {
  font-size: 12px; font-weight: 600; fill: #fff;
  dominant-baseline: middle; text-anchor: middle;
}
.connect-line   { stroke: #999; stroke-width: 1.5; fill: none; }
.port-cap-line  { stroke: #555; stroke-width: 1.5; }
.port-cap-sq    { fill: none; stroke: #555; stroke-width: 1.5; }
.sys-divider    { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 4; }
.no-systems     { color: var(--muted); font-style: italic; padding: 16px 0; }

/* ===== Viewer page: IDU graph grid ===== */

#idu-graphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(480px, 1fr)); gap: 16px; }
