/* Loomigrate Console - shared design system.
   Palette/typography now match loomigrate.com's marketing site (Adam:
   "styl mi się podoba, możesz to przenieść na panel?") - IBM Plex Sans/
   Mono, green gradient accent, same light/dark/explicit-dark token
   structure as marketing/public/style.css. Semantic status colors
   (success/error/warning) are unchanged from the console's original
   palette - only the BRAND identity (bg/surface/border/text/accent) and
   typography moved, so this stays a recognizable evolution of the same
   design system, not a rebuild. */

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

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-alt: #f1f6f3;
  --border: #dde6e0;
  --text: #0e1a16;
  --text-muted: #4b5b54;
  --accent: #0f7a4d;
  --accent-bright: #34d399;
  --accent-hover: #0b5c39;
  --accent-contrast: #ffffff;
  --success: #2e7d4f;
  --success-bg: #e5f3ea;
  --error: #c0392b;
  --error-bg: #fbe9e7;
  --warning: #b7791f;
  --warning-bg: #fbf1de;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(14, 26, 22, 0.06), 0 4px 12px rgba(14, 26, 22, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1310;
    --surface: #111c17;
    --surface-alt: #152019;
    --border: #22322b;
    --text: #eaf3ee;
    --text-muted: #9fb3a9;
    --accent: #34d399;
    --accent-bright: #5ee6b5;
    --accent-hover: #5ee6b5;
    --accent-contrast: #04150e;
    --success: #4caf7d;
    --success-bg: #14261d;
    --error: #e5695b;
    --error-bg: #2b1917;
    --warning: #e0a94d;
    --warning-bg: #2a2115;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #0b1310;
  --surface: #111c17;
  --surface-alt: #152019;
  --border: #22322b;
  --text: #eaf3ee;
  --text-muted: #9fb3a9;
  --accent: #34d399;
  --accent-bright: #5ee6b5;
  --accent-hover: #5ee6b5;
  --accent-contrast: #04150e;
  --success: #4caf7d;
  --success-bg: #14261d;
  --error: #e5695b;
  --error-bg: #2b1917;
  --warning: #e0a94d;
  --warning-bg: #2a2115;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, .mono {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  border-color: transparent;
  color: var(--accent-contrast);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-bright), var(--accent-hover)); border-color: transparent; }

.btn-danger { color: var(--error); }
.btn-danger:hover { border-color: var(--error); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field .field-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field .radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.field .radio-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.field .radio-row input { padding: 0; width: auto; }
.field input, .field select, .field textarea {
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field input:disabled, .field input:read-only {
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}
.field-checkbox { flex-direction: row; align-items: flex-start; gap: 8px; }
.field-checkbox input { margin-top: 3px; }
.field-checkbox label { color: var(--text); font-weight: 400; }
.field-hint { font-size: 12px; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.help-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 20px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.help-toc a { color: var(--text-muted); font-size: 13px; padding: 4px 0; text-decoration: none; }
.help-toc a:hover { color: var(--accent); }
.help-content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.help-content section h2 { font-size: 16px; }
.help-content section code { background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 12px; }
.help-content section ol, .help-content section ul { padding-left: 20px; }
.help-content section li { margin-bottom: 6px; }
@media (max-width: 760px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-card .subtitle { color: var(--text-muted); margin: 0 0 24px; font-size: 13px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.auth-error {
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.auth-error.auth-success { background: var(--success-bg); color: var(--success); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  /* Without this, the sidebar stretches to match .main's content height on
     a long page (help.html, a big project list, etc), pushing the footer
     (contact/language/theme/logout) far below the viewport instead of
     staying visible - position:sticky + a real height pins it to the
     viewport regardless of how tall the main content gets. */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  padding: 0 10px 20px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: var(--text);
  padding: 9px 10px;
  border-radius: var(--radius);
  font-size: 14px;
}
.sidebar nav a:hover { background: var(--surface-alt); text-decoration: none; }
.sidebar nav a.active { background: var(--surface-alt); color: var(--accent); font-weight: 600; }
.sidebar .footer { display: flex; flex-direction: column; gap: 8px; }

.main { flex: 1; padding: 28px 36px; max-width: 1500px; overflow-x: auto; }
.main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.main-header h1 { font-size: 20px; margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 11px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-alt); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-error { background: var(--error-bg); color: var(--error); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-neutral { background: var(--surface-alt); color: var(--text-muted); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

.warn-icon, .info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: help;
  vertical-align: middle;
  white-space: normal;
}
.warn-icon { background: var(--warning); }
.info-icon { background: var(--text-muted); }
.info-icon.info-icon-warn { background: var(--warning); }

/* Source/dest side-by-side popover (folder breakdown) - a plain title=""
   tooltip can't lay out two columns. position:fixed + JS-computed
   coordinates (see makeInfoIcon() in project.html/wizard.html) rather than
   a CSS-only :hover popover, since the icons live inside .table-wrap
   (overflow-x:auto, which forces overflow-y:auto too) and an absolutely
   positioned popover nested in there would get clipped/scrolled away. */
.info-popover-fixed {
  display: none;
  position: fixed;
  z-index: 100;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  padding: 10px 14px;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  white-space: nowrap;
  pointer-events: none;
}
.info-popover-col strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.info-popover-col pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: pre;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 21, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal h2 { margin-top: 0; font-size: 17px; }

.progress-bar { height: 6px; border-radius: 3px; background: var(--surface-alt); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.progress-bar-fill.indeterminate { width: 40%; animation: indeterminate 1.2s infinite ease-in-out; }
@keyframes indeterminate {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .progress-bar-fill { transition: none; }
  .progress-bar-fill.indeterminate { animation: none; }
}

/* Wizard: choice of migration mode (full / free test / check only) */
.mode-options { display: grid; gap: 8px; }
.mode-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: 14px; color: var(--text); }
.mode-option:has(input:checked) { border-color: var(--accent); }
.mode-option input { width: auto; margin-top: 3px; padding: 0; }
.mode-option b { display: block; font-weight: 600; }
.mode-option small { display: block; color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

/* Analytics consent banner (js/analytics.js) */
#lm-consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 520px; margin: 0 auto; z-index: 1000;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
#lm-consent p { margin: 0 0 12px; font-size: 13px; color: var(--text-muted); }
#lm-consent .flex-row { gap: 8px; flex-wrap: wrap; }
