/* ================================================================
   HAZTEUNSITIO — builder.css  v2
   Dark precision builder UI
   ================================================================ */
* { box-sizing:border-box; }
:root {
  --purple: #6C47FF;
  --purple-dark: #5636DB;
  --purple-light: #F0EDFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  margin:0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow:hidden;
  background: var(--gray-50);
}

.builder-layout {
  display:grid;
  grid-template-columns:216px 1fr 256px;
  grid-template-rows:52px 1fr;
  height:100vh;
}

/* ── Topbar ── */
.builder-topbar {
  grid-column:1/-1;
  display:flex; align-items:center; gap:10px;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  height: 70px;
  padding: 0 24px;
}
.builder-logo {
  display:flex; align-items:center; gap:8px;
  text-decoration:none; padding-right:12px;
  border-right:1px solid var(--border-1); margin-right:4px;
}
.builder-logo-mark {
  width:26px; height:26px;
  background:linear-gradient(135deg,var(--violet),var(--violet-l));
  border-radius:6px; display:flex; align-items:center; justify-content:center;
  font-family:'Syne',system-ui; font-size:13px; font-weight:800; color:#fff;
}
.builder-logo-text { font-family:'Syne',system-ui; font-size:13px; font-weight:700; color:var(--text-1); }
.builder-site-name-wrap { flex:1; }
.builder-site-name-wrap input {
  background:transparent; border:none; border-bottom:1px solid transparent;
  color:var(--text-2); font-size:13px; font-family:'Syne',system-ui; font-weight:500;
  outline:none; width:220px; padding:2px 4px; transition:all .15s;
}
.builder-site-name-wrap input:hover { color:var(--text-1); border-bottom-color:var(--border-2); }
.builder-site-name-wrap input:focus { color:var(--text-1); border-bottom-color:var(--violet); }
.view-btns {
  display:flex; gap:2px; padding:3px; background:var(--ink-3);
  border-radius:8px; border:1px solid var(--border-1);
}
.view-btn {
  width:30px; height:26px; border:none; background:transparent;
  color:var(--text-4); border-radius:6px; cursor:pointer; font-size:13px;
  display:flex; align-items:center; justify-content:center; transition:all .15s;
}
.view-btn.active, .view-btn:hover { background:var(--surface-2); color:var(--text-1); }
.builder-status {
  font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--text-4);
  letter-spacing:.04em; padding:0 8px;
}
.builder-actions { display:flex; gap:8px; }
.btn-save, .btn-publish {
  border-radius: 50px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
  padding: 12px 24px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  font-family: 'Syne', system-ui;
}

.btn-save:hover, .btn-publish:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 10px 20px rgba(108, 71, 255, 0.3);
}

/* ── Left panel ── */
.builder-left, .builder-right {
  background: #fff;
  border: 1px solid var(--gray-200);
  box-shadow: 0 0 40px rgba(0,0,0,0.03);
  display:flex; flex-direction:column; overflow:hidden;
}
.panel-header {
  padding:12px 12px 8px;
  font-family:'JetBrains Mono',monospace; font-size:9.5px; font-weight:500;
  color:var(--text-4); letter-spacing:.1em; text-transform:uppercase;
  border-bottom:1px solid var(--border-1);
}
.panel-tabs {
  display:flex; padding:8px 8px 0; gap:4px;
}
.panel-tab {
  flex:1; padding:6px 8px; border:none;
  background:transparent; color:var(--text-3);
  border-radius:6px; font-size:11.5px; font-weight:600;
  cursor:pointer; font-family:'Syne',system-ui;
  transition:all .15s; border-bottom:2px solid transparent;
}
.panel-tab.active { background:var(--violet-bg); color:var(--violet-xl); border-bottom-color:var(--violet); }
.panel-tab:hover:not(.active) { color:var(--text-1); }
.panel-scroll { flex:1; overflow-y:auto; padding:10px 8px; }
.panel-scroll::-webkit-scrollbar { width:3px; }
.panel-scroll::-webkit-scrollbar-thumb { background:var(--border-1); border-radius:2px; }
.panel-group-label {
  font-family:'JetBrains Mono',monospace; font-size:9px; color:var(--text-4);
  letter-spacing:.1em; text-transform:uppercase; padding:10px 8px 5px;
}
.block-item {
  display:flex; align-items:center; gap:9px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.block-item:hover {
  border-color: var(--purple);
  background: var(--purple-light);
  transform: translateX(5px);
}
.block-icon {
  width:26px; height:26px; background:var(--surface-2); border:1px solid var(--border-1);
  border-radius:6px; display:flex; align-items:center; justify-content:center;
  font-size:13px; flex-shrink:0;
}
.block-label { font-size:12.5px; color:var(--text-2); font-weight:500; }

/* ── Center preview ── */
.builder-center {
  background:var(--ink-3); display:flex; flex-direction:column;
  overflow:auto; padding:20px;
}
.preview-wrap {
  flex:1; display:flex; align-items:flex-start; justify-content:center;
  background: #e2e8f0;
  padding: 40px;
}
.preview-frame-container {
  background:#fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 100px rgba(0,0,0,0.2);
  transition:width .3s, max-width .3s; flex-shrink:0; position:relative;
}
.preview-frame-container.view-desktop { width:100%; max-width:1200px; min-height:600px; }
.preview-frame-container.view-tablet  { width:768px; }
.preview-frame-container.view-mobile  { width:390px; }
#previewFrame { width:100%; border:none; display:block; min-height:600px; }

/* ── Right panel ── */

.props-header {
  padding:12px 14px; border-bottom:1px solid var(--border-1);
  display:flex; justify-content:space-between; align-items:center;
}
.props-title { font-family:'Syne',system-ui; font-size:12px; font-weight:700; color:var(--text-2); letter-spacing:.02em; }
.props-scroll { flex:1; overflow-y:auto; padding:14px; }
.props-scroll::-webkit-scrollbar { width:3px; }
.props-scroll::-webkit-scrollbar-thumb { background:var(--border-1); border-radius:2px; }
.prop-group { margin-bottom:18px; }
.prop-label {
  font-family:'JetBrains Mono',monospace; font-size:9.5px; color:var(--text-4);
  letter-spacing:.08em; text-transform:uppercase; margin-bottom:7px;
}
.prop-input {
  width:100%; padding:8px 10px;
  background:var(--surface-1); border:1px solid var(--border-1);
  border-radius:6px; font-size:12.5px; color:var(--text-1); outline:none;
  font-family:'Plus Jakarta Sans',system-ui; transition:border-color .15s;
}
.prop-input:focus { border-color:var(--violet); background:var(--surface-2); }
.prop-textarea {
  width:100%; padding:8px 10px;
  background:var(--surface-1); border:1px solid var(--border-1);
  border-radius:6px; font-size:12.5px; color:var(--text-1); outline:none;
  font-family:'Plus Jakarta Sans',system-ui; resize:vertical; min-height:80px;
  transition:border-color .15s;
}
.prop-textarea:focus { border-color:var(--violet); }
.prop-input::placeholder, .prop-textarea::placeholder { color:var(--text-4); }
.color-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.color-swatch-row { display:flex; align-items:center; gap:6px; }
.color-swatch {
  width:26px; height:26px; border-radius:6px; cursor:pointer;
  border:1px solid var(--border-2); flex-shrink:0;
}
.prop-color { flex:1; background:var(--surface-1); border:1px solid var(--border-1); border-radius:6px; padding:3px; height:26px; outline:none; }
.block-action-btns { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:16px; }
.blk-btn {
  padding:5px 11px; border:1px solid var(--border-1); border-radius:5px;
  font-size:11.5px; font-weight:600; font-family:'Syne',system-ui;
  background:var(--surface-1); cursor:pointer; color:var(--text-3); transition:all .14s;
}
.blk-btn:hover { background:var(--surface-2); color:var(--text-1); }
.blk-btn--danger:hover { background:rgba(239,68,68,.1); color:#FCA5A5; border-color:rgba(239,68,68,.3); }
.empty-props { text-align:center; padding:40px 12px; color:var(--text-4); font-size:12.5px; }
.empty-props .e-icon { font-size:28px; margin-bottom:10px; opacity:.4; }
/* Color section in right panel */
.colors-section {
  padding:14px; border-top:1px solid var(--border-1);
}
.colors-title {
  font-family:'JetBrains Mono',monospace; font-size:9.5px; color:var(--text-4);
  letter-spacing:.08em; text-transform:uppercase; margin-bottom:10px;
}

/* ── AI Chat panel ── */
.ai-chat-panel {
  position:fixed; right:266px; bottom:20px; width:320px;
  background:var(--ink-2); border:1px solid var(--border-2);
  border-radius:var(--r-xl); box-shadow:0 0 0 1px rgba(124,58,237,.1), 0 16px 48px rgba(0,0,0,.6);
  display:flex; flex-direction:column; overflow:hidden; z-index:500;
  transition:height .3s var(--ease);
}
.ai-chat-panel.collapsed { height:50px; }
.ai-chat-panel:not(.collapsed) { height:420px; }
.ai-chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px; cursor:pointer; flex-shrink:0;
  background:linear-gradient(90deg,rgba(124,58,237,.15),rgba(6,182,212,.08));
  border-bottom:1px solid var(--border-1);
}
.ai-chat-title-wrap { display:flex; align-items:center; gap:8px; }
.ai-badge {
  background:var(--violet); color:#fff;
  font-family:'JetBrains Mono',monospace; font-size:9px; font-weight:700;
  letter-spacing:.06em; padding:2px 6px; border-radius:4px; text-transform:uppercase;
}
.ai-chat-title { font-family:'Syne',system-ui; font-size:12px; font-weight:700; color:var(--text-1); }
.ai-chat-toggle { color:var(--text-3); font-size:16px; line-height:1; transition:transform .2s; }
.ai-chat-panel:not(.collapsed) .ai-chat-toggle { transform:rotate(180deg); }
.ai-messages { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:8px; }
.ai-messages::-webkit-scrollbar { width:2px; }
.ai-messages::-webkit-scrollbar-thumb { background:var(--border-1); }
.ai-msg {
  max-width:90%; padding:9px 12px; border-radius:10px;
  font-size:12px; line-height:1.6;
}
.ai-msg.from-user {
  align-self:flex-end; background:var(--violet); color:#fff;
  border-bottom-right-radius:3px;
}
.ai-msg.from-ai {
  align-self:flex-start;
  background:var(--surface-2); color:var(--text-2);
  border:1px solid var(--border-1); border-bottom-left-radius:3px;
  display:flex; gap:7px;
}
.ai-msg.loading { background:var(--surface-1); border:1px solid var(--border-1); }
.ai-typing { display:flex; gap:3px; align-items:center; padding:2px 0; }
.ai-typing span {
  width:4px; height:4px; background:var(--text-4); border-radius:50%;
  animation:td 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay:.2s; }
.ai-typing span:nth-child(3) { animation-delay:.4s; }
@keyframes td { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }
.ai-suggestions { padding:0 8px 8px; display:flex; flex-direction:column; gap:4px; }
.ai-suggestion {
  background:var(--surface-1); border:1px solid var(--border-1);
  border-radius:6px; color:var(--text-3); padding:6px 10px;
  font-size:11px; cursor:pointer; text-align:left;
  font-family:'Plus Jakarta Sans',system-ui; transition:all .14s;
}
.ai-suggestion:hover { background:var(--violet-bg); color:var(--violet-xl); border-color:rgba(124,58,237,.3); }
.ai-chat-input {
  padding:8px; border-top:1px solid var(--border-1);
  display:flex; gap:7px; align-items:flex-end; flex-shrink:0;
}
.ai-input {
  flex:1; background:var(--surface-2); border:1px solid var(--border-1);
  border-radius:7px; padding:7px 10px; font-size:12px; color:var(--text-1);
  font-family:'Plus Jakarta Sans',system-ui; outline:none;
  resize:none; min-height:34px; max-height:90px; transition:border-color .15s;
}
.ai-input::placeholder { color:var(--text-4); }
.ai-input:focus { border-color:var(--violet); }
.ai-send {
  width:34px; height:34px; flex-shrink:0; border-radius:7px;
  background:var(--violet); border:none; color:#fff; cursor:pointer;
  font-size:14px; display:flex; align-items:center; justify-content:center;
  transition:all .15s;
}
.ai-send:hover { background:var(--violet-l); box-shadow:0 0 14px rgba(124,58,237,.4); }
.ai-send:disabled { opacity:.4; cursor:not-allowed; }

/* ── Sortable ── */
.sortable-ghost { opacity:.25; }
.sortable-chosen { cursor:grabbing; }
.block-list-item:hover { background:var(--surface-2) !important; }
.block-selected { outline:1.5px solid var(--violet) !important; outline-offset:2px; }

@media (max-width:768px) {
  .builder-left, .builder-right { display:none; }
  .builder-layout { grid-template-columns:1fr; }
  .ai-chat-panel { right:10px; left:10px; width:auto; }
}
