/* Advisor UI Theme v2.0.0 */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --warning: #f59e0b;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

#wizard-content {
  width: 100%;
  max-width: 800px;
}

/* Task Card */
.task-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Main App Header */
.wizard-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 80px;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}

.wizard-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.progress-container {
  flex: 1;
  max-width: 400px;
  margin: 0 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-align: center;
}

.task-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

/* Header Branding */
.brand-group {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand-parent {
  font-size: 0.75rem;
  color: var(--text-muted); /* Fix visibility on white bg */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  letter-spacing: 0.5px;
}

.brand-parent:hover {
  color: var(--primary);
}

.task-icon {
  font-size: 2rem;
  background: #eff6ff;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.task-title-group h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a; /* Dark text for visibility */
}

.task-desc {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

.task-meta {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-high { background: #fef2f2; color: #ef4444; }
.badge-medium { background: #fff7ed; color: #f97316; }
.badge-low { background: #f0fdf4; color: #16a34a; }

.task-content {
  padding: 2rem;
}

.task-footer {
  padding: 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Inputs */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Artifacts */
.artifact-preview {
  background: #1e293b;
  border-radius: 8px;
  overflow: hidden;
  color: #e2e8f0;
}

.artifact-header {
  padding: 0.75rem 1rem;
  background: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.artifact-type {
  font-family: monospace;
  text-transform: uppercase;
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Copy button in artifact header */
.artifact-header .btn-sm,
.artifact-header .btn-outline {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  background: #6366f1;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.artifact-header .btn-sm:hover,
.artifact-header .btn-outline:hover {
  background: #4f46e5;
}

.artifact-preview pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover { background: #f1f5f9; }

.btn-success {
  background: var(--success);
  color: white;
}

.completed {
  background: var(--success);
  color: white;
}

/* Decision */
.decision-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.decision-option {
  display: flex;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.decision-option.selected {
  border-color: var(--primary);
  background: #eff6ff;
}
.decision-option input {
  margin-right: 1rem;
}

/* Helper */
.generator-placeholder {
  text-align: center;
  padding: 3rem;
  background: #f8fafc;
  border: 2px dashed var(--border);
  border-radius: 8px;
}
.generator-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Blocked State */
.task-blocked {
  text-align: center;
  padding: 4rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.blocker-list {
  max-width: 400px;
  margin: 2rem auto;
  text-align: left;
}
.blocker-item {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =============================================
   WIZARD NAV - Improved Visibility
   ============================================= */

/* Nav Container */
.wizard-nav {
  background: #f8fafc;
}

/* Section buttons */
.wizard-nav__item button,
.wizard-nav__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155; /* Dark gray - high contrast */
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.wizard-nav__item button:hover,
.wizard-nav__link:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Active section */
.wizard-nav__item.is-active > button,
.wizard-nav__item.is-active > .wizard-nav__link {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

/* Completed section */
.wizard-nav__item.is-complete > button,
.wizard-nav__item.is-complete > .wizard-nav__link {
  color: #16a34a;
}

/* Nav icons */
.wizard-nav__icon {
  font-size: 1.1rem;
}

.wizard-nav__status {
  margin-left: auto;
  font-size: 0.875rem;
  opacity: 0.7;
}

.wizard-nav__progress {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 0.5rem;
}

/* Sub-tasks list */
.wizard-nav__tasks {
  list-style: none;
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 0;
}

.wizard-nav__tasks li {
  margin-bottom: 0.25rem;
}

.wizard-nav__tasks button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #475569;
  cursor: pointer;
  text-align: left;
}

.wizard-nav__tasks button:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.wizard-nav__tasks li.is-active button {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

.wizard-nav__tasks li.is-complete button {
  color: #16a34a;
}

.wizard-nav__tasks li.is-complete button span:first-child {
  color: #22c55e;
}

/* =============================================
   NEW SIDEBAR NAVIGATION - Tree Structure
   ============================================= */

.wizard-nav__list {
  padding: 0.5rem;
  margin: 0;
  list-style: none;
}

/* Section Container */
.nav-section {
  margin-bottom: 0.25rem;
}

/* Section Header */
.nav-section__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-section__header:hover {
  background: #e2e8f0;
}

.nav-section--active > .nav-section__header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.nav-section--active > .nav-section__header .nav-section__title,
.nav-section--active > .nav-section__header .nav-section__count {
  color: white;
}

.nav-section--complete > .nav-section__header {
  border-left: 3px solid #22c55e;
}

/* Section Icon */
.nav-section__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* Section Info (title + progress) */
.nav-section__info {
  flex: 1;
  min-width: 0;
}

.nav-section__title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Section Progress Bar */
.nav-section__progress-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.nav-section__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.nav-section--active .nav-section__progress-bar {
  background: rgba(255,255,255,0.3);
}

.nav-section--active .nav-section__progress-fill {
  background: white;
}

/* Section Count */
.nav-section__count {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  flex-shrink: 0;
}

/* Task List */
.nav-tasks {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem 1rem;
  position: relative;
}

/* Task Item */
.nav-task {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  padding: 0.25rem 0;
}

/* Tree Lines */
.nav-task__tree-line {
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #cbd5e1;
}

.nav-task__tree-line::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 1px;
  background: #cbd5e1;
}

.nav-task__tree-line--last {
  bottom: 50%;
}

/* Checkbox */
.nav-task__checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 1.25rem;
}

.nav-task__checkbox:hover {
  border-color: #6366f1;
  background: #eff6ff;
}

.nav-task__checkbox--checked {
  background: #22c55e;
  border-color: #22c55e;
}

.nav-task__checkbox--checked:hover {
  background: #16a34a;
  border-color: #16a34a;
}

/* Task Label */
.nav-task__label {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #475569;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.nav-task__label:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-task--active .nav-task__label {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

.nav-task--complete .nav-task__label {
  color: #64748b;
  text-decoration: line-through;
  text-decoration-color: #94a3b8;
}

/* =============================================
   GLOBAL SELECTION STYLE
   ============================================= */
::selection {
  background: var(--primary);
  color: white; /* Fix user reported visibility issue */
}

/* =============================================
   HELP MODAL STYLES
   ============================================= */

.btn--secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn--secondary:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.help-modal {
  border: none;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 0;
  max-width: 600px;
  width: 90%;
  background: #1e293b;
  color: #e2e8f0;
  /* Center the modal */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.help-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.help-modal__content {
  padding: 2rem;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}

.help-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: #334155; /* Darker btn bg */
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: all 0.15s;
}

.help-modal__close:hover {
  background: #475569;
  color: white;
}

.help-modal h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  color: white; /* Explicit white */
}

.help-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #334155; /* Darker border */
}

.help-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.help-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #e2e8f0; /* Light text */
}

.help-section p {
  margin: 0 0 0.5rem;
  color: #cbd5e1; /* Muted light text */
  line-height: 1.6;
}

.help-section ul,
.help-section ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: #cbd5e1;
}

.help-section li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}
