﻿/* ==========================================================================
   SP_analyzer – arkusz stylów (Etap 1: interfejs)
   Paleta zgodna ze specyfikacją, sekcja 7.1
   ========================================================================== */

:root {
  --topbar: #211B35;
  --primary: #7253B5;
  --primary-hover: #60439E;
  --primary-light: #EAE4F5;
  --primary-lighter: #F7F3FC;
  --bg: #F7F6FA;
  --surface: #FFFFFF;
  --border: #E0DAEA;
  --dash: #A78BCF;
  --text: #29213A;
  --text-2: #716A7D;
  --text-3: #81768F;

  --ok-bg: #E9F5ED;   --ok-fg: #23834A;
  --err-bg: #FCEDEC;  --err-fg: #C74747;
  --warn-bg: #FFF4E4; --warn-fg: #B77920;
  --na-bg: #F0EEF3;   --na-fg: #777180;
  --info-bg: #EDE8F8; --info-fg: #7253B5;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(33, 27, 53, 0.04);

  --font-ui: ui-sans-serif, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Górna belka ---------- */

.topbar {
  background: var(--topbar);
  color: #FFFFFF;
  height: 60px;
  display: flex;
  align-items: center;
}

.topbar-inner {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #D9CDF0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { font-size: 12px; color: #B9AFD0; }

.topbar-status {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #D9CDF0;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #6FCF97;
}
.status-dot.is-busy { background: #E0B45A; }

.version {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- Obszar roboczy ---------- */

.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}

.page-heading { margin-bottom: 24px; }

.page-heading h1 {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0 0 6px;
  font-size: 40px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text);
}

.page-heading p {
  margin: 0;
  color: var(--text-2);
  font-size: 18px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 20px;
  align-items: stretch;
}

/* WCZYTAJ i kolumna boczna mieszczą się w wysokości ekranu */
.tile-upload {
  height: calc(100vh - 230px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  height: calc(100vh - 230px);
  min-height: 480px;
}

.tile-analysis { flex: 0 0 auto; padding: 8px 14px; }
.tile-analysis .tile-header { margin-bottom: 4px; }

.tile-check {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

.tile-summary { grid-column: 1 / -1; }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tile-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text);
}

.tile-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.file-count {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}

.section-title {
  margin: 20px 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-2);
}

/* ---------- Kafel WCZYTAJ: tabela plików ---------- */

.file-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.file-table th,
.file-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.file-table thead th {
  position: sticky; top: 0;
  background: var(--primary-lighter);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  z-index: 1;
}

.file-table tbody tr:last-child td { border-bottom: none; }
.file-table tbody td { height: 22px; padding: 2px 8px; }
.file-table tbody tr:hover { background: #FBFAFD; }

.file-table th:nth-child(1), .file-table td:nth-child(1) { width: auto; }
.file-table .col-action { width: 56px; text-align: right; }

.file-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.file-name.is-demo { color: var(--text-2); }

.demo-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border-radius: 4px;
  background: var(--info-bg);
  color: var(--info-fg);
  vertical-align: middle;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-error { background: var(--err-bg); color: var(--err-fg); }
.badge-warning { background: var(--warn-bg); color: var(--warn-fg); }
.badge-na { background: var(--na-bg); color: var(--na-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }

.icon-button {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover { background: var(--primary-light); color: var(--primary); }
.icon-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- Drag & Drop ---------- */

.dropzone {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--primary-lighter);
  border: 1.5px dashed var(--dash);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible {
  background: var(--primary-light);
  border-color: var(--primary);
  outline: none;
}

.dropzone.is-dragover {
  background: var(--primary-light);
  border-color: var(--primary);
  border-style: solid;
}

.dropzone-icon { color: var(--primary); margin-bottom: 6px; }

.dropzone-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.dropzone-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.dropzone-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

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

/* ---------- Przyciski ---------- */

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  flex: 1;
  min-height: 52px;
  padding: 0 24px;
  border: none;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 15px;
  letter-spacing: 0.4px;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost {
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--dash);
  color: var(--primary);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.notice {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--info-bg);
  color: var(--info-fg);
}

.notice.is-warning { background: var(--warn-bg); color: var(--warn-fg); }
.notice.is-error { background: var(--err-bg); color: var(--err-fg); }

/* ---------- Kafel CHECK LISTA ---------- */

.check-table-wrap {
  overflow: auto;
  max-height: 640px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.check-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12.5px;
}

.check-table th,
.check-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.check-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--primary-lighter);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-2);
  white-space: nowrap;
}

.check-table tbody tr:last-child td { border-bottom: none; }

.check-table td.check-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.check-table th:nth-child(1),
.check-table th:nth-child(3) { width: auto; }
.check-table th:nth-child(2),
.check-table th:nth-child(4) { width: 96px; }

.check-table td.check-empty { background: #FCFBFE; }

.check-table td.check-status { white-space: nowrap; width: 96px; }

.check-table .status-pending {
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* Lewa i prawa część tabeli są niezależne: osobne kolumny, bez współdzielenia komórek */
.check-table td:nth-child(2),
.check-table td:nth-child(4) { text-align: center; }

/* ---------- Konsola CHECK LISTA ---------- */

.console {
  flex: 1;
  min-height: 0;
  scrollbar-gutter: stable;
  overflow-y: auto;
  overflow-x: hidden;
  background: #000000;
  color: #D4D4D4;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.console-line {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  line-height: 1.7;
  padding-left: 2em;
}

.console-idle { margin: 0; color: #7D7790; }

.console-sep {
  color: #7D7790;
  white-space: pre;
  line-height: 1.7;
  padding-left: 2em;
  margin: 6px 0;
}

.console-line .c-status { font-weight: 600; white-space: nowrap; }
.console-line .c-id { overflow-wrap: anywhere; color: #E6E1F0; }
.console-line.is-pending .c-id { color: #7D7790; }

.c-ok { color: #6FCF97; }
.c-error { color: #FF8A80; }
.c-warning { color: #F2C078; }
.c-na { color: #A8A3B3; }
.c-pending { color: #7D7790; }

.console-empty { color: #7D7790; }

.report-empty {
  margin: 0;
  padding: 18px 16px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

/* ---------- Kafel PODSUMOWANIE ---------- */

.counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.counter {
  min-width: 0;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.counter-value {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.counter-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.counter-ok { background: var(--ok-bg); color: var(--ok-fg); }
.counter-error { background: var(--err-bg); color: var(--err-fg); }
.counter-warning { background: var(--warn-bg); color: var(--warn-fg); }
.counter-error.is-alert { outline: 3px solid var(--err-fg); outline-offset: 2px; }
.counter-warning.is-alert { outline: 3px solid var(--warn-fg); outline-offset: 2px; }

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

.message {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.message-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  padding-top: 2px;
}

.message-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.message-body {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.message-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.message-ok { background: var(--ok-bg); border-color: transparent; }
.message-error { background: var(--err-bg); border-color: transparent; }
.message-warning { background: var(--warn-bg); border-color: transparent; }
.message-info { background: var(--na-bg); border-color: transparent; }

/* ---------- Responsywność ---------- */

@media (max-width: 1100px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .tile-summary { grid-column: auto; }
  .tile-upload, .side { height: auto; min-height: 0; }
  .tile-check { min-height: 420px; }
}

@media (max-width: 600px) {
  .check-table { min-width: 560px; }
  .check-table-wrap { overflow-x: auto; }
  .topbar-inner { padding: 0 16px; }
  .topbar-status span:not(.status-dot):not(.version) { display: none; }
  .workspace { padding: 20px 14px 36px; }
  .upload-actions { flex-direction: column-reverse; align-items: stretch; }
  .btn-ghost { min-height: 44px; }
  .btn-primary { min-height: 52px; }
}

/* ---------- Ograniczenie ruchu ---------- */

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

.console-block {
  margin: 0 0 8px;
  color: #ADD8E6;
  font-size: 1em;
  font-weight: normal;
  letter-spacing: normal;
}
.console-group + .console-group {
  margin-top: 14px;
}