/* ================================================================
   style.css — ChangeGuard UI
   Clean developer-tool aesthetic: dark nav, light panels, sharp cards
   ================================================================ */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f4f5f7;
  --surface:     #ffffff;
  --surface-2:   #f8f9fb;
  --border:      #e1e4e8;
  --border-dark: #c8ccd0;
  --text:        #1c2128;
  --text-muted:  #57606a;
  --text-light:  #8b949e;
  --accent:      #1a73e8;
  --accent-dark: #1557b0;
  --accent-bg:   #e8f0fe;
  --nav-bg:      #0d1117;
  --nav-text:    #e6edf3;
  --nav-muted:   #8b949e;
  --green:       #1a7f37;
  --green-bg:    #dafbe1;
  --yellow:      #9a6700;
  --yellow-bg:   #fff8c5;
  --red:         #cf222e;
  --red-bg:      #ffebe9;
  --purple:      #6639ba;
  --purple-bg:   #fbefff;
  --teal:        #1b6f5e;
  --teal-bg:     #dcf9f0;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
  --font:        -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono:   "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html, body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  padding: 0 24px;
  height: 52px;
  border-bottom: 1px solid #30363d;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--nav-text);
  letter-spacing: -.3px;
}

.brand-tag {
  font-size: 12px;
  color: var(--nav-muted);
  padding-left: 12px;
  border-left: 1px solid #30363d;
}

.badge-demo {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #21262d;
  color: #f0883e;
  border: 1px solid #f0883e44;
  letter-spacing: .3px;
}

.badge-demo.live {
  color: #56d364;
  border-color: #56d36444;
}

/* ── Main layout ── */
.layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 0;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ── Panels ── */
.panel {
  overflow-y: auto;
  padding: 24px;
}

.panel-input {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-results {
  background: var(--bg);
}

/* ── Input sections ── */
.input-section { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.field-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.textarea {
  width: 100%;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
  background: var(--surface);
}

.textarea-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.text-input {
  width: 100%;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

/* ── Tabs ── */
.tab-group {
  display: flex;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.tab {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  border-right: 1px solid var(--border-dark);
}
.tab:last-child { border-right: none; }
.tab:hover { background: var(--border); color: var(--text); }
.tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Upload tab ── */
.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 26px 16px;
  border: 1.5px dashed var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-drop:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.upload-icon { font-size: 22px; color: var(--accent); }
.upload-title { font-size: 13px; font-weight: 600; color: var(--text); }
.upload-sub { font-size: 11px; color: var(--text-muted); }

/* ── Sample tab ── */
.sample-preview {
  background: var(--accent-bg);
  border: 1px solid #c5d8fb;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sample-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
}

.sample-desc {
  font-size: 12px;
  color: #2c5282;
  line-height: 1.5;
}

.btn-load-sample {
  margin-top: 4px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background .15s;
}
.btn-load-sample:hover { background: var(--accent-dark); }

/* ── Analyze button ── */
.btn-analyze {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(26,115,232,.3);
  letter-spacing: .2px;
}

.btn-analyze:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(26,115,232,.4);
}

.btn-analyze:active { transform: scale(.98); }

.btn-analyze:disabled {
  background: var(--border-dark);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-icon { font-size: 16px; }

/* ── Error box ── */
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--red-bg);
  border: 1px solid #ffc1c0;
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
}

.error-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 40px;
  gap: 12px;
}

.empty-icon {
  font-size: 52px;
  color: var(--border-dark);
  line-height: 1;
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}

/* ── Loading state ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
}

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

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

.loading-text  { font-size: 16px; font-weight: 600; color: var(--text); }
.loading-sub   { font-size: 13px; color: var(--text-muted); }

/* ── Results meta bar ── */
.results-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.meta-source {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
}

.meta-source.ai {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #b4efbf;
}

.meta-source.mock {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid #fcd34d;
}

.meta-divider { color: var(--border-dark); }

/* ── Cards grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Full-width: risks card spans both columns */
.card-risks { grid-column: 1 / -1; }

/* ── Individual result card ── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp .3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card:nth-child(2) { animation-delay: .05s; }
.result-card:nth-child(3) { animation-delay: .10s; }
.result-card:nth-child(4) { animation-delay: .15s; }
.result-card:nth-child(5) { animation-delay: .20s; }

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.card-icon  { font-size: 16px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }

.card-count {
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  padding: 0 7px;
}

/* Per-card accent colours */
.card-files  .card-header { border-top: 3px solid var(--accent); }
.card-files  .card-count  { background: var(--accent-bg); color: var(--accent); }

.card-deps   .card-header { border-top: 3px solid var(--purple); }
.card-deps   .card-count  { background: var(--purple-bg); color: var(--purple); }

.card-risks  .card-header { border-top: 3px solid var(--red); }
.card-risks  .card-count  { background: var(--red-bg); color: var(--red); }

.card-changes .card-header { border-top: 3px solid var(--teal); }
.card-changes .card-count  { background: var(--teal-bg); color: var(--teal); }

.card-tests  .card-header { border-top: 3px solid var(--green); }
.card-tests  .card-count  { background: var(--green-bg); color: var(--green); }

/* ── Card list items ── */
.card-list {
  list-style: none;
  padding: 10px 0;
}

.card-list li {
  padding: 8px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.card-list li:last-child { border-bottom: none; }

.card-list li::before {
  content: '›';
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.card-files  .card-list li::before { color: var(--accent); }
.card-deps   .card-list li::before { color: var(--purple); }
.card-risks  .card-list li::before { color: var(--red); }
.card-changes .card-list li::before { color: var(--teal); }
.card-tests  .card-list li::before { color: var(--green); }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive: narrow screens ── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    overflow: visible;
  }
  .panel { overflow: visible; }
  .panel-input { border-right: none; border-bottom: 1px solid var(--border); }
  .empty-state { height: 300px; }
  .loading-state { height: 300px; }
  .cards-grid { grid-template-columns: 1fr; }
  .card-risks { grid-column: auto; }
  .brand-tag { display: none; }
}
