/* ── feedbackloop Design System ── */
:root {
  color-scheme: light;
  --page: #f7f7f5;
  --nav: rgba(251, 251, 250, 0.94);
  --surface: #ffffff;
  --surface-muted: #f7f7f5;
  --border-soft: #e7e7e4;
  --text-main: #171717;
  --text-muted: #6b6b66;
  --text-soft: #3f3f3c;
  --button: #171717;
  --button-text: #ffffff;
  --accent: #3fa836;
  --accent-hover: #2f8c28;
  --accent-muted: rgba(63, 168, 54, 0.10);
  --accent-border: rgba(63, 168, 54, 0.35);
  --accent-soft: rgba(63, 168, 54, 0.08);
  --success: #2f8c28;
  --danger: #b42318;
  --danger-muted: rgba(180, 35, 24, 0.08);
  --danger-border: rgba(180, 35, 24, 0.28);
  --warning: #b7791f;
}

.dark {
  color-scheme: dark;
  --page: #212121;
  --nav: rgba(26, 26, 26, 0.98);
  --surface: #2f2f2f;
  --surface-muted: #262626;
  --border-soft: #3a3a3a;
  --text-main: #f5f5f5;
  --text-muted: #b4b4b0;
  --text-soft: #d6d6d2;
  --button: #f5f5f5;
  --button-text: #171717;
  --accent: #96D38D;
  --accent-hover: #7bc270;
  --accent-muted: rgba(150, 211, 141, 0.12);
  --accent-border: rgba(150, 211, 141, 0.40);
  --accent-soft: rgba(150, 211, 141, 0.10);
  --success: #96D38D;
  --danger: #fca5a5;
  --danger-muted: rgba(252, 165, 165, 0.08);
  --danger-border: rgba(252, 165, 165, 0.24);
  --warning: #fbbf24;
}

/* ── Reset & Base ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(128,128,128,0.3) transparent;
}

html::-webkit-scrollbar {
  width: 5px;
}

html::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb {
  background: rgba(128,128,128,0.3);
  border-radius: 10px;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 160ms ease, color 160ms ease;
}

/* ── Typography ─ */
.section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 2rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.accent-text {
  color: var(--accent);
}

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

/* ── Navigation ── */
.nav-shell {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  background: var(--nav);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-bar {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  gap: 1rem;
}

.brand-link {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  font-weight: 500;
}

.brand-inf {
  color: var(--accent);
  font-weight: inherit;
}

.brand-oo {
  letter-spacing: -0.14em;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  min-height: 2.25rem;
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.15;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.nav-btn i {
  width: 1rem;
  font-size: 0.875rem;
  text-align: center;
}

.nav-btn:hover,
.nav-btn.is-active {
  color: var(--text-main);
  background: var(--surface-muted);
  border-color: var(--border-soft);
}

.nav-btn.is-active {
  color: var(--accent);
}

/* ── Theme Toggle ── */
.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

#themeIcon {
  transition: opacity 120ms ease, transform 120ms ease;
}

.theme-button:hover {
  background: var(--surface-muted);
  color: var(--text-main);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  max-width: 64rem;
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 1rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr 22rem;
  }
  
  .nav-links {
    display: flex;
  }
}

/* ── Panel ── */
.panel {
  background-color: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dark .panel {
  box-shadow: none;
}

.muted-panel {
  background-color: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
}

/* ── Preview Area ── */
.preview-area {
  padding: 2rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.svg-container {
  width: 100%;
  max-width: 32rem;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15));
}

.svg-container svg {
  width: 100%;
  height: auto;
}

/* ── SVG Zone Effects ── */
.dock-zone {
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s;
}

.dock-zone:hover {
  opacity: 0.85;
}

.dock-zone.active {
  filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 16px var(--accent));
  opacity: 1;
}

/* ── Active Zone Display ── */
.active-zone-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.5rem 0.875rem;
  border-radius: 1.25rem;
  border: 1px solid var(--border-soft);
  font-size: 0.75rem;
  margin-top: 1.5rem;
}

.zone-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.zone-value {
  color: var(--text-main);
  font-weight: 600;
}

.zone-color-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
}

.preview-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Config Panel ── */
.config-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-section {
  padding: 1.25rem;
}

.config-section .section-label {
  margin-bottom: 0.75rem;
  display: block;
}

/* ── Form Elements ── */
.field {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-family: inherit;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

select.field {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  appearance: none;
  -webkit-appearance: none;
}

.dark select.field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  margin-bottom: 0.375rem;
}

.required-mark {
  color: var(--danger);
  font-weight: 700;
}

.dark .required-mark {
  color: #fca5a5;
}

/* ── Feature Toggle ── */
.feature-toggle {
  display: flex;
  gap: 0.5rem;
}

.toggle-option {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-soft);
  transition: all 140ms ease;
}

.toggle-option:hover {
  background: var(--surface-muted);
  color: var(--text-main);
}

.toggle-option.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.toggle-option.inactive {
  opacity: 0.5;
}

/* ── Color Zones ── */
.color-zones {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-zone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 140ms ease;
  border: 1px solid transparent;
}

.color-zone-row:hover {
  background: var(--surface-muted);
}

.color-zone-row.active {
  background: var(--surface-muted);
  border-color: var(--accent-border);
}

.zone-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-soft);
}

.zone-color-preview {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  cursor: pointer;
  transition: transform 140ms ease;
}

.zone-color-preview:hover {
  transform: scale(1.1);
}

/* ── Color Palette ── */
.color-palette {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}

.color-palette.visible {
  display: flex;
}

.color-swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 140ms ease;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: var(--text-main);
}

.color-swatch[data-color="Ivory White"] { background: #F5F1E8; }
.color-swatch[data-color="Lemon Yellow"] { background: #F4E04D; }
.color-swatch[data-color="Mandarin Orange"] { background: #F4A261; }
.color-swatch[data-color="Sakura Pink"] { background: #F4B4C4; }
.color-swatch[data-color="Lilac Purple"] { background: #B8A9C9; }
.color-swatch[data-color="Scarlet Red"] { background: #C23B22; }
.color-swatch[data-color="Dark Red"] { background: #8B2500; }
.color-swatch[data-color="Grass Green"] { background: #5B8C5A; }
.color-swatch[data-color="Dark Green"] { background: #2D5016; }
.color-swatch[data-color="Ice Blue"] { background: #A8D8EA; }
.color-swatch[data-color="Marine Blue"] { background: #1E6091; }
.color-swatch[data-color="Dark Blue"] { background: #1B3A5C; }
.color-swatch[data-color="Desert Tan"] { background: #C4A882; }
.color-swatch[data-color="Latte Brown"] { background: #8B6F47; }
.color-swatch[data-color="Dark Brown"] { background: #4A3728; }
.color-swatch[data-color="Ash Grey"] { background: #9CA3AF; }
.color-swatch[data-color="Charcoal"] { background: #36454F; }

/* ── Colorways Grid ── */
.colorways-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.colorway-item {
  aspect-ratio: 1;
  border-radius: 0.5rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border-soft);
  transition: all 140ms ease;
}

.colorway-item:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

.colorway-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.colorway-preview {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.colorway-body {
  flex: 2;
}

.colorway-grill {
  flex: 1;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.colorway-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.25rem;
  font-size: 0.5625rem;
  font-weight: 600;
  text-align: center;
  background: rgba(0,0,0,0.7);
  color: white;
  letter-spacing: 0.02em;
}

/* ── Buttons ── */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.primary-button,
.primary-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--button);
  border: 1px solid var(--button);
  border-radius: 0.5rem;
  color: var(--button-text);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.625rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.primary-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.dark .primary-button:hover {
  color: #171717;
}

.secondary-button,
.secondary-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: transparent;
  border: 1px solid var(--text-main);
  border-radius: 0.5rem;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.625rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background-color 140ms ease, border-color 140ms ease;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.secondary-button:hover {
  background: var(--surface-muted);
  border-color: var(--text-soft);
}

.primary-button *,
.secondary-button * {
  color: inherit;
}

/* ── Modal ─ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 2rem;
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.config-summary {
  padding: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.summary-label {
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions .primary-button,
.modal-actions .secondary-button {
  flex: 1;
}

.success-message {
  display: none;
  text-align: center;
  padding: 2.5rem 0;
}

.success-message.visible {
  display: block;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--success);
}

/* ── Footer ── */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border-soft);
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  background: var(--nav);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-sep {
  color: var(--border-soft);
  font-weight: 300;
}

.soft-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 140ms ease;
}

.soft-link:hover {
  color: var(--text-main);
}

.opacity-50 {
  opacity: 0.5;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.flex {
  display: flex;
}

.flex-1 {
  flex: 1;
}

.gap-3 {
  gap: 0.75rem;
}

.text-center {
  text-align: center;
}

.py-10 {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.text-5xl {
  font-size: 3rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .preview-area {
    padding: 1.5rem;
  }
  
  .config-section {
    padding: 1rem;
  }
}
