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

:root {
  --font: 'IBM Plex Sans', Arial, sans-serif;
  --bg: #ffffff;
  --surface: #f7f7f7;
  --surface-2: #eeeeee;
  --border: #d8d8d8;
  --border-light: #e8e8e8;
  --text: #111111;
  --text-muted: #888888;
  --text-label: #444444;
  --topbar-bg: #eeeeee;
  --topbar-height: 52px;
  --sidebar-width: 200px;
  --blue: #1d4ed8;
  --blue-bg: #eff6ff;
  --red: #b91c1c;
  --red-bg: #fff5f5;
  --sidebar-odd: #f9f9f9;
  --sidebar-even: #f4f4f4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 23px;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Top bar ─────────────────────────────────────── */

.top-bar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.top-bar-title { flex: 1; min-width: 0; }

.ab-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  text-decoration: none;
  flex-shrink: 0;
}
.ab-toggle:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

#logo {
  height: 34px;
  width: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

#logo:not([src]),
#logo[src=""] {
  display: none;
}

.top-bar-title .atlas-name {
  display: block;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.2;
}

.top-bar-title .console-type {
  display: block;
  font-size: 17px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Layout ──────────────────────────────────────── */

.console-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--topbar-height));
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────── */

.sidebar {
  border-right: 1px solid var(--border);
  text-align: right;
}

.sidebar-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:nth-child(odd) {
  background: var(--sidebar-odd);
}

.sidebar-section:nth-child(even) {
  background: var(--sidebar-even);
}

.sidebar-section h2 {
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-label);
  margin: 0 0 10px 0;
}

.sidebar-section h3 {
  font-size: 17px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 10px 0 5px 0;
}

.sidebar-section li {
  margin-bottom: 5px;
  font-size: 21px;
}

/* ── Main content ────────────────────────────────── */

.main-content {
  padding: 16px 22px;
}

.main-content > h2 {
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-label);
  margin: 0 0 12px 0;
}

/* ── Layers list ─────────────────────────────────── */

#layers-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px;
}

#layers-list li > a:first-child {
  font-weight: 500;
  font-size: 21px;
  margin-right: 6px;
}

.action-mutate {
  color: var(--blue);
  font-size: 20px;
}

.action-destructive {
  color: var(--red);
  font-size: 20px;
}

/* ── Use cases ───────────────────────────────────── */

#usecases-list {
  margin-top: 18px;
}

#usecases-list > li {
  margin-bottom: 10px;
  font-weight: 500;
  font-size: 21px;
}

#usecases-list > li > ul {
  margin-top: 4px;
  font-weight: 400;
}

#usecases-list > li > ul li {
  margin-bottom: 4px;
  font-size: 21px;
}

/* ── Version controls ────────────────────────────── */

.version-string {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.version-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  margin-bottom: 8px;
}

.btn {
  font-family: var(--font);
  font-size: 20px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

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

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

.btn-destructive {
  border-color: #fca5a5;
  background: var(--red-bg);
  color: var(--red);
}

.btn-destructive:hover {
  background: #fee2e2;
}

#publish-status {
  font-size: 18px;
  color: var(--text-muted);
  text-align: right;
  padding: 4px 0;
  min-height: 18px;
}

#versions-list li {
  margin-bottom: 4px;
  font-size: 20px;
}

.current-version {
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-bg);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Embedded asset iframes (public console) ─────── */

#webmap-embed {
  display: none;
}

.embed-iframe {
  width: 100%;
  border: none;
  display: block;
}

.webmap-iframe {
  height: calc(100vh - var(--topbar-height));
}

/* When webmap is present, main content fills the viewport and has no padding */
.main-content.has-webmap {
  padding: 0;
  overflow-y: auto;
}

/* ── Help popup (scoped — shared with webmap) ────── */

.help-popup {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.help-popup .help-content {
  background: white;
  border-radius: 6px;
  max-width: 520px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.help-popup .help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
}

.help-popup .help-header h2 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  font-size: 33px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  color: var(--text);
}

.help-popup .help-body {
  padding: 18px 20px;
  font-size: 21px;
  line-height: 1.6;
}

.help-popup .help-body ul {
  padding-left: 18px;
  list-style: disc;
}

.help-popup .help-body li {
  margin-bottom: 8px;
}

/* ── Standalone help page ────────────────────────── */

.help-page-header {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 23px;
  font-weight: 600;
}

.help-page-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 24px;
  line-height: 1.7;
  font-size: 23px;
  text-align: left;
}

.help-page-content h1 {
  font-size: 1.4em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 16px;
}

.help-page-content h2 {
  font-size: 1.1em;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 10px;
  color: var(--text-label);
}

.help-page-content h3,
.help-page-content h4 {
  font-weight: 600;
  margin-top: 18px;
  margin-bottom: 8px;
}

.help-page-content p {
  margin-bottom: 12px;
}

.help-page-content ul,
.help-page-content ol {
  padding-left: 20px;
  list-style: none;
  margin-bottom: 12px;
}

.help-page-content li {
  margin-bottom: 6px;
}

.help-page-content code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.help-page-content pre {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 14px;
  overflow-x: auto;
  margin-bottom: 14px;
}

.help-page-content blockquote {
  border-left: 3px solid var(--border);
  margin: 16px 0;
  padding-left: 16px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Shared component styles (used by other pages) ─ */

.button {
  font-family: var(--font);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  margin: 2px;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-block;
  font-size: 20px;
}

.button:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.link-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.link-button:hover {
  background: var(--surface-2);
}

.warning-button {
  padding: 10px;
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  border-radius: 4px;
  cursor: pointer;
  flex: 1;
  font-family: var(--font);
}

.warning-button:hover {
  background: #fee2e2;
}

.input-field {
  width: 100%;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 5px;
  font-family: var(--font);
  font-size: 21px;
}

.progress-bar {
  width: 100%;
  height: 18px;
  background: var(--surface);
  border-radius: 3px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: #3b82f6;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 18px;
  color: var(--text);
  font-size: 18px;
}

.error-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--red);
  color: white;
  padding: 20px;
  border-radius: 6px;
  z-index: 2000;
  font-family: var(--font);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  text-align: center;
}

.success-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #16a34a;
  color: white;
  padding: 10px 15px;
  border-radius: 4px;
  z-index: 1000;
  font-family: var(--font);
  font-size: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#help-link {
  font-weight: 600;
  font-size: 1.1em;
  color: var(--blue);
}

#help-link:hover {
  text-decoration: underline;
}
