/* ============================================
   KNOT YOUR AVERAGE CONVERTER
   Cross Stitch Pattern Maker - Styles
   ============================================ */

:root {
  --plum: #6B2D5B;
  --plum-dark: #4A1942;
  --plum-light: #8B4D7B;
  --gold: #C8A951;
  --gold-light: #E8D490;
  --gold-dark: #A88B31;
  --cream: #FFF8F0;
  --cream-dark: #F5EDE0;
  --rose: #E8A0BF;
  --rose-light: #F5D0E0;
  --coral: #E8836B;
  --text: #2D1F1A;
  --text-light: #6B5D55;
  --text-muted: #9B8D85;
  --white: #FFFFFF;
  --border: #E5DDD5;
  --shadow: rgba(74, 25, 66, 0.08);
  --shadow-md: rgba(74, 25, 66, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
}

/* ==================== RESET & BASE ==================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  /* Subtle fabric texture */
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(200, 169, 81, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(107, 45, 91, 0.03) 0%, transparent 50%);
}

/* ==================== TYPOGRAPHY ==================== */

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
}

/* ==================== HEADER ==================== */

.app-header {
  background: linear-gradient(135deg, var(--plum-dark) 0%, var(--plum) 50%, var(--plum-light) 100%);
  color: var(--white);
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 20px var(--shadow-md);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.logo h1 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tagline {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-top: 0.15rem;
  font-style: italic;
}

/* ==================== WIZARD NAV ==================== */

.wizard-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}

.wizard-nav-inner {
  max-width: 950px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.wizard-nav .step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: default;
  transition: all var(--transition);
  opacity: 0.4;
  user-select: none;
}

.wizard-nav .step.accessible {
  cursor: pointer;
  opacity: 0.6;
}

.wizard-nav .step.active {
  opacity: 1;
  background: var(--plum);
  color: var(--white);
}

.wizard-nav .step.completed {
  opacity: 0.8;
  color: var(--plum);
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cream-dark);
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step.active .step-num {
  background: rgba(255,255,255,0.2);
  color: var(--white);
}

.step.completed .step-num {
  background: var(--plum);
  color: var(--white);
}

.step-label {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

/* ==================== WIZARD PANELS ==================== */

.wizard-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.wizard-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

.wizard-panel.active {
  display: block;
}

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

.panel-inner {
  max-width: 800px;
  margin: 0 auto;
}

.panel-wide {
  max-width: 100%;
}

.step-title {
  font-size: 1.75rem;
  color: var(--plum-dark);
  margin-bottom: 0.5rem;
}

.step-desc {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* ==================== BUTTONS ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--plum);
  color: var(--white);
  border-color: var(--plum);
}
.btn-primary:hover:not(:disabled) {
  background: var(--plum-dark);
  border-color: var(--plum-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--plum);
  border-color: var(--plum);
}
.btn-outline:hover:not(:disabled) {
  background: var(--plum);
  color: var(--white);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.btn-sm:hover { background: var(--cream-dark); }
.btn-sm.btn-active {
  background: var(--plum);
  color: var(--white);
  border-color: var(--plum);
}

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ==================== DROP ZONE ==================== */

.drop-zone {
  border: 3px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--plum);
  background: var(--rose-light);
  transform: scale(1.01);
}

.drop-zone.drag-over {
  box-shadow: 0 0 0 4px rgba(107, 45, 91, 0.15);
}

.drop-icon {
  color: var(--plum-light);
  margin-bottom: 1rem;
}

.drop-zone h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--plum-dark);
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--text-light);
}

.text-accent {
  color: var(--plum);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 3px;
}

.drop-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* drop-zone uses the global .hidden utility */

/* ==================== IMAGE PREVIEW ==================== */

.image-preview {
  text-align: center;
}
.image-preview.hidden { display: none; }

.preview-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px var(--shadow);
  display: inline-block;
  margin-bottom: 1rem;
}

.preview-card img {
  max-width: 100%;
  max-height: 350px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}

.preview-info {
  margin-top: 0.75rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ==================== SETTINGS PANEL ==================== */

.adjust-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.settings-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.setting-group {
  margin-bottom: 1.5rem;
}
.setting-group:last-child { margin-bottom: 0; }

.setting-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.setting-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream-dark);
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: help;
  font-weight: 700;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-row input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--cream-dark);
  border-radius: 3px;
  outline: none;
}

.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--plum);
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow-md);
  transition: transform 0.15s ease;
}

.range-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--plum);
  cursor: pointer;
  border: none;
}

.range-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--plum);
  min-width: 2.5rem;
  text-align: center;
}

.range-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.setting-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.setting-info.small { font-size: 0.75rem; }

/* ==================== SETTINGS PHASES ==================== */

.settings-phase {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.settings-phase:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.phase-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--plum);
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
}

.phase-title {
  font-size: 1rem;
  color: var(--plum-dark);
  margin: 0;
  font-family: 'Playfair Display', serif;
}

.phase-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ==================== TRANSPARENCY OPTIONS ==================== */

.transparency-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  flex-wrap: wrap;
}

.radio-option:hover {
  border-color: var(--plum-light);
  background: var(--cream);
}

.radio-option:has(input:checked) {
  border-color: var(--plum);
  background: var(--rose-light);
}

.radio-option input[type="radio"] {
  accent-color: var(--plum);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.radio-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.radio-desc {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 1.85rem;
  margin-top: -0.2rem;
}

.color-picker-input {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  background: none;
  margin-left: auto;
}

.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-picker-input::-moz-color-swatch { border: none; border-radius: 3px; }

.select-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--transition);
}
.select-input:focus {
  outline: none;
  border-color: var(--plum);
}

/* ==================== PREVIEW PANEL ==================== */

.preview-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.compare-item h4 {
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text-light);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.compare-canvas-wrap {
  background: repeating-conic-gradient(#e8e8e8 0% 25%, #f5f5f5 0% 50%) 50% / 16px 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 1px solid var(--border);
}

.compare-canvas-wrap canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: 100%;
  width: 100%;
  height: auto;
}

/* ==================== PALETTE EDITOR ==================== */

.palette-editor {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.palette-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.palette-editor-header h4 {
  font-size: 0.95rem;
  color: var(--plum-dark);
  margin: 0;
}

.palette-editor h4 {
  font-size: 0.95rem;
  color: var(--plum-dark);
  margin-bottom: 0.2rem;
}

.palette-editor-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.palette-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 300px;
  overflow-y: auto;
}

.palette-editor-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: background var(--transition);
}

.palette-editor-row.pe-locked {
  background: var(--rose-light);
  border: 1px solid var(--rose);
}

.pe-lock-btn {
  flex-shrink: 0;
  padding: 0.2rem 0.35rem !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pe-lock-btn:hover {
  color: var(--plum) !important;
  border-color: var(--plum) !important;
}
.pe-lock-btn.pe-lock-active {
  color: var(--plum) !important;
  background: var(--plum) !important;
  border-color: var(--plum) !important;
}
.pe-lock-btn.pe-lock-active svg {
  stroke: var(--white);
}

.pe-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.pe-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pe-info strong {
  color: var(--plum);
}

.pe-count {
  color: var(--text-muted);
  margin-left: 0.3rem;
  font-size: 0.75rem;
}

.pe-merge-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  max-width: 120px;
  flex-shrink: 0;
}

.pe-remove-btn {
  flex-shrink: 0;
  color: var(--coral) !important;
  border-color: var(--coral) !important;
  font-weight: 700;
  padding: 0.2rem 0.5rem !important;
  font-size: 0.75rem !important;
}
.pe-remove-btn:hover {
  background: var(--coral) !important;
  color: var(--white) !important;
}

/* ==================== AI ASSISTANT ==================== */

.ai-assist {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.ai-assist-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--plum);
  margin-bottom: 0.6rem;
}

.ai-assist-header svg {
  flex-shrink: 0;
}

.ai-assist-body {
  display: flex;
  gap: 0.5rem;
}

.ai-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
}
.ai-input:focus {
  outline: none;
  border-color: var(--plum);
}
.ai-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.ai-send-btn {
  flex-shrink: 0;
  background: var(--plum) !important;
  color: var(--white) !important;
  border-color: var(--plum) !important;
  font-weight: 600;
}
.ai-send-btn:hover:not(:disabled) {
  background: var(--plum-dark) !important;
  border-color: var(--plum-dark) !important;
}
.ai-send-btn:disabled {
  opacity: 0.5;
}

.ai-response {
  margin-top: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--white);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  border-left: 3px solid var(--plum-light);
}

/* ==================== PIXEL EDITOR ==================== */

.editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 16px var(--shadow-md);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.editor-tool-section {
  display: flex;
  gap: 0.25rem;
}

.editor-tool-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 0.35rem;
  flex-shrink: 0;
}

.editor-tool-spacer {
  flex: 1;
}

.editor-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
}
.editor-tool-btn:hover {
  background: var(--cream);
  border-color: var(--plum-light);
  color: var(--plum);
}
.editor-tool-btn.active {
  background: var(--plum);
  color: var(--white);
  border-color: var(--plum);
}

.editor-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

.editor-body {
  display: flex;
  min-height: 0;
}

.editor-canvas-area {
  flex: 1;
  overflow: auto;
  background: #2a2a2e;
  cursor: crosshair;
  min-height: 500px;
  max-height: calc(100vh - 300px);
  position: relative;
}

.editor-canvas-area canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.editor-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--white);
  border-left: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}

.editor-active-color-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 2px solid var(--plum-light);
}

.editor-active-swatch {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
  background: repeating-conic-gradient(#e8e8e8 0% 25%, #f5f5f5 0% 50%) 50% / 8px 8px;
}

.editor-active-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.editor-active-info strong {
  font-size: 1rem;
  color: var(--plum);
}
.editor-active-info span {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.editor-palette-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 250px;
  overflow-y: auto;
}

.editor-color-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.78rem;
}
.editor-color-item:hover {
  background: var(--cream);
}
.editor-color-item.active {
  background: var(--rose-light);
  outline: 2px solid var(--plum-light);
}
.editor-color-item .eci-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.editor-color-item .eci-floss {
  font-weight: 600;
  color: var(--plum);
  min-width: 36px;
}
.editor-color-item .eci-name {
  flex: 1;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-color-item .eci-count {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.editor-add-color {
  position: relative;
}

.editor-search-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
}
.editor-search-input:focus {
  outline: none;
  border-color: var(--plum);
}

.editor-search-results {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 2px solid var(--plum-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 -4px 16px var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  margin-bottom: 4px;
}
.editor-search-results.hidden { display: none; }

.editor-search-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.15s;
}
.editor-search-item:hover {
  background: var(--cream);
}
.editor-search-item .eci-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.editor-shortcuts-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .editor-body {
    flex-direction: column;
  }
  .editor-sidebar {
    width: 100%;
    max-height: 300px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .editor-canvas-area {
    min-height: 350px;
    max-height: 50vh;
  }
}

/* ==================== PATTERN VIEW ==================== */

.pattern-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  gap: 0.35rem;
}

.pattern-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.pattern-canvas-wrap {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 70vh;
  box-shadow: 0 2px 12px var(--shadow);
}

.pattern-canvas-wrap canvas {
  display: block;
}

/* ==================== COLOR LEGEND ==================== */

.color-legend-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 2px 12px var(--shadow);
  position: sticky;
  top: 80px;
}

.color-legend-panel h3 {
  font-size: 1.1rem;
  color: var(--plum-dark);
  margin-bottom: 0.25rem;
}

.legend-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.legend-table-wrap {
  max-height: 55vh;
  overflow-y: auto;
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.legend-table th {
  position: sticky;
  top: 0;
  background: var(--white);
  text-align: left;
  padding: 0.4rem 0.3rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-table td {
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid var(--cream-dark);
  vertical-align: middle;
}

.legend-table tr {
  transition: background var(--transition);
}

.legend-table tr:hover {
  background: var(--cream);
}

.legend-table tr.highlight {
  background: var(--rose-light);
}

.legend-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
  vertical-align: middle;
}

.floss-num { font-weight: 600; color: var(--plum); }
.floss-name { color: var(--text-light); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stitch-count { text-align: right; }
.stitch-pct { text-align: right; color: var(--text-muted); }

/* ==================== EXPORT ==================== */

.export-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.export-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 2px 12px var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.export-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow-md);
}

.export-icon {
  color: var(--plum-light);
  margin-bottom: 1rem;
}

.export-card h3 {
  font-size: 1.15rem;
  color: var(--plum-dark);
  margin-bottom: 0.5rem;
}

.export-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.shopping-list-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.shopping-list-section h3 {
  font-size: 1.25rem;
  color: var(--plum-dark);
  margin-bottom: 1rem;
}

.shopping-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.shopping-summary p {
  font-size: 0.9rem;
  color: var(--text-light);
}

.shopping-table {
  width: 100%;
  border-collapse: collapse;
}

.shopping-table th {
  text-align: left;
  padding: 0.6rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shopping-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.9rem;
}

/* ==================== PROCESSING OVERLAY ==================== */

.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 25, 66, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.processing-overlay.hidden { display: none; }

.processing-overlay p {
  color: var(--white);
  font-size: 1.1rem;
  margin-top: 1.5rem;
  font-family: 'Playfair Display', serif;
  font-style: italic;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== FOOTER ==================== */

.app-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ==================== UTILITIES ==================== */

.hidden { display: none !important; }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 900px) {
  .adjust-layout {
    grid-template-columns: 1fr;
  }
  .pattern-layout {
    grid-template-columns: 1fr;
  }
  .color-legend-panel {
    position: static;
  }
  .export-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-header { padding: 1rem; }
  .logo h1 { font-size: 1.3rem; }
  .wizard-content { padding: 1rem; }
  .step-label { display: none; }
  .wizard-nav .step { padding: 0.5rem; }
  .step-title { font-size: 1.4rem; }
  .compare-row { grid-template-columns: 1fr; }
  .drop-zone { padding: 2rem 1rem; }
}

/* ==================== PRINT ==================== */

/* ==================== PRINT PATTERN IMAGE (hidden on screen) ==================== */

.print-pattern-section {
  display: none;
}
.print-pattern-section img {
  max-width: 100%;
  height: auto;
}

@media print {
  /* Hide all chrome */
  .app-header, .wizard-nav, .step-actions,
  .app-footer, .processing-overlay,
  .btn, .export-cards, .pattern-toolbar,
  .step-title, .step-desc { display: none !important; }

  /* Only show the export step */
  .wizard-panel { display: none !important; }
  .wizard-panel[data-step="6"] { display: block !important; }

  .wizard-content { padding: 0; max-width: 100%; }
  .panel-inner { max-width: 100%; }

  /* Show the print pattern image */
  .print-pattern-section {
    display: block !important;
    margin-bottom: 1.5rem;
  }
  .print-pattern-section img {
    max-width: 100%;
    height: auto;
  }

  /* Shopping list */
  .shopping-list-section {
    box-shadow: none;
    break-inside: avoid;
  }

  body { background: white; }
}
