/* =====================================================================
   URDS Log Validator – Stylesheet
   ===================================================================== */

/* Webtools panel */
:root {
  --wt-bg:#ffffff; --wt-text:#222222; --wt-border:#cccccc;
  --wt-muted:#6b7280; --wt-chip-bg:#f3f4f6;
  --wt-chip-bg-hover:#e5e7eb; --wt-shadow:0 10px 25px rgba(0,0,0,.10);
}
#webtools {
  position:relative; display:flex; flex-direction:column;
  align-items:center; z-index:1000; margin-top:-5px; font-family:inherit;
}
#webtools-toggle {
  display:inline-block; background:var(--wt-bg); color:var(--wt-text);
  border:1px solid var(--wt-border); padding:8px 18px;
  border-radius:0 0 10px 10px; font-size:14px; font-weight:700;
  cursor:pointer; box-shadow:var(--wt-shadow);
}
#webtools-toggle:hover { background:var(--wt-chip-bg); }
#webtools-panel {
  width:100%; max-width:750px; margin-top:8px;
  border:1px solid var(--wt-border); background:var(--wt-bg);
  box-shadow:var(--wt-shadow); overflow:hidden;
  max-height:0; opacity:0; border-radius:10px;
  transition:max-height .25s ease, opacity .2s ease;
}
#webtools.open #webtools-panel { max-height:330px; opacity:1; margin-bottom:8px; }
#webtools-links {
  display:flex; flex-wrap:wrap; justify-content:center; gap:10px; padding:12px;
}
#webtools-links a {
  flex:0 0 auto; display:flex; flex-direction:column;
  align-items:center; justify-content:center; min-width:120px;
  padding:10px 12px; text-decoration:none; color:var(--wt-text);
  background:var(--wt-chip-bg); border:1px solid var(--wt-border);
  border-radius:6px; transition:background .15s ease, transform .12s ease;
}
#webtools-links a:hover { background:var(--wt-chip-bg-hover); transform:translateY(-1px); }
#webtools-links .title { font-weight:700; font-size:14px; }
#webtools-links .desc  { color:var(--wt-muted); font-size:12px; line-height:1.2; }

/* Base */
body, html {
  font-family: Titillium Web, Calibri, sans-serif;
  margin:0; padding:0;
  background:#f5f5f5;
  overflow-x:hidden;
}

/* =====================================================================
   Header bar – title left, toast+progress centered, spacer right
   ===================================================================== */
#headerBar {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  background: #fff;
  border-bottom: 1px solid #ccc;
  min-height: 40px;
  gap: 8px;
}
#headerTitle {
  margin: 0;
  font-size: 27px;
  white-space: nowrap;
  flex: 0 0 auto;
}
#headerCenter {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
#headerRight {
  flex: 0 0 auto;
  min-width: 180px;
}

/* Toast – inline in header, centered */
#toast {
  display: none;
  background: #333;
  color: #fff;
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 13px;
  max-width: 480px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading progress bar in header */
#loadProgressWrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
#loadProgressBar {
  width: 180px;
  height: 12px;
  accent-color: #007bff;
}
#loadProgressLabel {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
}

/* Upload bar */
#uploadContainer {
  display:flex; align-items:center; flex-wrap:wrap;
  gap:6px; padding:6px 8px;
  background:#fff; border-bottom:1px solid #ccc;
}

button, .btn {
  font-family: Titillium Web, Calibri, sans-serif;
  padding:5px 12px; font-size:13px; cursor:pointer;
  border:1px solid #aaa; border-radius:3px;
  background:#f0f0f0; color:#222;
}
button:hover, .btn:hover { background:#ddd; }

#autoFixBtn {
  background:#007bff; color:#fff; border-color:#0056b3; font-weight:bold;
}
#autoFixBtn:hover { background:#0056b3; }

.custom-file-input { position:relative; display:inline-block; }
.custom-file-input input[type="file"] {
  position:absolute; top:0; right:0; margin:0;
  opacity:0; width:100%; height:100%; cursor:pointer;
}

/* =====================================================================
   Summary bar
   ===================================================================== */
#summaryBar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: #fff;
  border-bottom: 1px solid #ccc;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 6px;
}

#summaryLeft {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}

.ring-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ring-lbl {
  font-size: 10px;
  color: #555;
  white-space: nowrap;
}

/* hide the label span – value drawn inside canvas */
.ring-wrap span[id] { display: none; }

#avgScoreWrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

#legendBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  margin-left: auto;
}
.leg-entry { display: flex; align-items: center; gap: 5px; }
.leg-box {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 2px; border: 1px solid #aaa;
}

/* Filter bar */
#filterContainer {
  display:none; flex-direction:column; gap:6px;
  padding:6px 8px;
  background:#fff; border-bottom:1px solid #ccc;
  font-size:13px;
}
#filterRow1 { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
#filterRow1 label { display:flex; align-items:center; gap:4px; }
#scoreFilterSelect { padding:3px 5px; font-size:13px; font-family:inherit; }

.filter-pill {
  display:inline-flex; align-items:center; gap:4px;
  padding:2px 7px; border-radius:10px; font-size:12px;
  font-weight:bold; cursor:pointer; border:none;
}
.pill-high   { background:#d4edda; color:#155724; }
.pill-medium { background:#fff3cd; color:#856404; }
.pill-low    { background:#f8d7da; color:#721c24; }
.pill-fixed  { background:#cce5ff; color:#004085; }
.pill-none   { background:#e2e3e5; color:#383d41; }

#filterRow2 { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
#filterRow2 label { display:flex; align-items:center; gap:4px; }
#freeDistInput { width:52px; height:20px; font-size:13px; font-family:inherit; }
#piExcludeInput {
  width:220px; padding:2px 5px; font-size:13px; font-family:inherit;
  border:1px solid #aaa; border-radius:3px;
}
#searchInput {
  width:200px; padding:3px 6px; font-size:13px; font-family:inherit;
  border:1px solid #aaa; border-radius:3px;
}

/* Table */
#tableWrapper {
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}
#resultTable thead th {
  position: sticky;
  top: 0;
  z-index: 20;
}
table#resultTable {
  width:100%; border-collapse:collapse; font-size:12px;
  table-layout:auto; min-width:900px;
}
table#resultTable thead th {
  background:#f2f2f2;
  background-clip: padding-box;
  padding:3px 5px; text-align:left;
  white-space:nowrap; position:sticky; top:0; z-index:5;
  cursor:pointer; user-select:none;
}
table#resultTable thead th:hover { background:#e4e4e4; }
table#resultTable thead th .sort-arrow { margin-left:4px; color:#888; font-size:10px; }
table#resultTable td {
  border:1px solid #ddd; padding:2px 5px;
  vertical-align:top; word-break:break-word;
}

/* Row colours */
.row-high   { background:#d4edda; }
.row-medium { background:#fff3cd; }
.row-low    { background:#f8d7da; }
.row-none   { background:#fafafa; }
.row-fixed  { background:#cce5ff !important; }

/* Score circle */
.score-circle {
  display:inline-flex; align-items:center; justify-content:center;
  width:32px; height:32px; border-radius:50%;
  font-weight:bold; font-size:12px; color:#fff;
}
.sc-high   { background:#28a745; }
.sc-medium { background:#fd7e14; }
.sc-low    { background:#dc3545; }
.sc-none   { background:#aaa; }
.sc-fixed  { background:#1890ff; }

/* Badges */
.badge {
  display:inline-block; padding:1px 5px; border-radius:3px;
  font-size:11px; font-weight:bold; white-space:nowrap;
}
.b-ok   { background:#28a745; color:#fff; }
.b-warn { background:#fd7e14; color:#fff; }
.b-err  { background:#dc3545; color:#fff; }
.b-info { background:#6c757d; color:#fff; }

/* PI/PS error colour */
.pi-err { color:#dc3545; font-weight:bold; }

/* Detail rows */
.detail-row { display:none; }
.detail-row.open { display:table-row; }
.detail-row > td {
  background:#f0f4ff; padding:6px 10px;
  font-size:11.5px; border-top:none;
}
.check-row { display:flex; flex-wrap:wrap; gap:8px; }
.check-item { display:flex; align-items:flex-start; gap:4px; flex-wrap:wrap; }

.expand-btn {
  cursor:pointer; background:none; border:none;
  font-size:13px; padding:0 2px; color:#555; line-height:1;
}
.validating { color:#888; font-style:italic; }

/* Fix overlay */
#fixOverlay {
  display:none; position:fixed;
  top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,.45); z-index:9600;
}
#fixModal {
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  background:#fff; border:2px solid #444;
  padding:16px 20px; border-radius:6px;
  box-shadow:0 0 20px rgba(0,0,0,.4);
  min-width:380px; max-width:680px;
  max-height:88vh; overflow-y:auto;
}
#fixModal h3 { margin:0 0 10px; font-size:14px; }
#fixModal .fix-close {
  position:absolute; top:8px; right:12px;
  font-size:20px; cursor:pointer; background:none; border:none;
}
#fixModal table { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:8px; }
#fixModal th, #fixModal td { padding:3px 7px; border:1px solid #ddd; text-align:left; }
#fixModal th { background:#f2f2f2; }

.fix-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
#candidateSelect,
#psVariantSelect { width:100%; margin-bottom:6px; font-size:13px; padding:4px; font-family:inherit; }

/* =====================================================================
   Delete confirmation overlay
   ===================================================================== */
#deleteOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.50);
  z-index: 8500;
  align-items: center;
  justify-content: center;
}
#deleteOverlay.open {
  display: flex;
}
#deleteModal {
  background: #fff;
  border: 2px solid #dc3545;
  padding: 20px 24px;
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(0,0,0,.4);
  min-width: 360px;
  max-width: 560px;
  width: 90vw;
}
#deleteModal h3 { margin: 0 0 8px; }
#deletePreviewWrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#deletePreviewWrap th,
#deletePreviewWrap td {
  padding: 2px 6px;
  border: 1px solid #ddd;
  text-align: left;
}
#deletePreviewWrap th { background: #f2f2f2; }
.delete-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }

/* Map link */
.map-link { color:#1558b0; text-decoration:none; font-weight:bold; cursor:pointer; }
.map-link:hover { text-decoration:underline; }

/* Map overlay */
#mapOverlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,.6); z-index:9500;
  display:flex; align-items:center; justify-content:center;
}
#mapOverlayBox {
  background:#fff; border-radius:8px;
  width:90vw; height:85vh;
  display:flex; flex-direction:column;
  overflow:hidden;
  box-shadow:0 0 30px rgba(0,0,0,.5);
}
#mapOverlayClose {
  padding:6px 14px; margin:6px 8px;
  align-self:flex-end;
  background:#dc3545; color:#fff; border:none;
  border-radius:4px; cursor:pointer; font-size:13px; font-weight:bold;
}
#mapOverlayClose:hover { background:#b02a37; }
#mapOverlayInner {
  flex:1; border:none; width:100%; height:100%;
}
#mapOverlayInner iframe { width:100%; height:100%; border:none; }

/* Auto-fix progress overlay */
#autoFixOverlay {
  display:none; position:fixed;
  top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,.5); z-index:9000;
}
#autoFixBox {
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  background:#fff; border:2px solid #007bff;
  padding:24px 32px; border-radius:8px;
  text-align:center; min-width:300px;
  box-shadow:0 0 24px rgba(0,0,0,.35);
}
#autoFixBox h3 { margin:0 0 12px; color:#007bff; }
#autoFixProgress { font-size:14px; margin:6px 0; }
progress#autoFixBar { width:100%; height:16px; margin-top:8px; }

/* Country flag in table */
.itu-flag {
  display:inline-flex; align-items:center; gap:4px; white-space:nowrap;
}
.itu-flag img { width:20px; height:auto; vertical-align:middle; border:1px solid #ddd; }

#downloadBtn { margin-left:4px; }

[data-delete] {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: #b02a37 !important;
  font-weight: bold;
}
[data-delete]:hover { background: #b02a37 !important; }

/* =====================================================================
   Discard duplicates checkbox – uploadContainer
   ===================================================================== */
#discardDupsLabel {
  display: flex !important;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-family: Titillium Web, Calibri, sans-serif;
  color: #222;
  padding: 5px 0;
  margin-left: 2px;
}
#discardDupsLabel input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

#cancelValidationBtn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  padding: 0 !important;
  margin-left: 2px;
  border-radius: 50% !important;
  background: #dc3545 !important;
  color: #fff !important;
  border: none !important;
  font-size: 12px !important;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}
#cancelValidationBtn:hover {
  background: #b02a37 !important;
}

#manualLink {
  display: inline-block;
  padding: 5px 12px;
  font-size: 13px;
  margin-left: 110px;        
  font-family: Titillium Web, Calibri, sans-serif;
  font-weight: bold;
  color: #0056b3;
  text-decoration: none;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #f0f0f0;
  white-space: nowrap;
}
#manualLink:hover {
  background: #ddd;
  text-decoration: none;
}

#copyToClipboardBtn { margin-left: 4px; }