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

:root {
  --accent: #C8F04D;
  --bg: #0f0f0f;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #888;
  --sidebar-w: 380px;
  --font: 'Syne', sans-serif;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
}

/* ---- SIDEBAR ---- */
#app { display: flex; height: 100vh; width: 100vw; }

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

#logo-mark {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

#brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
#brand-sub { font-size: 11px; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }

/* ---- TABS ---- */
#tabs {
  display: flex;
  padding: 12px 16px 0;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- TAB PANELS ---- */
#tab-content { flex: 1; overflow-y: auto; padding: 16px; }
#tab-content::-webkit-scrollbar { width: 4px; }
#tab-content::-webkit-scrollbar-track { background: transparent; }
#tab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

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

/* ---- FORM ---- */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: 'DM Sans', sans-serif;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .2s;
  resize: vertical;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

input[type="range"] {
  width: calc(100% - 36px);
  accent-color: var(--accent);
  vertical-align: middle;
}
#radius-val { font-size: 12px; color: var(--text-muted); margin-left: 6px; }

select option { background: #1e1e1e; }

/* ---- COLOR ---- */
.color-row { display: flex; align-items: center; gap: 8px; }
.color-pick {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
}
.color-pick::-webkit-color-swatch-wrapper { padding: 0; border-radius: 4px; }
.color-pick::-webkit-color-swatch { border: none; border-radius: 4px; }
.hex-input { flex: 1; font-family: 'Courier New', monospace; font-size: 13px; }

/* ---- PALETTES ---- */
#palettes { display: flex; flex-direction: column; gap: 6px; }
.palette {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .2s;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
}
.palette:hover { border-color: var(--accent); color: var(--text); }
.pal-swatch { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }

/* ---- FILE DROP ---- */
.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
}
.file-drop:hover, .file-drop.dragover { border-color: var(--accent); background: rgba(200,240,77,.04); color: var(--text); }
.file-drop svg { opacity: .5; flex-shrink: 0; }

/* ---- SERVICES ---- */
#services-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.service-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.service-item input { flex: 1; }
.service-item textarea { flex: 2; min-height: 52px; }
.del-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 0;
  transition: border-color .2s, color .2s;
}
.del-btn:hover { border-color: #e63946; color: #e63946; }

.add-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .2s;
  width: 100%;
}
.add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- TEMPLATE CARDS ---- */
#template-grid { display: flex; flex-direction: column; gap: 10px; }
.template-card {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color .2s;
}
.template-card.active { border-color: var(--accent); }
.template-card:hover { border-color: var(--accent); }
.tmpl-name { font-size: 13px; font-weight: 600; margin-top: 8px; }
.tmpl-desc { font-size: 11px; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }

.tmpl-preview {
  height: 60px;
  background: #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

/* Hero preview sketch */
.tmpl-hero { background: linear-gradient(135deg, #1a2a1a 0%, #0a1a0a 100%); }
.tp-hero-bg { position: absolute; inset: 0; background: rgba(200,240,77,.08); }
.tp-hero-text { position: absolute; top: 12px; left: 12px; width: 60%; height: 8px; background: rgba(255,255,255,.3); border-radius: 2px; }
.tp-hero-btn { position: absolute; top: 28px; left: 12px; width: 30%; height: 8px; background: var(--accent); border-radius: 2px; opacity: .8; }

/* Simple preview sketch */
.tmpl-simple { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: #fafafa; }
.tp-line { height: 6px; background: #ddd; border-radius: 2px; width: 100%; }
.tp-line.short { width: 60%; }

/* Multi preview sketch */
.tmpl-multi { display: flex; flex-direction: column; gap: 4px; padding: 0; }
.tp-nav { height: 12px; background: rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.05); }
.tp-hero-sm { height: 20px; background: linear-gradient(90deg, rgba(200,240,77,.15), rgba(200,240,77,.05)); }
.tp-cards { display: flex; gap: 4px; padding: 4px 8px; flex: 1; }
.tp-card { flex: 1; background: rgba(255,255,255,.07); border-radius: 2px; }

/* ---- EXPORT ---- */
#export-area { margin-top: 24px; }
.export-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.export-btn.primary {
  background: var(--accent);
  color: #000;
}
.export-btn.primary:hover { background: #d4f55a; transform: translateY(-1px); }
#export-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; font-family: 'DM Sans', sans-serif; }

/* ---- PREVIEW AREA ---- */
#preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  overflow: hidden;
}

#preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

#preview-label { font-size: 12px; color: var(--text-muted); font-family: 'DM Sans', sans-serif; }

#device-btns { display: flex; gap: 4px; }
.dev-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
}
.dev-btn:hover, .dev-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(200,240,77,.08); }

#preview-frame-wrap {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

#preview-frame {
  width: 100%;
  height: calc(100vh - 100px);
  border: none;
  border-radius: 10px;
  background: #fff;
  transition: width .3s ease;
  box-shadow: 0 8px 60px rgba(0,0,0,.6);
}
