/* ============ EaseBridge UI ============ */

:root {
  --bg: #05060a;
  --bg-elev: #0c0e17;
  --bg-glass: rgba(14, 17, 28, 0.55);
  --bg-input: #151826;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(120, 160, 255, 0.35);
  --text: #f0f3fa;
  --text-dim: #9099b3;
  --text-muted: #5a6280;
  --accent: #5b93ff;
  --accent2: #a26bff;
  --grad: linear-gradient(135deg, #5b93ff 0%, #a26bff 100%);
  --grad-soft: linear-gradient(135deg, rgba(91,147,255,0.15) 0%, rgba(162,107,255,0.15) 100%);
  --red: #ff6b6b;
  --green: #4ae08b;
  --orange: #ffa25c;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

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

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 15% -10%, rgba(91, 147, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 15%, rgba(162, 107, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 600px 400px at 50% 105%, rgba(61, 219, 255, 0.10), transparent 60%);
}

/* ── Login ───────────────────────────── */
.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px 32px;
  text-align: center;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-icon {
  font-size: 60px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 30px rgba(91, 147, 255, 0.5));
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card input {
  width: 100%;
  height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}

.login-card input:focus { border-color: var(--accent); }
.login-card input::placeholder { color: var(--text-muted); }

.login-status {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

.login-hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 16px;
  font-family: var(--mono);
}

/* ── Bridge screen ───────────────────── */
.bridge-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.bridge-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { font-size: 28px; filter: drop-shadow(0 0 12px rgba(91, 147, 255, 0.5)); }
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-status { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }

.bridge-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.card-head { margin-bottom: 12px; }

.micro {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#bridgeInput {
  width: 100%;
  min-height: 240px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.55;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s;
}
#bridgeInput:focus { border-color: var(--border-accent); }
#bridgeInput::placeholder { color: var(--text-muted); }

.actions { display: flex; gap: 8px; margin-top: 12px; }

.btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.btn.primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 24px rgba(91, 147, 255, 0.35);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 32px rgba(91, 147, 255, 0.5); }

.btn.ghost {
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn.ghost:hover { border-color: var(--border-strong); color: var(--text); }

.status {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
  min-height: 18px;
}

#history { margin-top: 16px; }

.hist-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hist-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s var(--ease);
}
.hist-chip:hover { border-color: var(--border-strong); color: var(--text); transform: translateX(2px); }
.hist-chip .mark { font-size: 13px; }
.hist-chip .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; min-width: 0; }
.hist-chip .ago { font-size: 10px; opacity: 0.7; }

.step {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 10px;
  backdrop-filter: blur(20px);
}

.step-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.step-title { font-weight: 600; font-size: 13px; }
.step-time { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.step-summary { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.step-output {
  background: var(--bg-input);
  padding: 10px;
  border-radius: 8px;
  font-size: 11px;
  font-family: var(--mono);
  max-height: 340px;
  overflow: auto;
  margin-top: 8px;
  white-space: pre-wrap;
  color: var(--text);
}
.step-error { color: var(--red); font-size: 12px; margin-top: 6px; }

/* ── Post-actions (галки под кнопками) ─── */
.post-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.toggle input[type="checkbox"] { display: none; }

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.25);
  border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.25s var(--ease);
}

.toggle input:checked + .toggle-track {
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 0 12px rgba(91, 147, 255, 0.5);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  left: 17px;
  background: #fff;
}

.toggle-label {
  font-size: 13px;
  color: var(--text-dim);
  transition: color 0.2s;
}

.toggle input:checked ~ .toggle-label { color: var(--text); }

.opt-message {
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  margin-top: 4px;
  transition: border-color 0.2s;
}

.opt-message:focus { border-color: var(--border-accent); }
.opt-message::placeholder { color: var(--text-muted); }

.report-block textarea {
  width: 100%;
  min-height: 200px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  outline: none;
  margin-top: 8px;
  resize: vertical;
}

@media (max-width: 720px) {
  .bridge-content { padding: 16px 12px 60px; }
  .card { padding: 16px; border-radius: 16px; }
  #bridgeInput { min-height: 180px; font-size: 11px; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 calc(50% - 4px); }
  .actions #runBtn { flex: 1 1 100%; }
  .topbar-status { font-size: 10px; }
}
