/* tools/css-layout/css/style.css */

/* ── Mode toggle bar ──────────────────────────────────────────────── */
#mode-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #181825;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
}

.mode-label {
  font-size: 12px;
  font-weight: 600;
  color: #6c7086;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

#mode-tabs {
  display: flex;
  gap: 4px;
}

.mode-tab {
  background: #313244;
  color: #a6adc8;
  border: 1px solid #45475a;
  border-radius: 5px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mode-tab:hover { background: #45475a; color: #cdd6f4; }
.mode-tab.active {
  background: #89b4fa;
  color: #1e1e2e;
  border-color: #89b4fa;
  font-weight: 700;
}

/* ── Main layout ─────────────────────────────────────────────────── */
#layout-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Controls panel (left) ───────────────────────────────────────── */
#controls-panel {
  width: 300px;
  min-width: 300px;
  background: #181825;
  border-right: 2px solid #313244;
  overflow-y: auto;
  flex-shrink: 0;
}

.controls-section {
  border-bottom: 1px solid #313244;
  padding: 14px 16px;
}

.section-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #6c7086;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Form controls ───────────────────────────────────────────────── */
.prop-row {
  margin-bottom: 10px;
}
.prop-row:last-child { margin-bottom: 0; }

.prop-label {
  display: block;
  font-size: 11px;
  color: #a6adc8;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  margin-bottom: 4px;
}

.prop-select,
.prop-input {
  width: 100%;
  background: #11111b;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.prop-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c7086' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; cursor: pointer; }
.prop-select:focus,
.prop-input:focus { border-color: #89b4fa; }

.prop-input[type="number"] {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* Range slider row */
.prop-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.prop-range-row:last-child { margin-bottom: 0; }

.prop-range-label {
  font-size: 11px;
  color: #a6adc8;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  flex-shrink: 0;
  width: 110px;
}

.prop-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #313244;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.prop-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #89b4fa;
  cursor: pointer;
  border: 2px solid #1e1e2e;
  transition: background 0.15s;
}
.prop-range::-webkit-slider-thumb:hover { background: #b4d0ff; }
.prop-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #89b4fa;
  cursor: pointer;
  border: 2px solid #1e1e2e;
}

.prop-range-value {
  font-size: 12px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  color: #89b4fa;
  min-width: 36px;
  text-align: right;
}

/* ── Item management ─────────────────────────────────────────────── */
.item-mgmt-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgmt-btn {
  background: #313244;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.mgmt-btn:hover { background: #45475a; }
.mgmt-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.add-btn:hover:not(:disabled) { border-color: #a6e3a1; color: #a6e3a1; }
.remove-btn:hover:not(:disabled) { border-color: #f38ba8; color: #f38ba8; }

.item-count {
  font-size: 12px;
  color: #6c7086;
  margin-left: 4px;
}

/* ── Per-item properties ─────────────────────────────────────────── */
.no-selection-hint {
  font-size: 12px;
  color: #6c7086;
  font-style: italic;
  line-height: 1.5;
}

.item-prop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.item-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.item-prop-title {
  font-size: 13px;
  font-weight: 600;
  color: #cdd6f4;
}

/* ── Right panel ─────────────────────────────────────────────────── */
#right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Preview area ────────────────────────────────────────────────── */
#preview-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid #313244;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #11111b;
  border-bottom: 1px solid #313244;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #6c7086;
  text-transform: uppercase;
  flex-shrink: 0;
}

#preview-wrap {
  flex: 1;
  background: #2a2a3e;
  padding: 24px;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

#preview-container {
  border: 2px dashed #585b70;
  min-width: 200px;
  min-height: 120px;
  width: 100%;
  /* Layout properties applied via JS */
}

/* ── Preview items ───────────────────────────────────────────────── */
.preview-item {
  min-width: 48px;
  min-height: 48px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #1e1e2e;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
  user-select: none;
  flex-shrink: 0;
}
.preview-item:hover { transform: scale(1.05); }
.preview-item.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* ── CSS output area ─────────────────────────────────────────────── */
#css-output-area {
  height: 220px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #11111b;
}

#css-output {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
  margin: 0;
  color: #cdd6f4;
}

/* CSS syntax coloring */
.css-selector { color: #89b4fa; }
.css-brace    { color: #6c7086; }
.css-property { color: #cba6f7; }
.css-colon    { color: #6c7086; }
.css-value    { color: #a6e3a1; }
.css-semi     { color: #6c7086; }

.copy-css-btn {
  background: #313244;
  color: #a6adc8;
  border: 1px solid #45475a;
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-css-btn:hover { background: #45475a; color: #cdd6f4; border-color: #89b4fa; }
.copy-css-btn.copied { color: #a6e3a1; border-color: #a6e3a1; }
