/* Hangar Browser Companion — Sidebar Styles */

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

:root {
  --bg:          #f5f5f7;
  --bg-card:     #ffffff;
  --bg-bar:      rgba(255,255,255,0.85);
  --border:      rgba(0,0,0,0.10);
  --text:        #1d1d1f;
  --text-sec:    #6e6e73;
  --text-ter:    #aeaeb2;
  --accent:      #2F74F8;
  --accent-sec:  rgba(47,116,248,0.12);
  --green:       #34c759;
  --red:         #ff3b30;
  --radius:      8px;
  --radius-sm:   6px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #1c1c1e;
    --bg-card:  #2c2c2e;
    --bg-bar:   rgba(28,28,30,0.90);
    --border:   rgba(255,255,255,0.10);
    --text:     #f5f5f7;
    --text-sec: #8e8e93;
    --text-ter: #48484a;
  }
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-bar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
}

#section-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-sec);
  flex-shrink: 0;
}

#status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-ter);
  transition: background 0.3s;
}
#status-dot.connected { background: var(--green); }

/* ── Capture Row ────────────────────────────────────────────────────── */
#capture-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#capture-buttons {
  display: flex;
  gap: 6px;
}

.capture-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.capture-btn:hover { background: var(--accent-sec); color: var(--accent); }
.capture-btn:active { opacity: 0.7; }

/* ── Section labels ─────────────────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-sec);
}

.divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Credentials ────────────────────────────────────────────────────── */
#credentials-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  flex-shrink: 0;
}

.fill-all-btn {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}
.fill-all-btn:hover { background: var(--accent-sec); }
.fill-all-btn:disabled { opacity: 0.4; cursor: default; }

#credentials-list {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex-shrink: 0;
}

.credential-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.credential-info {
  flex: 1;
  overflow: hidden;
}

.credential-label {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.credential-value {
  color: var(--text-sec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  margin-top: 1px;
  cursor: pointer;
}

.credential-label.success,
.credential-value.success {
  color: var(--green);
}

.credential-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.icon-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-sec);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--accent-sec); color: var(--accent); }
.icon-btn.fill-btn:hover { color: var(--accent); }
.icon-btn.success { color: var(--green) !important; }

/* ── Checklists ─────────────────────────────────────────────────────── */
#checklists-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#checklists-header {
  padding: 7px 12px;
  flex-shrink: 0;
}

#checklists-list {
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.checklist-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.checklist-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
}
.checklist-card-header:hover { background: var(--accent-sec); }

.checklist-chevron {
  color: var(--text-ter);
  font-size: 9px;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.checklist-chevron.collapsed { transform: rotate(-90deg); }

.checklist-title {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-count {
  font-size: 10px;
  color: var(--text-sec);
  background: var(--border);
  padding: 1px 5px;
  border-radius: 10px;
  flex-shrink: 0;
}

.checklist-entries {
  border-top: 1px solid var(--border);
}

.checklist-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.checklist-entry:not(:last-child) { border-bottom: 1px solid var(--border); }
.checklist-entry:hover { background: var(--accent-sec); }

.entry-checkbox {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--text-ter);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.entry-checkbox.checked {
  background: var(--green);
  border-color: var(--green);
}
.entry-checkbox.checked::after {
  content: '';
  width: 7px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.entry-label {
  flex: 1;
  transition: color 0.15s;
}
.entry-label.checked {
  color: var(--text-sec);
  text-decoration: line-through;
}

/* ── Empty / connecting states ──────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  color: var(--text-ter);
  font-size: 11px;
  text-align: center;
}

.connecting-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--text-sec);
  font-size: 11px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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