/* ═══════════════════════════════════════════
   Germ Shell — is.germinating.ai
   ═══════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────── */

:root {
  --bg: #f7f6f2;
  --bg-gradient: radial-gradient(ellipse at top right, #e4f0e8, #f7f6f2 70%);
  --surface: #ffffff;
  --surface-hover: #fafcfb;
  --border: #e2e8e4;
  --border-light: #eef2ef;
  --accent: #2a7f62;
  --accent-hover: #237052;
  --accent-soft: #e6f3ec;
  --accent-text: #1d6a50;
  --text: #1a2520;
  --text-secondary: #516b5f;
  --text-muted: #8a9b93;
  --text-on-accent: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(25, 50, 38, 0.06);
  --shadow: 0 4px 12px rgba(25, 50, 38, 0.08);
  --shadow-lg: 0 8px 24px rgba(25, 50, 38, 0.1);
  --transition: 150ms ease;
  --success: #2a7f62;
  --warning: #c4842d;
  --neutral: #b8c5be;
}

/* ── Reset ───────────────────────────────── */

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

/* ── Base ────────────────────────────────── */

body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.console {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ── Connect Overlay ─────────────────────── */

.connect-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(17, 31, 24, 0.6);
  backdrop-filter: blur(3px);
}

.connect-overlay.is-hidden {
  display: none;
}

.connect-overlay-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.2rem;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.overlay-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

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

.header {
  margin-bottom: 2rem;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.header-controls {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: default;
}

.profile-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.profile-name {
  max-width: 10.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-caret {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.profile-chip:disabled {
  opacity: 1;
  filter: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sprout {
  font-size: 2.4rem;
  font-weight: bold;
  color: var(--accent);
  line-height: 1;
  display: inline-block;
  transform-origin: 50% 100%;
  animation: sway 3s ease-in-out infinite;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.connection-state {
  margin-bottom: 1rem;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-light);
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.connection-state-connected {
  color: #1f6c4e;
  background: #edf7f1;
  border-color: #cce5d7;
}

.connection-state-pending {
  color: #8f5f18;
  background: #fbf4e8;
  border-color: #e9d5ad;
}

.connection-state-error {
  color: #7e2d2d;
  background: #fbecec;
  border-color: #ebc5c5;
}

.connection-state-neutral {
  color: var(--text-secondary);
}

/* ── Cards ───────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card + .card {
  margin-top: 1.25rem;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(to bottom, #fafcfb, var(--surface));
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.card-body {
  padding: 1.25rem;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* ── Status Dot ──────────────────────────── */

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neutral);
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(42, 127, 98, 0.2);
}

.status-dot.pending {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.disconnected {
  background: #b24a4a;
  box-shadow: 0 0 0 3px rgba(178, 74, 74, 0.18);
}

/* ── Auth State Visibility ───────────────── */

.auth-show-idle,
.auth-show-checking,
.auth-show-pending,
.auth-show-connected {
  display: none;
}

#connectOverlayCard[data-auth-state="checking"] .auth-show-checking {
  display: block;
}

#connectOverlayCard[data-auth-state="idle"] .auth-show-idle {
  display: block;
}

#connectOverlayCard[data-auth-state="pending"] .auth-show-pending {
  display: block;
}

#connectOverlayCard[data-auth-state="connected"] .auth-show-connected {
  display: block;
}

#connectOverlayCard[data-auth-state="connected"] .auth-hide-connected {
  display: none;
}

/* ── Auth Flow ───────────────────────────── */

.auth-connected-msg {
  color: var(--success);
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-flow {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  background: var(--surface-hover);
  margin-top: 1rem;
}

.auth-instruction {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.auth-link-row {
  margin-bottom: 0.75rem;
}

.auth-link {
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: none;
  word-break: break-all;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-code-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.auth-code-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.auth-code-row code {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.auth-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.auth-privacy {
  color: var(--text-secondary);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 0;
  background: var(--accent);
  color: var(--text-on-accent);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

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

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

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

.btn-sm {
  padding: 0.2rem 0.5rem;
  font-size: 0.76rem;
}

.btn-lg {
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #35946f);
  box-shadow: 0 2px 8px rgba(42, 127, 98, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #2a8562);
  box-shadow: 0 4px 16px rgba(42, 127, 98, 0.3);
}

.actions {
  margin-top: 1.25rem;
}

.step-note {
  margin-top: 0.55rem;
  color: var(--text-muted);
  font-size: 0.84rem;
}

/* ── Form Fields ─────────────────────────── */

.field-group {
  margin-bottom: 0.85rem;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.field-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 127, 98, 0.12);
}

.field-input::placeholder {
  color: var(--text-muted);
}

.field-textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.5;
}

.field-input-wrap {
  position: relative;
}

.field-input-germ {
  padding-right: 16.5rem;
}

.inline-url-preview {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.76rem;
  color: var(--text-muted);
  max-width: 15.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

/* ── Germ URL ───────────────────────────── */

.germ-identity {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.germ-url {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

.germ-url a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  word-break: break-all;
}

.germ-url a:hover {
  text-decoration: underline;
}

.germ-list {
  display: grid;
  gap: 0.55rem;
}

.germ-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  background: var(--surface-hover);
}

.germ-row.is-active {
  border-color: #bcd8cb;
  background: #f3faf6;
}

.germ-meta {
  min-width: 0;
}

.germ-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.germ-meta a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  word-break: break-all;
}

.germ-meta a:hover {
  text-decoration: underline;
}

.germ-open-btn {
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ── Footer ──────────────────────────────── */

.footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* ── Animations ──────────────────────────── */

@keyframes sway {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 720px) {
  .console {
    padding: 1.25rem 1rem;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-controls {
    width: 100%;
    align-items: flex-start;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .header {
    margin-bottom: 1.5rem;
  }

  .btn-lg {
    width: 100%;
  }

  .field-input-germ {
    padding-right: 0.75rem;
  }

  .inline-url-preview {
    position: static;
    display: block;
    margin-top: 0.35rem;
    transform: none;
    max-width: none;
  }
}
