/* ══════════════════════════════════════════════════════════════
   ОБЪЕДИНЕННАЯ ПАНЕЛЬ НАСТРОЕК ТЕМ
   ══════════════════════════════════════════════════════════════ */

.theme-panel-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
  flex-shrink: 0;
  padding: 0;
  position: relative;
}

.theme-panel-btn:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  transform: rotate(90deg);
}

.theme-panel-btn svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .3s;
}

.theme-panel-btn:hover svg {
  stroke: var(--accent);
}

/* Индикатор текущей темы */
.theme-panel-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}

/* Панель настроек */
.theme-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: all .3s ease;
  z-index: 1000;
  width: 320px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.theme-panel::-webkit-scrollbar {
  width: 6px;
}

.theme-panel::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 3px;
}

.theme-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.theme-panel::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.theme-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.theme-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.theme-panel-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
}

.theme-panel-section {
  margin-bottom: 18px;
}

.theme-panel-section:last-child {
  margin-bottom: 0;
}

.theme-panel-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

/* Переключатель темная/светлая */
.theme-mode-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.theme-mode-option {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-mode-option:hover {
  color: var(--white);
  background: rgba(var(--accent-rgb), 0.05);
}

.theme-mode-option.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.theme-mode-option svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Сетка цветовых схем */
.color-scheme-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-scheme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .25s;
}

.color-scheme-option:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: var(--bg);
}

.color-scheme-option.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.color-preview {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.color-preview-dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
}

.color-scheme-info {
  flex: 1;
}

.color-scheme-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}

.color-scheme-desc {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

.color-scheme-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.color-scheme-option.active .color-scheme-check {
  border-color: var(--accent);
  background: var(--accent);
}

.color-scheme-check::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: all .2s;
}

.color-scheme-option.active .color-scheme-check::after {
  opacity: 1;
  transform: scale(1);
}

/* Разделитель */
.theme-panel-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── ОПЦИИ ШРИФТОВ ── */
.font-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.font-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .25s;
}

.font-option:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: var(--bg);
}

.font-option.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.font-preview {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}

.font-info {
  flex: 1;
}

.font-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}

.font-desc {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

.font-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.font-option.active .font-check {
  border-color: var(--accent);
  background: var(--accent);
}

.font-check::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: all .2s;
}

.font-option.active .font-check::after {
  opacity: 1;
  transform: scale(1);
}

/* Светлая тема */
html.light .theme-panel {
  background: var(--surface);
  box-shadow: 
    0 0 0 1px rgba(0,0,0,0.04),
    0 4px 16px rgba(0,0,0,0.08),
    0 16px 48px rgba(0,0,0,0.06);
}

html.light .color-scheme-option {
  background: var(--surface2);
  border-color: rgba(0,0,0,0.06);
}

html.light .color-scheme-option:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: #ffffff;
}

html.light .color-preview-dot {
  border-color: rgba(0,0,0,0.08);
}

html.light .theme-mode-toggle {
  background: var(--surface2);
  border-color: rgba(0,0,0,0.06);
}

html.light .font-option {
  background: var(--surface2);
  border-color: rgba(0,0,0,0.06);
}

html.light .font-option:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: #ffffff;
}

html.light .font-preview {
  background: var(--bg);
  border-color: rgba(0,0,0,0.08);
}

/* Адаптивность */
@media (max-width: 768px) {
  .theme-panel {
    right: -12px;
    min-width: 300px;
  }
  
  .theme-panel-btn {
    display: flex;
  }
}
