/* ============================================
   FONTGENERATOR — Right Customize Sidebar
   ============================================ */

.sidebar-right {
  width: var(--sidebar-right-w);
  flex-shrink: 0;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  height: calc(100vh - var(--navbar-h));
  position: sticky;
  top: var(--navbar-h);
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

/* === Section Title === */
.customize-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

/* === Control Groups === */
.customize-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.customize-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.customize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.customize-value {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  min-width: 40px;
  text-align: right;
  font-family: var(--font-mono);
}

/* === Range Sliders === */
.range-slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--color-primary) 0%,
    var(--color-primary) var(--progress, 40%),
    var(--color-border) var(--progress, 40%)
  );
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(124,58,237,0.3);
  transition: transform var(--transition-spring), box-shadow var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover,
.range-slider:active::-webkit-slider-thumb {
  transform: scale(1.3);
  box-shadow: 0 2px 8px rgba(124,58,237,0.4);
}

.range-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(124,58,237,0.3);
}

/* === Color Picker === */
.color-picker-wrapper {
  position: relative;
}

.color-gradient-bar {
  width: 100%;
  height: 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(to right,
    #ef4444, #f97316, #eab308,
    #22c55e, #3b82f6, #8b5cf6, #ec4899
  );
  cursor: pointer;
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.color-gradient-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
}

.color-picker-toggle {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.color-picker-toggle svg {
  width: 10px;
  height: 10px;
  color: #374151;
}

/* === Color Palette Picker === */
.color-palette-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  display: none;
}

.color-palette-dropdown.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.palette-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.palette-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast);
  border: 2px solid transparent;
}

.palette-swatch:hover {
  transform: scale(1.15);
}

.palette-swatch.active {
  border-color: white;
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Custom color input */
.color-custom-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.color-custom-input input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  background: none;
}

.color-custom-input input[type="text"] {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--color-bg-sidebar);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
}

/* === Toggle Switch === */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-spring);
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* === Select Dropdown === */
.custom-select-wrapper {
  position: relative;
}

.custom-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  padding-right: var(--space-8);
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.custom-select:hover {
  border-color: var(--color-primary-light);
}

.custom-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.custom-select-wrapper::after {
  content: '';
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted);
  pointer-events: none;
}

/* === Divider === */
.customize-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-1) 0;
}

/* === Responsive === */
@media (max-width: 1280px) {
  .sidebar-right {
    display: none;
  }
}
