/* ============================================================
   NEXCIQ PANEL — design system 2026
   Ciemny, minimalistyczny, bez frameworków.
   ============================================================ */

:root {
  --bg: #09090b;
  --bg-soft: #0e0e11;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f2f5;
  --muted: #9a9aa3;
  --faint: #5d5d66;
  --accent: #8b9dff;
  --accent-strong: #6478ff;
  --accent-soft: rgba(120, 137, 255, 0.12);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Inter", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* delikatna poświata w tle */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 480px at 50% -10%, rgba(120, 137, 255, 0.08), transparent 70%),
    radial-gradient(700px 400px at 90% 110%, rgba(74, 222, 128, 0.04), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.page--narrow { max-width: 560px; }

/* ---------- Typografia ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }

/* ---------- Nawigacja ---------- */
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(14, 14, 17, 0.75);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 16px;
  z-index: 50;
}

.nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  padding: 4px 10px 4px 4px;
}

.brand-dot {
  width: 26px; height: 26px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-strong), #a78bfa);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}

.nav .links { display: flex; gap: 2px; margin-left: auto; }

.nav a.link {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: color .15s, background .15s;
}
.nav a.link:hover { color: var(--text); background: var(--surface-2); }
.nav a.link.active { color: var(--text); background: var(--surface-2); }

/* ---------- Karty ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.card + .card { margin-top: 16px; }

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 14px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
  user-select: none;
}
.btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.22); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-strong);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { background: #7689ff; border-color: transparent; }

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); border-color: rgba(248,113,113,0.4); }

.btn-success {
  background: var(--green-soft);
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--green);
}
.btn-success:hover { background: rgba(74, 222, 128, 0.22); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }

.btn-sm { padding: 6px 12px; font-size: 0.84rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- Formularze ---------- */
.input, input[type="text"], input[type="password"], input[type="file"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--faint); }

.label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 550;
}

.row { display: flex; gap: 10px; align-items: center; }
.row > .input { flex: 1; }

/* ---------- Status / badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.dot-pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  50% { box-shadow: 0 0 0 5px transparent; opacity: 0.7; }
}

/* ---------- Tabele ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.table tr:last-child td { border-bottom: none; }
.table td:first-child { color: var(--text); }

/* ---------- Listy plików ---------- */
.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.file-item:hover { border-color: var(--border-strong); background: var(--surface-2); }

.file-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.file-meta { flex: 1; min-width: 0; }
.file-name {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.93rem;
}
.file-sub { font-size: 0.78rem; color: var(--faint); }

.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 640px) {
  .file-item { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}

/* ---------- Dialog / modal ---------- */
dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #121216;
  color: var(--text);
  padding: 24px;
  max-width: min(560px, calc(100vw - 32px));
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
dialog.dialog-wide { max-width: min(960px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(4px); }

.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.dialog-close {
  background: none; border: none; color: var(--faint);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px;
  border-radius: 8px;
}
.dialog-close:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 17px; height: 17px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s, background .2s;
}
.switch input:checked + .slider { background: var(--accent-strong); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(19px); background: #fff; }

/* ---------- Toasty / progress ---------- */
.toast-wrap {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: #16161b;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  transition: opacity .3s;
}
.toast .toast-text { font-size: 0.86rem; margin-bottom: 8px; }
.toast .bar-track {
  height: 5px; border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.toast .bar-fill {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-strong), #a78bfa);
  transition: width .15s;
}

/* ---------- Terminal / pre ---------- */
.terminal {
  background: #0b0d0b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #86e58f;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
}

pre.preview-content {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-family: var(--mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ---------- Strona logowania ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 32px;
  backdrop-filter: blur(12px);
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 14px;
}
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(120,137,255,0.25); }

/* ---------- Statystyki ---------- */
.stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { font-size: 0.8rem; color: var(--faint); }

/* ---------- Media w modalach / shared ---------- */
.media-frame img, .media-frame video {
  max-width: 100%;
  max-height: 74vh;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}
.media-frame audio { width: 100%; }
.media-frame iframe {
  width: 100%; height: 420px; border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

/* ---------- Drobiazgi ---------- */
.spacer { flex: 1; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.center { text-align: center; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
