.sidebar {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-shadow: var(--shadow);
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: var(--space-4) var(--space-5);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.sidebar-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.sidebar-header-sub {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.sidebar-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(to top, var(--surface) 70%, rgba(255, 255, 255, 0));
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 4px;
}

.sidebar-section {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Premium Segmented Mode Selector */
.mode-switch {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.mode-btn.active.news {
  color: var(--accent);
}

.mode-btn.active.product {
  color: var(--teal);
}

/* Beautiful form fields */
label.field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 10px 12px;
  outline: none;
  transition: var(--transition);
  resize: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
  line-height: 1.5;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.field-group:last-child {
  margin-bottom: 0;
}

/* Clean Custom Slider */
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type=range] {
  flex: 1;
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
  margin-top: -5px;
  box-shadow: var(--shadow-md);
}

input[type=range]:focus {
  box-shadow: none;
  border: none;
  background: transparent;
}

.range-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  min-width: 70px;
  text-align: right;
}

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

.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked + .toggle-slider {
  background: var(--accent);
}

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

/* Redesigned Selection Chips — 2×2 equal grid */
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  user-select: none;
  min-height: 38px; /* touch targets */
}

.check-item:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.check-item.checked {
  border-color: var(--accent);
  background: rgba(79, 70, 229, 0.05);
  color: var(--accent);
}

.check-item input {
  display: none;
}

/* File Upload Area */
.upload-area {
  border: 1px dashed var(--muted2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}

.upload-area:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79, 70, 229, 0.02);
}

.upload-area.has-file {
  border-color: var(--green);
  color: var(--green);
  background: rgba(5, 150, 105, 0.03);
}

/* Primary Generation CTA Button */
.btn-generate {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-generate:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

.btn-generate:active:not(:disabled) {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
