/* TileForge Studio — Generator Panel & Dialogs */

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  min-width: 360px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.generator-dialog {
  min-width: 420px;
}

.dialog-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.form-label-sm {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 2px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 3px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input-sm {
  padding: 4px 6px;
  font-size: 11px;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.form-field {
  flex: 1;
}

.form-field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.form-field-inline .form-label-sm {
  flex: 1;
  margin-bottom: 0;
}

.form-field-inline .form-input {
  width: 80px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 4px;
}

.form-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}

.gen-options {
  margin: 12px 0;
  padding: 8px;
  background: var(--bg-dark);
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
  color: var(--text);
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
}

.btn:hover {
  background: var(--border);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-sm {
  padding: 3px 10px;
  font-size: 11px;
}

/* ---- Property Editor ---- */
.prop-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  font-size: 11px;
}

.prop-row:hover {
  background: var(--bg-panel-alt);
}

.prop-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

.prop-input {
  width: 80px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 2px;
}

.prop-input:focus {
  outline: none;
  border-color: var(--accent);
}

.prop-input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.prop-input[type="color"] {
  width: 30px;
  height: 20px;
  padding: 0;
  cursor: pointer;
}

.prop-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
}

.prop-delete:hover {
  color: var(--warning);
}

.prop-add-btn {
  margin: 6px;
  width: calc(100% - 12px);
}

/* ---- Engine Presets Bar ---- */
.prop-engine-bar {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.prop-engine-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 4px;
  font-size: 11px;
  border-radius: 2px;
  cursor: pointer;
}

.prop-engine-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- Property Picker Dialog ---- */
.prop-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.prop-picker-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 320px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.prop-picker-title {
  padding: 10px 12px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.prop-picker-search {
  margin: 0 10px 6px;
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
}

.prop-picker-search:focus {
  outline: none;
  border-color: var(--accent);
}

.prop-picker-list {
  flex: 1;
  overflow-y: auto;
  max-height: 280px;
  padding: 0 4px 4px;
}

.prop-picker-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}

.prop-picker-item:hover {
  background: var(--bg-panel-alt);
}

.prop-picker-item-name {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 500;
}

.prop-picker-item-type {
  color: var(--accent);
  font-size: 10px;
  opacity: 0.7;
}

.prop-picker-item-desc {
  width: 100%;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.3;
}

.prop-picker-custom {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.prop-picker-dialog > .btn {
  margin: 6px 10px 10px;
  align-self: flex-end;
}

/* ---- Tab Bar ---- */
.tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  background: var(--bg-dark);
  border: 1px solid transparent;
  border-bottom: none;
  white-space: nowrap;
}

.tab:hover {
  background: var(--bg-panel-alt);
  color: var(--text);
}

.tab-active {
  background: var(--bg-panel);
  color: var(--text);
  border-color: var(--border);
}

.tab-close {
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 2px;
}

.tab-close:hover {
  background: var(--warning);
  color: #fff;
}

.tab-new {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: bold;
  padding: 4px 8px;
}

.tab-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Custom Palettes ---- */
.palette-section {
  margin-bottom: 4px;
}

.palette-section-header {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  background: var(--bg-panel-alt);
  border-radius: 2px;
}

.palette-section-header:hover {
  color: var(--text);
}

.palette-section.active .palette-section-header {
  color: var(--accent);
}

.palette-entry {
  padding: 3px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
}

.palette-entry:hover {
  background: var(--bg-panel-alt);
}

.palette-entry.active {
  background: var(--accent);
  color: #fff;
}

/* ─── PSD Import Dialog ─────────────────────────────────── */

.psd-import-info {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 8px;
}

.psd-import-info p {
  margin: 0 0 8px;
}

.psd-import-details {
  background: var(--bg-dark);
  border-radius: 4px;
  padding: 8px 10px;
  margin: 10px 0;
  font-size: 12px;
}

.psd-import-detail {
  padding: 2px 0;
  color: var(--text-muted);
}

.psd-import-detail strong {
  color: var(--text);
}

.psd-import-learn-more {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}

.psd-import-learn-more:hover {
  text-decoration: underline;
}

.psd-import-progress {
  margin: 12px 0;
}

.psd-import-progress-bar {
  height: 6px;
  background: var(--bg-dark);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.psd-import-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #2ecc71);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

.psd-import-progress-text {
  font-size: 11px;
  color: var(--text-muted);
}

.psd-import-error {
  font-size: 12px;
  color: #e74c3c;
  min-height: 16px;
}

.psd-import-preview {
  margin: 12px 0;
}

.psd-import-summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.psd-import-warning {
  font-size: 12px;
  color: #f1c40f;
  background: rgba(241, 196, 15, 0.08);
  border: 1px solid rgba(241, 196, 15, 0.2);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.psd-import-preview-canvas {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
}
