/* =========================================================
   GeoPipeline360 — Веб-сервисы (/new/services/)
   Дополнение к /assets/css/style.css: формы модулей,
   загрузка файлов, прогресс, результаты, вкладки.
   Палитра и токены — из style.css (var(--...)).
   ========================================================= */

/* ---------- раскладка страницы сервиса: форма слева, результат справа ---------- */
.ws-layout{
  display:grid; grid-template-columns: 5fr 4fr; gap: 28px; align-items:start;
}
@media (max-width: 940px){
  .ws-layout{ grid-template-columns: 1fr; }
}

/* ---------- карточки-блоки формы ---------- */
.ws-card{
  border:1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
}
.ws-card + .ws-card{ margin-top: 14px; }
.ws-card--tight{ padding: 14px 16px; }

.ws-step-head{
  display:flex; align-items:center; gap:10px; margin-bottom:12px; flex-wrap:wrap;
}
.ws-step-num{
  width:26px; height:26px; flex:none; border-radius:7px;
  background: var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-mono); font-size:12px; font-weight:700; color: var(--primary-2);
}
.ws-step-title{
  font-family: var(--font-mono); font-size:12.5px; font-weight:600;
  letter-spacing:.07em; text-transform:uppercase; color: var(--text-muted);
}
.ws-step-head .ws-inline-action{ margin-left:auto; }

/* ---------- контролы ---------- */
.ws-radio-group{ display:flex; flex-direction:column; gap:8px; }
.ws-radio{
  text-align:left; padding:10px 14px; border-radius:9px;
  border:1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); cursor:pointer; font-size:14px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ws-radio:hover{ border-color: var(--primary-2); color: var(--text); }
.ws-radio.active{
  border-color: var(--primary-2); background: var(--primary-tint); color: var(--text);
}
.ws-radio[disabled]{ opacity:.5; cursor:not-allowed; }

.ws-check{
  display:flex; align-items:flex-start; gap:9px; font-size:14px; color: var(--text-muted);
  cursor:pointer; line-height:1.5; padding:4px 0;
}
.ws-check input{ margin-top:3px; accent-color: var(--primary-2); }
.ws-check:hover{ color: var(--text); }
/* телефон и сенсорный экран: подпись флажка — цель нажатия не меньше 40 px (ревизия 08.10) */
@media (max-width: 760px), (hover: none){
  .ws-check{ min-height:40px; align-items:center; }
  .ws-check input{ margin-top:0; }
}

.ws-select, .ws-input{
  width:100%;
  background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
  color: var(--text); font: inherit; font-size:14px;
  padding: 9px 12px;
}
.ws-select:focus, .ws-input:focus{ outline:none; border-color: var(--primary-2); }
.ws-field-row{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.ws-field-row > span{ font-size:13.5px; color: var(--text-muted); }
.ws-field-row .ws-input, .ws-field-row .ws-select{ width:auto; min-width:110px; flex:none; }
.ws-field-col{ display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.ws-field-col:last-child{ margin-bottom:0; }
.ws-field-col > span{ font-size:13px; color: var(--text-muted); }

/* переключатель из двух кнопок (метры/мм) */
.ws-toggle{ display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.ws-toggle button{
  background: var(--surface-2); border:none; padding:8px 16px; cursor:pointer;
  font-size:13.5px; color: var(--text-muted);
}
.ws-toggle button + button{ border-left:1px solid var(--border); }
.ws-toggle button.active{ background: var(--primary-tint); color: var(--primary-2); font-weight:600; }

/* ---------- зона загрузки файлов ---------- */
.ws-drop{
  border:2px dashed var(--border); border-radius: 12px;
  padding: 22px 16px; text-align:center; cursor:pointer;
  background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
  font-size:14px; color: var(--text-muted);
}
.ws-drop b{ color: var(--text); font-weight:600; }
.ws-drop .ws-drop-hint{ display:block; margin-top:5px; font-size:12.5px; color: var(--text-faint); }
.ws-drop:hover, .ws-drop.drag{ border-color: var(--primary-2); background: var(--primary-tint); }
.ws-drop input[type="file"]{ display:none; }

.ws-file-list{ margin-top:10px; display:flex; flex-direction:column; gap:6px; }
.ws-file-row{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--border-soft); border-radius:8px;
  background: var(--surface-2);
  padding: 7px 11px; font-size:13px; color: var(--text-muted);
}
.ws-file-row .ws-file-name{
  flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  color: var(--text); font-family: var(--font-mono); font-size:12.5px;
}
.ws-file-row .ws-file-size{ flex:none; font-family: var(--font-mono); font-size:11.5px; color: var(--text-faint); }
.ws-file-row .ws-file-state{ flex:none; font-size:11.5px; }
.ws-file-row .ws-file-state.ok{ color: var(--ok); }
.ws-file-row .ws-file-state.err{ color:#ff7a7a; }
.ws-file-row .ws-file-remove{
  flex:none; background:none; border:none; cursor:pointer; color: var(--text-faint);
  font-size:15px; line-height:1; padding:2px 4px; border-radius:5px;
}
.ws-file-row .ws-file-remove:hover{ color:#ff7a7a; background: rgba(255,122,122,.1); }

/* ---------- кнопка запуска + прогресс + статус ---------- */
.ws-run-row{ margin-top:18px; }
.ws-run-row .btn{ width:100%; }

.ws-progress{
  margin-top:12px; display:none;
}
.ws-progress.show{ display:block; }
.ws-progress-track{
  height:7px; border-radius:5px; background: var(--surface-2);
  border:1px solid var(--border-soft); overflow:hidden;
}
.ws-progress-fill{
  height:100%; width:0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .2s ease;
}
.ws-progress.indet .ws-progress-fill{
  width:35%; animation: ws-indet 1.1s ease-in-out infinite alternate;
}
@keyframes ws-indet{
  from{ margin-left:0; } to{ margin-left:65%; }
}
.ws-progress-text{
  margin-top:6px; font-family: var(--font-mono); font-size:12px; color: var(--text-faint);
}

.ws-status{
  margin-top:12px; display:flex; align-items:center; gap:9px;
  font-size:13.5px; color: var(--text-muted);
}
.ws-status .dot{
  width:8px; height:8px; border-radius:50%; flex:none;
  background: var(--text-faint);
}
.ws-status.busy .dot{ background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.ws-status.ok .dot{ background: var(--ok); box-shadow: 0 0 0 3px rgba(62,207,142,.15); }
.ws-status.error{ color:#ff9a9a; }
.ws-status.error .dot{ background:#ff5c5c; box-shadow: 0 0 0 3px rgba(255,92,92,.15); }

/* ---------- результаты ---------- */
.ws-result-empty{
  font-size:13.5px; color: var(--text-faint); text-align:center; padding: 26px 10px;
}
.ws-result-list{ display:flex; flex-direction:column; gap:8px; }
.ws-result-row{
  display:flex; align-items:center; gap:12px;
  border:1px solid var(--border); border-radius:9px;
  background: var(--surface-2);
  padding: 10px 12px;
}
.ws-result-row .ws-result-name{
  flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-family: var(--font-mono); font-size:13px; color: var(--text);
}
.ws-result-row .ws-result-size{ flex:none; font-family: var(--font-mono); font-size:11.5px; color: var(--text-faint); }
.ws-result-actions{ margin-top:12px; display:flex; justify-content:flex-end; }

/* ---------- вкладки (universal) ---------- */
.ws-tabs{
  display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 22px;
  border-bottom:1px solid var(--border-soft); padding-bottom:14px;
}
.ws-tab{
  padding:9px 16px; border-radius:9px; cursor:pointer;
  border:1px solid var(--border); background: var(--surface);
  font-size:14px; color: var(--text-muted);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ws-tab:hover{ color: var(--text); border-color: var(--primary-2); }
.ws-tab.active{
  background: var(--primary-tint); border-color: var(--primary-2);
  color: var(--primary-2); font-weight:600;
}

/* ---------- редактируемая таблица (OCR / предпросмотр) ---------- */
.ws-table-wrap{
  border:1px solid var(--border); border-radius:10px; background: var(--surface-2);
  overflow:auto; max-height: 420px;
}
.ws-table{ border-collapse: collapse; width:100%; }
.ws-table td{
  border:1px solid var(--border-soft); padding:6px 9px;
  font-size:13px; color: var(--text); font-family: var(--font-mono);
  min-width:60px; white-space:nowrap;
}
.ws-table td.ws-editable{ cursor:text; }
.ws-table td.ws-editable:hover{ background: var(--primary-tint); }
.ws-table td input{
  width:100%; min-width:80px; background: var(--bg-soft); color: var(--text);
  border:1px solid var(--primary-2); border-radius:4px; font: inherit; padding:3px 5px;
}
.ws-table-tools{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.ws-btn-small{
  padding:7px 12px; border-radius:8px; cursor:pointer; font-size:13px;
  border:1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.ws-btn-small:hover{ border-color: var(--primary-2); color: var(--text); }

/* ---------- canvas-выделение области (OCR) ---------- */
.ws-crop-wrap{
  position:relative; display:none; user-select:none; line-height:0;
  border-radius:8px; overflow:hidden; border:1px solid var(--border);
}
.ws-crop-wrap img{ max-width:100%; display:block; }
.ws-crop-wrap canvas{ position:absolute; left:0; top:0; cursor:crosshair; touch-action:none; }

/* ---------- мелочи ---------- */
.ws-hint{ font-size:12.5px; color: var(--text-faint); line-height:1.55; margin-top:8px; }
.ws-hint code{ font-family: var(--font-mono); font-size:11.5px; color: var(--text-muted); }
.ws-sep{ height:1px; background: var(--border-soft); border:none; margin:16px 0; }

.ws-badge-flag{
  display:inline-flex; align-items:center; gap:6px;
  font-size:11.5px; font-weight:700; letter-spacing:.03em; text-transform:uppercase;
  padding:4px 10px; border-radius:999px;
  background: var(--accent-tint); color: var(--accent-2);
  border:1px solid rgba(242,169,60,.35);
}

/* хаб: сетка 2×2 */
.ws-grid{ display:grid; grid-template-columns: repeat(2, 1fr); gap:20px; }
@media (max-width: 760px){ .ws-grid{ grid-template-columns:1fr; } }
.ws-grid .module-card{ min-height: 210px; }
.ws-grid .module-card.flag{
  border-color: rgba(242,169,60,.4);
  background: linear-gradient(160deg, var(--accent-tint), var(--surface) 55%);
}
.ws-grid .module-card.flag:hover{ border-color: var(--accent-2); }
