/* Obsideo Test Drive -- v1 styles */

:root {
  --bg: #0a0a0f;
  --bg-surface: #12121a;
  --bg-panel: #16161f;
  --bg-hover: #1c1c28;
  --border: #2a2a3a;
  --border-focus: #4a4a6a;
  --text: #e0e0e8;
  --text-muted: #8888a0;
  --text-dim: #5a5a70;
  --accent: #6c8cff;
  --accent-hover: #8aa4ff;
  --green: #4ade80;
  --green-bg: #4ade8018;
  --yellow: #facc15;
  --yellow-bg: #facc1518;
  --red: #f87171;
  --red-bg: #f8717118;
  --blue: #60a5fa;
  --blue-bg: #60a5fa18;
  --radius: 6px;
  --radius-lg: 10px;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#session-timer {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-muted {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
}

.badge-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid var(--yellow);
}

.badge-red {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.badge-blue {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue);
}

/* ── Landing ─────────────────────────────────────────────────────────────── */

#landing {
  text-align: center;
  padding: 48px 0 0;
}

.tagline {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 28px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.operations-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--text-muted);
}

.beta-tag {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 24px;
}

.key-input-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.key-input-lg {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  width: auto;
}

.landing-help {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.landing-help a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landing-help a:hover {
  color: var(--accent-hover);
}

.legend-item strong {
  color: var(--text);
  font-weight: 500;
}

.legend-sep {
  color: var(--text-dim);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.btn-muted {
  background: var(--bg-surface);
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-muted:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--border);
}

.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── Network bar ─────────────────────────────────────────────────────────── */

.network-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  margin-top: 40px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.network-bar-bottom {
  margin-top: 24px;
}

.net-sep { color: var(--text-dim); }

/* ── Session bar ─────────────────────────────────────────────────────────── */

.session-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.session-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.session-sep { color: var(--text-dim); }

.label {
  color: var(--text-muted);
  font-size: 12px;
}

.session-info code, .api-key-code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-panel);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--accent);
}

.api-key-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.api-key-code {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.muted { color: var(--text-muted); font-size: 12px; }

/* ── Panels ──────────────────────────────────────────────────────────────── */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-title .muted {
  font-weight: 400;
}

/* ── Upload zone ─────────────────────────────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 12px;
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: #6c8cff08;
}

.upload-prompt {
  font-size: 14px;
  color: var(--text-muted);
}

.file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-label:hover {
  color: var(--accent-hover);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

#upload-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.key-input {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  width: 280px;
  outline: none;
  transition: border-color 0.15s;
}

.key-input:focus {
  border-color: var(--accent);
}

/* ── Progress ────────────────────────────────────────────────────────────── */

.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-bar-track {
  height: 6px;
  background: var(--bg-panel);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.result-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  text-align: left;
  padding: 8px 12px;
  background: var(--green-bg);
  border-radius: var(--radius);
}

/* ── Objects table ───────────────────────────────────────────────────────── */

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* Column widths */
table { table-layout: fixed; }
thead th:nth-child(1) { width: 30%; } /* Key */
thead th:nth-child(2) { width: 10%; } /* Size */
thead th:nth-child(3) { width: 14%; } /* Uploaded */
thead th:nth-child(4) { width: 14%; } /* Proof */
thead th:nth-child(5) { width: 32%; } /* Actions */

tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody tr:hover {
  background: var(--bg-hover);
}

.key-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}

.key-filename {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.actions-cell {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

/* ── Expanded detail row ─────────────────────────────────────────────────── */

.detail-row td {
  padding: 0 10px 10px 10px;
  border-bottom: 1px solid var(--border);
}

.detail-row:hover {
  background: transparent !important;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 16px;
  font-size: 12px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-radius: var(--radius);
}

.detail-item {
  display: flex;
  gap: 6px;
}

.detail-label {
  color: var(--text-dim);
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  word-break: break-all;
}

/* ── Object summary line ─────────────────────────────────────────────────── */

.objects-summary {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 10px;
  padding-right: 4px;
}

/* ── Delete confirmation ─────────────────────────────────────────────────── */

.confirm-delete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--red);
}

.confirm-delete .key-name {
  font-family: var(--font-mono);
  color: var(--text);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */

/* ── Mode toggle ─────────────────────────────────────────────────────────── */

.mode-toggle {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
}

.mode-tab {
  padding: 6px 18px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

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

.mode-tab-active {
  background: var(--accent);
  color: #fff;
}

.mode-tab-active:hover {
  color: #fff;
}

/* ── Code Mode ───────────────────────────────────────────────────────────── */

.code-panel {
  padding-bottom: 0;
}

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

.code-editor {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 500px;
  margin-top: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}

.code-editor:focus {
  border-color: var(--accent);
}

.output-panel {
  margin-top: 12px;
}

.code-output {
  min-height: 120px;
  max-height: 300px;
  overflow: auto;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

.code-output .log-info { color: var(--text); }
.code-output .log-success { color: var(--green); }
.code-output .log-error { color: var(--red); }
.code-output .log-muted { color: var(--text-dim); }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.error-text { color: var(--red); font-size: 13px; margin-top: 12px; }
