/* ─────────────────────────────────────────
   SynapseCore AI Dashboard — CSS
   Строгий чёрно-белый минимализм
───────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg:       #0a0a0a;
  --surface:  #111111;
  --surface2: #161616;
  --border:   #2a2a2a;
  --border2:  #333333;
  --text:     #f0f0f0;
  --muted:    #666666;
  --muted2:   #888888;
  --accent:   #ffffff;
  --error:    #ff4444;
  --success:  #44ff88;
  --warn:     #ffaa00;
}

/* ── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Menlo', monospace;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Layout ─────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
}

.app-logo span {
  color: var(--muted);
  font-weight: 400;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.btn-logout:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ── Tab bar ─────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  gap: 0;
  flex-shrink: 0;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 14px 24px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.tab:hover { color: var(--muted2); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab content ─────────────────────────── */
.tab-content {
  flex: 1;
  padding: 32px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane { display: none; }
.tab-pane.active { display: flex; flex-direction: column; gap: 20px; }

/* ── Section titles ──────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Upload zone ─────────────────────────── */
.upload-zone {
  border: 1px dashed var(--border2);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  user-select: none;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(255,255,255,0.02);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-icon {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--muted);
}

.upload-zone-label {
  font-size: 13px;
  color: var(--muted);
}

.upload-zone-label strong {
  color: var(--text);
}

/* ── Preview: single image ───────────────── */
.image-preview {
  position: relative;
  display: none;
  max-width: 320px;
}

.image-preview img {
  width: 100%;
  border: 1px solid var(--border);
  display: block;
}

.image-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.8);
  border: 1px solid var(--border2);
  color: var(--text);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Preview: grid (multi images) ───────── */
.grid-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.grid-preview-item {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

.grid-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-preview-item .num {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 0 4px #000;
}

/* ── Form controls ───────────────────────── */
.input,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

.input:focus,
textarea:focus {
  border-color: var(--border2);
}

.input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

/* ── Buttons ─────────────────────────────── */
.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 11px 28px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-outline {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 24px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-outline:hover { border-color: var(--muted); }
.btn-outline:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────── */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.loading .spinner { display: block; }
.btn.loading .btn-label { opacity: 0.6; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Result block ────────────────────────── */
.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 14px;
}

.result-block.visible { display: flex; }

.result-text {
  color: var(--text);
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
}

.result-image {
  max-width: 100%;
  border: 1px solid var(--border);
  display: block;
}

.result-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Error block ─────────────────────────── */
.error-block {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--error);
  padding: 12px 16px;
  font-size: 13px;
  display: none;
}

.error-block.visible { display: block; }

/* ── Progress bar ────────────────────────── */
.progress-wrap {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.progress-wrap.visible { display: flex; }

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.progress-track {
  height: 2px;
  background: var(--border);
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ── Log ─────────────────────────────────── */
.log-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  font-size: 12px;
  font-family: 'Menlo', 'Courier New', monospace;
  color: var(--muted2);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 3px;
}

.log-box.visible { display: flex; }

.log-line { line-height: 1.5; }
.log-line.info  { color: var(--muted2); }
.log-line.ok    { color: var(--success); }
.log-line.err   { color: var(--error); }

/* ── Row / cols ──────────────────────────── */
.row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.row > * { flex: 1; }

/* ── Two-column form fields ──────────────── */
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Login page ──────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 360px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
}

.login-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: -16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
}

.login-error {
  background: rgba(255,68,68,0.1);
  border: 1px solid rgba(255,68,68,0.3);
  color: var(--error);
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

/* ── Utility ─────────────────────────────── */
.hidden { display: none !important; }

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

.step-indicator {
  display: flex;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.step {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.step.active { color: var(--accent); }
.step.done   { color: var(--success); }

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
