/* ============================================
   SPODIC - Settings Panel (Sidebar Content)
   Flat design without floating panel
   ============================================ */

/* Close button moved to utility-sidebar.css */
.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s ease;
}

.close-btn:hover {
  background: var(--control-hover);
  opacity: 1;
}

.close-btn svg {
  width: 18px;
  height: 18px;
}

/* Scrollable Content */
.settings-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: block;
  min-height: 0;
  width: 100%;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.settings-content::-webkit-scrollbar {
  width: 6px;
}

.settings-content::-webkit-scrollbar-track {
  background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.settings-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Collapsible Sections
   ============================================ */

.settings-section {
  border-radius: 12px;
  background: transparent;
  margin-bottom: 4px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.section-header:hover {
  background: var(--control-hover);
}

.section-header span {
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-transform: none;
  opacity: 0.9;
}

.section-header .chevron {
  opacity: 0.4;
  transition: transform 0.2s ease;
}

.settings-section.expanded .section-header .chevron {
  transform: rotate(180deg);
}

/* Section Body - Simple max-height collapse */
.section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.15s ease-out;
  /* Faster collapse */
}

.settings-section.expanded .section-body {
  max-height: 800px;
  /* Large enough for any content */
  transition: max-height 0.3s ease-in;
}

.section-body-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
}

/* ============================================
   Setting Rows - Unified Design
   ============================================ */

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  transition: background 0.15s ease;
  min-height: 44px;
}

/* .setting-row:hover removed for simpler design */

.setting-row>span,
.setting-row>label:first-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
}

/* Setting with Slider */
.setting-slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: transparent;
  transition: background 0.15s ease;
}

/* .setting-slider-row:hover removed for simpler design */

.setting-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-slider-header span:first-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
}

.setting-slider-header span:last-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Form Elements
   ============================================ */

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  margin: 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 13px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background-color: white;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
  background-color: var(--orp-color);
}

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

/* Color Picker */
.color-picker-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  padding: 0;
  background: none;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.color-picker-input:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}

.color-picker-input::-webkit-color-swatch {
  border-radius: 50%;
  border: none;
}

.color-picker-input::-moz-color-swatch {
  border-radius: 50%;
  border: none;
}

/* Theme Grid - Compact Circular Swatches */
.theme-grid {
  display: flex;
  gap: 12px;
  padding: 8px 0 16px;
  justify-content: flex-start;
}

.theme-grid.compact {
  gap: 10px;
  justify-content: center;
}

.theme-option {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  position: relative;
}

.theme-option:hover {
  opacity: 0.9;
}

.theme-option.active {
  opacity: 1;
}

/* Hide text labels in compact mode */
.theme-grid.compact .theme-option span {
  display: none;
}

/* Compact circular swatches */
.theme-grid.compact .swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0;
  /* Hide Aa text */
}

/* Checkmark icon for selected state */
.theme-option .check-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  color: inherit;
  pointer-events: none;
}

.theme-option.active .check-icon {
  opacity: 1;
}

/* Dark theme checkmarks need light color */
.theme-option[data-theme="ember"] .check-icon,
.theme-option[data-theme="midnight"] .check-icon,
.theme-option[data-theme="matcha"] .check-icon,
.theme-option[data-theme="slate"] .check-icon {
  color: #e0e0e0;
}

/* Light theme checkmarks need dark color */
.theme-option[data-theme="paper"] .check-icon,
.theme-option[data-theme="sakura"] .check-icon,
.theme-option[data-theme="flower"] .check-icon {
  color: #1a1a1a;
}

.swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Theme previews with text */
.swatch.ember {
  background: #252525;
  color: #e0e0e0;
}

.swatch.paper {
  background: #f5f4f1;
  color: #1c1c1c;
}

.swatch.sakura,
.swatch.flower {
  background: #fce8ee;
  color: #2e1a1f;
}

.swatch.midnight {
  background: #121825;
  color: #c8cdd8;
}

.swatch.matcha {
  background: #161a14;
  color: #cdd4c5;
}

.swatch.slate {
  background: #1a1a1e;
  color: #b8b8bf;
}

.theme-option.active .swatch {
  border-color: var(--orp-color);
  box-shadow: 0 0 0 2px var(--orp-color), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ============================================
   Footer Button
   ============================================ */

.settings-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  background: var(--sidebar-bg);
}

.btn-text {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.7;
}

.btn-text:hover {
  background: var(--control-hover);
  opacity: 1;
}

.settings-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-link-subtle {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.settings-link-subtle:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ============================================
   Guide Options Container
   ============================================ */

#guide-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

/* Nested Headers & Selects (Added) */
.sub-section-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  opacity: 0.5;
  margin: 16px 0 8px 4px;
  font-weight: 700;
}

.sub-section-header:first-child {
  margin-top: 4px;
}

/* ============================================
   Button Groups (Font Family, Weight, Method, Transition)
   ============================================ */

.font-family-row,
.weight-row,
.method-row,
.transition-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.font-family-row>span,
.weight-row>span,
.method-row>span,
.transition-row>span {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  opacity: 0.85;
}

.font-family-buttons,
.weight-buttons,
.method-buttons,
.transition-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.font-btn,
.weight-btn,
.method-btn,
.transition-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.7;
}

.font-btn:hover,
.weight-btn:hover,
.method-btn:hover,
.transition-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.font-btn.active,
.weight-btn.active,
.method-btn.active,
.transition-btn.active {
  background: var(--orp-color);
  border-color: var(--orp-color);
  color: #fff;
  opacity: 1;
}

/* Custom Font Input Row */
.custom-font-row {
  padding: 8px 12px;
}

.text-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input::placeholder {
  color: var(--text);
  opacity: 0.4;
}

.text-input:focus {
  border-color: var(--orp-color);
}

/* ============================================
   Collapsible Sub-sections (Guides)
   ============================================ */

.sub-section {
  margin-top: 8px;
  border-radius: 8px;
}

.sub-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sub-section-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sub-section-toggle span {
  opacity: 0.8;
}

.sub-section-toggle .chevron-small {
  opacity: 0.4;
  transition: transform 0.2s ease;
}

.sub-section.expanded .sub-section-toggle .chevron-small {
  transform: rotate(180deg);
}

/* Sub-section Body - Simple max-height collapse */
.sub-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
}

.sub-section.expanded .sub-section-body {
  max-height: 500px;
  transition: max-height 0.25s ease-in;
}

.sub-section-body-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

/* ============================================
   Sidebar Google Fonts Autocomplete
   ============================================ */

.custom-font-row {
  flex-direction: column !important;
  gap: 4px !important;
}

.sidebar-font-results {
  display: none;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  background: var(--sidebar-bg);
}

.sidebar-font-results.is-open {
  display: block;
}

.sidebar-font-results .custom-font-option {
  display: block;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.sidebar-font-results .custom-font-option:hover {
  background: var(--control-hover);
}

.sidebar-font-results .custom-font-option.active {
  color: var(--orp-color);
  font-weight: 600;
}

.sidebar-font-hint {
  font-size: 10px;
  color: var(--text);
  opacity: 0.4;
  padding: 0 2px;
}