/* Minecraft Block Gradient Generator Styles
 * Scoped under #tool-root #bgg to prevent style conflicts and ensure theme compatibility.
 */

#tool-root #bgg {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
  color: var(--fg, #0b1215);
  font-family: inherit;
}

#tool-root #bgg *,
#tool-root #bgg *::before,
#tool-root #bgg *::after {
  box-sizing: border-box;
}

/* Header Gradient Preview Strip */
#tool-root #bgg .bgg-header-bar {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--surface, #ffffff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#tool-root #bgg .bgg-gradient-strip {
  width: 100%;
  height: 24px;
  transition: background 0.2s ease;
}

/* Layout Grid */
#tool-root #bgg .bgg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 860px) {
  #tool-root #bgg .bgg-layout {
    grid-template-columns: minmax(360px, 460px) 1fr;
    align-items: start;
  }
}

#tool-root #bgg .bgg-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* Panels */
#tool-root #bgg .bgg-panel {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

#tool-root #bgg .bgg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

#tool-root #bgg .bgg-panel-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#tool-root #bgg .bgg-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--fg, #0b1215);
  line-height: 1.3;
}

#tool-root #bgg .bgg-sub {
  font-size: 0.85rem;
  color: var(--dim, #64748b);
  line-height: 1.4;
}

#tool-root #bgg .bgg-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
#tool-root #bgg .bgg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--fg, #0b1215);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  line-height: 1.2;
}

#tool-root #bgg .bgg-btn:hover {
  background: var(--surface-hover, #f8fafc);
  border-color: var(--dim, #94a3b8);
}

#tool-root #bgg .bgg-btn:active {
  transform: translateY(1px);
}

#tool-root #bgg .bgg-btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

#tool-root #bgg .bgg-btn-accent {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

#tool-root #bgg .bgg-btn-accent:hover {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}

#tool-root #bgg .bgg-btn-primary {
  background: var(--surface-2, #e2e8f0);
  color: var(--fg, #0b1215);
  border: 1px solid var(--line, #cbd5e1);
  font-weight: 600;
}

#tool-root #bgg .bgg-btn-primary:hover {
  background: var(--surface-3, #cbd5e1);
  border-color: var(--line-strong, #94a3b8);
}

#tool-root #bgg .bgg-btn-primary span {
  color: inherit;
}

#tool-root #bgg .bgg-icon {
  flex-shrink: 0;
}

/* Stops List */
#tool-root #bgg .bgg-stops-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tool-root #bgg .bgg-stop-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: var(--bg-alt, #f8fafc);
}

#tool-root #bgg .bgg-stop-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#tool-root #bgg .bgg-stop-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  color: var(--dim, #475569);
}

#tool-root #bgg .bgg-stop-remove-btn {
  background: transparent;
  border: none;
  color: var(--dim, #94a3b8);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tool-root #bgg .bgg-stop-remove-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

#tool-root #bgg .bgg-stop-controls {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  align-items: center;
}

#tool-root #bgg .bgg-select,
#tool-root #bgg .bgg-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.875rem;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--fg, #0b1215);
  font-family: inherit;
}

#tool-root #bgg .bgg-select:focus,
#tool-root #bgg .bgg-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

#tool-root #bgg .bgg-stop-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

#tool-root #bgg .bgg-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  cursor: pointer;
  background: transparent;
  padding: 2px;
  flex-shrink: 0;
}

#tool-root #bgg .bgg-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

#tool-root #bgg .bgg-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

#tool-root #bgg .bgg-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Steps Controls */
#tool-root #bgg .bgg-steps-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tool-root #bgg .bgg-steps-inputs {
  display: flex;
  align-items: center;
  gap: 16px;
}

#tool-root #bgg .bgg-slider {
  flex: 1;
  width: 100%;
  margin: 0;
  accent-color: #10b981;
  cursor: pointer;
}

#tool-root #bgg .bgg-steps-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#tool-root #bgg .bgg-num-input {
  width: 60px;
  padding: 6px 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--fg, #0b1215);
}

#tool-root #bgg .bgg-steps-unit {
  font-size: 0.85rem;
  color: var(--dim, #64748b);
}

/* Filters Grid */
#tool-root #bgg .bgg-filters-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#tool-root #bgg .bgg-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

#tool-root #bgg .bgg-checkbox-label:hover {
  background: var(--bg-alt, #f8fafc);
}

#tool-root #bgg .bgg-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #10b981;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

#tool-root #bgg .bgg-checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#tool-root #bgg .bgg-checkbox-text strong {
  font-size: 0.875rem;
  color: var(--fg, #0b1215);
}

#tool-root #bgg .bgg-checkbox-text small {
  font-size: 0.775rem;
  color: var(--dim, #64748b);
  line-height: 1.3;
}

/* Notice Box */
#tool-root #bgg .bgg-notice-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.875rem;
}

#tool-root #bgg .bgg-notice-box[hidden] {
  display: none !important;
}

/* Swatches Preview Row */
#tool-root #bgg .bgg-preview-panel {
  min-width: 0;
  max-width: 100%;
}

#tool-root #bgg .bgg-swatches-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line, #cbd5e1) var(--bg-alt, #f8fafc);
  padding-bottom: 10px;
}

#tool-root #bgg .bgg-swatches-scroll::-webkit-scrollbar {
  height: 8px;
}

#tool-root #bgg .bgg-swatches-scroll::-webkit-scrollbar-track {
  background: var(--bg-alt, #f1f5f9);
  border-radius: 4px;
}

#tool-root #bgg .bgg-swatches-scroll::-webkit-scrollbar-thumb {
  background: var(--line, #cbd5e1);
  border-radius: 4px;
}

#tool-root #bgg .bgg-swatches-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--dim, #94a3b8);
}

#tool-root #bgg .bgg-swatches-row {
  display: flex;
  gap: 12px;
  min-width: max-content;
  padding: 4px 0;
}

#tool-root #bgg .bgg-swatch-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 110px;
  max-width: max-content;
  flex-shrink: 0;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#tool-root #bgg .bgg-swatch-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#tool-root #bgg .bgg-swatch-step {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dim, #64748b);
}

#tool-root #bgg .bgg-swatch-box {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  flex-shrink: 0;
}

#tool-root #bgg .bgg-swatch-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg, #0b1215);
  line-height: 1.25;
  word-break: break-word;
}

#tool-root #bgg .bgg-swatch-id {
  font-size: 0.7rem;
  font-family: var(--font-mono, monospace);
  color: var(--dim, #64748b);
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

/* Export Section */
#tool-root #bgg .bgg-export-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

#tool-root #bgg .bgg-tab-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--dim, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
}

#tool-root #bgg .bgg-tab-btn:hover {
  background: var(--bg-alt, #f8fafc);
  color: var(--fg, #0b1215);
}

#tool-root #bgg .bgg-tab-btn.bgg-active {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
}

#tool-root #bgg .bgg-export-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#tool-root #bgg .bgg-textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--bg-alt, #f8fafc);
  color: var(--fg, #0b1215);
  resize: vertical;
}

#tool-root #bgg .bgg-export-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#tool-root #bgg .bgg-toast {
  font-size: 0.85rem;
  font-weight: 600;
  color: #059669;
  transition: opacity 0.2s ease;
}

/* Help Section */
#tool-root #bgg .bgg-help-panel {
  margin-top: 10px;
}

#tool-root #bgg .bgg-help-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--dim, #475569);
}

#tool-root #bgg .bgg-help-content p {
  margin: 0 0 1em 0;
}

#tool-root #bgg .bgg-help-content p:last-child {
  margin-bottom: 0;
}

/* Dark Theme Adjustments */
[data-theme="dark"] #tool-root #bgg {
  color: var(--fg, #f1f5f9);
}

[data-theme="dark"] #tool-root #bgg .bgg-panel {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
}

[data-theme="dark"] #tool-root #bgg .bgg-stop-row,
[data-theme="dark"] #tool-root #bgg .bgg-textarea,
[data-theme="dark"] #tool-root #bgg .bgg-checkbox-label:hover {
  background: var(--bg-alt, #0f172a);
  border-color: var(--line, #334155);
}

[data-theme="dark"] #tool-root #bgg .bgg-swatch-card {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
}

[data-theme="dark"] #tool-root #bgg .bgg-select,
[data-theme="dark"] #tool-root #bgg .bgg-input,
[data-theme="dark"] #tool-root #bgg .bgg-num-input {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
  color: var(--fg, #f1f5f9);
}

[data-theme="dark"] #tool-root #bgg .bgg-stop-badge {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
  color: var(--dim, #94a3b8);
}

[data-theme="dark"] #tool-root #bgg .bgg-tab-btn {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
  color: var(--dim, #94a3b8);
}

[data-theme="dark"] #tool-root #bgg .bgg-tab-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] #tool-root #bgg .bgg-btn:not(.bgg-btn-accent):not(.bgg-btn-primary) {
  background: var(--surface, #1e293b);
  border-color: var(--line, #334155);
  color: var(--fg, #f1f5f9);
}

[data-theme="dark"] #tool-root #bgg .bgg-btn:not(.bgg-btn-accent):not(.bgg-btn-primary):hover {
  background: #334155;
}

[data-theme="dark"] #tool-root #bgg .bgg-notice-box {
  background: rgba(153, 27, 27, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
