/* Arctic Code Builder — UI Styles */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #0A0F1E;
  color: #E8EDF5;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ── CSS vars ── */
:root {
  --bg: #0A0F1E;
  --surface: #111827;
  --surface-2: #1a2535;
  --border: #1E2A3A;
  --accent: #4FC3F7;
  --accent-hover: #29B6F6;
  --text: #E8EDF5;
  --text-muted: #7A8FA6;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ── HEADER ── */
.builder-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,15,30,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 60px;
}
.builder-header__inner {
  display: flex; align-items: center; gap: 24px;
  height: 100%; padding: 0 24px;
}
.builder-logo {
  font-size: 15px; font-weight: 700; letter-spacing: .03em;
  color: var(--accent); white-space: nowrap; flex-shrink: 0;
}

/* Progress steps */
.builder-progress {
  display: flex; align-items: center; gap: 0; flex: 1;
  justify-content: center;
}
.progress-step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: color 200ms, background 200ms;
  cursor: default; position: relative;
}
.progress-step + .progress-step::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--border);
  flex-shrink: 0;
}
.progress-step.active { color: var(--text); }
.progress-step.done { color: var(--success); }
.progress-step__num {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border);
  flex-shrink: 0; transition: background 200ms, border-color 200ms;
}
.progress-step.active .progress-step__num {
  background: var(--accent); border-color: var(--accent); color: #000;
}
.progress-step.done .progress-step__num {
  background: var(--success); border-color: var(--success); color: #fff;
}
.progress-step__label { white-space: nowrap; }

.builder-header__back {
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
  flex-shrink: 0; transition: color 150ms;
}
.builder-header__back:hover { color: var(--text); }

/* ── MAIN LAYOUT ── */
.builder-main {
  display: flex; height: 100dvh; padding-top: 60px;
}

/* ── WIZARD PANEL (left 45%) ── */
.wizard-panel {
  width: 45%; flex-shrink: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--border);
}
.wizard-body {
  flex: 1; padding: 32px 32px 0;
}
.wizard-step__head { margin-bottom: 28px; }
.wizard-step__title { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.wizard-step__sub { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.6; }

/* Wizard step visibility */
.wizard-step { display: none; }
.wizard-step.active { display: block; }

/* ── STEP 1: Tipovi biznisa ── */
.business-types {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.biz-type {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 20px 16px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: border-color 200ms, background 200ms, transform 150ms;
  text-align: center;
}
.biz-type:hover { border-color: var(--accent); transform: translateY(-2px); }
.biz-type.selected { border-color: var(--accent); background: rgba(79,195,247,.08); }
.biz-type__icon { font-size: 28px; line-height: 1; }
.biz-type__name { font-size: 13px; font-weight: 600; color: var(--text); }
.biz-type__desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ── STEP 2: Stil ── */
.style-section { margin-bottom: 28px; }
.style-section__label {
  display: block; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 12px;
}

/* Palette grid */
.palette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.palette-card {
  border-radius: var(--radius); border: 2px solid var(--border);
  padding: 12px; cursor: pointer; background: var(--surface-2);
  transition: border-color 200ms, transform 150ms;
}
.palette-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.palette-card.selected { border-color: var(--accent); }
.palette-swatches { display: flex; gap: 4px; margin-bottom: 8px; }
.palette-swatch { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.palette-name { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.palette-desc { font-size: 10px; color: var(--text-muted); line-height: 1.4; }

/* Font grid */
.font-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.font-card {
  border-radius: var(--radius); border: 2px solid var(--border);
  padding: 14px; cursor: pointer; background: var(--surface-2);
  transition: border-color 200ms, transform 150ms;
}
.font-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.font-card.selected { border-color: var(--accent); }
.font-card__heading { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 2px; line-height: 1.2; }
.font-card__body { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.font-card__meta { font-size: 10px; color: var(--text-muted); margin-top: 6px; opacity: .7; }

/* Radius options */
.radius-options, .spacing-options {
  display: flex; gap: 8px;
}
.radius-opt, .spacing-opt {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface-2);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: border-color 200ms, color 200ms, background 200ms;
}
.radius-opt:hover, .spacing-opt:hover { border-color: var(--text-muted); color: var(--text); }
.radius-opt.active, .spacing-opt.active { border-color: var(--accent); color: var(--accent); background: rgba(79,195,247,.06); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 12px; }
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle__track {
  width: 44px; height: 24px; border-radius: 12px; background: var(--border);
  transition: background 200ms; display: block;
}
.toggle__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 200ms;
}
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }
.toggle-label { font-size: 13px; color: var(--text-muted); }

/* ── STEP 3: Sekcije ── */
.sections-layout { display: flex; flex-direction: column; gap: 20px; }
.sections-available__label, .sections-selected__label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.sections-available-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.section-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: border-color 150ms, background 150ms;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}
.section-chip:hover { border-color: var(--accent); color: var(--text); }
.section-chip.added { border-color: var(--success); color: var(--success); background: rgba(34,197,94,.06); cursor: default; }
.section-chip__icon { font-size: 14px; }

.sections-selected-list {
  min-height: 80px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg); border-radius: var(--radius); padding: 10px;
  border: 1.5px dashed var(--border);
}
.sections-selected-list:empty::after {
  content: 'Kliknite sekcije lijevo da ih dodate';
  display: block; text-align: center; padding: 16px;
  color: var(--text-muted); font-size: 12px;
}
.section-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1.5px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text);
  cursor: grab; user-select: none;
}
.section-item:active { cursor: grabbing; }
.section-item__drag { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.section-item__name { flex: 1; }
.section-item__variant {
  font-size: 10px; color: var(--text-muted);
  background: var(--bg); padding: 2px 8px; border-radius: 10px;
  cursor: pointer; transition: color 150ms;
}
.section-item__variant:hover { color: var(--accent); }
.section-item__remove {
  color: var(--text-muted); background: none; border: none;
  padding: 2px 4px; font-size: 14px; line-height: 1;
  transition: color 150ms;
}
.section-item__remove:hover { color: var(--error); }
.sortable-ghost { opacity: .4; background: rgba(79,195,247,.1); }

/* ── STEP 4: Sadržaj ── */
.content-section { margin-bottom: 24px; }
.content-label {
  display: block; font-size: 12px; font-weight: 600;
  letter-spacing: .04em; color: var(--text-muted); margin-bottom: 8px;
}
.content-label .optional { font-weight: 400; opacity: .7; }
.content-input, .content-textarea {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 14px;
  transition: border-color 200ms;
  outline: none;
}
.content-input:focus, .content-textarea:focus { border-color: var(--accent); }
.content-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* Upload area */
.upload-area { position: relative; }
.upload-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  background: var(--bg); transition: border-color 200ms, background 200ms;
}
.upload-drop:hover { border-color: var(--accent); background: rgba(79,195,247,.04); }
.upload-drop.dragover { border-color: var(--accent); background: rgba(79,195,247,.08); }
.upload-drop__icon { font-size: 24px; margin-bottom: 8px; }
.upload-drop p { font-size: 13px; color: var(--text-muted); margin: 0 0 4px; line-height: 1.5; }
.upload-drop span { color: var(--accent); }
.upload-hint { font-size: 11px; opacity: .6; }
.upload-preview {
  margin-top: 10px; display: none;
  border-radius: var(--radius-sm); overflow: hidden; position: relative;
}
.upload-preview img { width: 100%; height: 120px; object-fit: cover; }
.upload-preview__remove {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.7); color: #fff; border: none;
  border-radius: 50%; width: 24px; height: 24px;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.btn-skip {
  display: block; width: 100%; margin-top: 8px;
  padding: 8px; background: none; border: none;
  font-size: 12px; color: var(--text-muted); text-align: center;
  transition: color 150ms;
}
.btn-skip:hover { color: var(--text); }

/* Usluge */
.usluga-row {
  display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px;
}
.usluga-row__icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  transition: border-color 150ms;
}
.usluga-row__icon:hover { border-color: var(--accent); }
.usluga-row__fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.usluga-row__remove {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; padding: 4px; align-self: center;
  transition: color 150ms; flex-shrink: 0;
}
.usluga-row__remove:hover { color: var(--error); }
.btn-add-usluga {
  width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border); background: none;
  font-size: 13px; color: var(--text-muted);
  transition: border-color 150ms, color 150ms;
}
.btn-add-usluga:hover { border-color: var(--accent); color: var(--accent); }

/* Icon picker modal */
.icon-picker {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.icon-picker.hidden { display: none; }
.icon-picker__modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; width: 360px; max-height: 70dvh;
  display: flex; flex-direction: column; gap: 12px;
}
.icon-picker__title { font-size: 15px; font-weight: 600; margin: 0; }
.icon-picker__grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  overflow-y: auto; flex: 1;
}
.icon-opt {
  width: 36px; height: 36px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: border-color 150ms, background 150ms;
}
.icon-opt:hover { border-color: var(--accent); background: rgba(79,195,247,.08); }
.icon-opt.selected { border-color: var(--accent); background: rgba(79,195,247,.15); }
.icon-picker__close {
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: none;
  font-size: 13px; color: var(--text-muted); align-self: flex-end;
  transition: border-color 150ms, color 150ms;
}
.icon-picker__close:hover { border-color: var(--text-muted); color: var(--text); }

/* ── WIZARD NAV ── */
.wizard-nav {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 32px; border-top: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.btn-prev, .btn-next {
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: background 150ms, color 150ms, border-color 150ms, opacity 150ms;
}
.btn-prev {
  border: 1.5px solid var(--border); background: none;
  color: var(--text-muted);
}
.btn-prev:hover:not(:disabled) { border-color: var(--text-muted); color: var(--text); }
.btn-prev:disabled { opacity: .4; cursor: not-allowed; }
.btn-next {
  margin-left: auto;
  border: none; background: var(--accent); color: #000;
  padding: 10px 24px;
}
.btn-next:hover { background: var(--accent-hover); }
.btn-next:disabled { opacity: .5; cursor: not-allowed; }
.btn-checkout {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: var(--radius-sm);
  background: var(--success); color: #fff; font-size: 14px; font-weight: 600;
  border: none; transition: background 150ms;
}
.btn-checkout:hover { background: #16a34a; }
.btn-checkout.hidden { display: none; }

/* ── PREVIEW PANEL (right 55%) ── */
.preview-panel {
  flex: 1; display: flex; flex-direction: column;
  background: #060b14; overflow: hidden;
  position: sticky; top: 60px; height: calc(100dvh - 60px);
}
.preview-chrome {
  display: flex; flex-direction: column; height: 100%;
}
.preview-chrome__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: #0d1422; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-chrome__dots { display: flex; gap: 6px; }
.preview-chrome__dots span {
  width: 10px; height: 10px; border-radius: 50%;
}
.preview-chrome__dots span:nth-child(1) { background: #ef4444; }
.preview-chrome__dots span:nth-child(2) { background: #f59e0b; }
.preview-chrome__dots span:nth-child(3) { background: #22c55e; }
.preview-chrome__url {
  flex: 1; text-align: center; font-size: 11px; color: var(--text-muted);
  background: var(--surface); padding: 4px 12px; border-radius: 12px;
  max-width: 260px; margin: 0 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.preview-chrome__viewport { display: flex; gap: 6px; margin-left: auto; }
.viewport-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: none;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  transition: border-color 150ms, color 150ms, background 150ms;
}
.viewport-btn:hover { border-color: var(--text-muted); color: var(--text); }
.viewport-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(79,195,247,.08); }

.preview-viewport {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  overflow: hidden; padding: 16px; background: #060b14;
  transition: all 300ms;
}
.preview-viewport[data-vp="desktop"] { align-items: flex-start; }
.preview-viewport[data-vp="tablet"] { align-items: flex-start; }
.preview-viewport[data-vp="mobile"] { align-items: flex-start; }

#previewFrame {
  border: none; border-radius: 6px; overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  transition: width 300ms, height 300ms;
}
.preview-viewport[data-vp="desktop"] #previewFrame {
  width: 100%; height: 100%; min-height: 500px;
}
.preview-viewport[data-vp="tablet"] #previewFrame {
  width: 768px; max-width: 100%; height: 100%;
}
.preview-viewport[data-vp="mobile"] #previewFrame {
  width: 390px; max-width: 100%; height: 100%;
}

.preview-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 12px;
  color: var(--text-muted); font-size: 14px; text-align: center; padding: 32px;
}
.preview-placeholder__icon { font-size: 40px; opacity: .4; }

/* ── MOBILE FAB ── */
.preview-fab {
  display: none; position: fixed; bottom: 24px; right: 24px; z-index: 90;
  padding: 12px 20px; border-radius: 24px;
  background: var(--accent); color: #000; font-size: 14px; font-weight: 600;
  border: none; box-shadow: 0 4px 20px rgba(79,195,247,.4);
  transition: transform 150ms, box-shadow 150ms;
}
.preview-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(79,195,247,.5); }

/* Mobile preview modal */
.preview-mobile-modal {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: #060b14; flex-direction: column;
}
.preview-mobile-modal.open { display: flex; }
.preview-mobile-modal__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.preview-mobile-modal__title { font-size: 15px; font-weight: 600; }
.preview-mobile-modal__close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; padding: 4px; transition: color 150ms;
}
.preview-mobile-modal__close:hover { color: var(--text); }
.preview-mobile-modal__frame { flex: 1; padding: 16px; overflow: hidden; }
.preview-mobile-modal__frame iframe { width: 100%; height: 100%; border: none; border-radius: 6px; }

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

/* ── RESPONSIVE ── */
@media (max-width: 1023px) {
  .builder-progress .progress-step__label { display: none; }
  .preview-panel { display: none; }
  .wizard-panel { width: 100%; border-right: none; }
  .preview-fab { display: flex; }
}
@media (max-width: 600px) {
  .builder-header__inner { gap: 12px; padding: 0 16px; }
  .builder-logo { font-size: 13px; }
  .builder-header__back { display: none; }
  .wizard-body { padding: 20px 16px 0; }
  .wizard-nav { padding: 16px; }
  .business-types { grid-template-columns: 1fr 1fr; gap: 8px; }
  .biz-type { padding: 14px 10px; }
  .palette-grid { grid-template-columns: repeat(2, 1fr); }
  .font-grid { grid-template-columns: 1fr; }
}
