/* ===== THEMES ===== */

/* Theme grid — multiple per row */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
}

.theme-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.theme-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.theme-preview { height: 48px; display: flex; overflow: hidden; }
.theme-preview-swatch { flex: 1; height: 100%; }

.theme-card-body { padding: 8px 10px; }
.theme-card-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.theme-card-desc { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.theme-card-active-badge {
  position: absolute; top: 5px; right: 5px; width: 16px; height: 16px;
  background: var(--accent); border-radius: 50%; display: flex; align-items: center;
  justify-content: center; opacity: 0; transition: opacity var(--transition);
}
.theme-card.active .theme-card-active-badge { opacity: 1; }
.theme-card-active-badge svg { color: var(--bg-primary); }

.theme-card-delete {
  position: absolute; top: 5px; left: 5px; width: 18px; height: 18px;
  background: rgba(255,68,68,0.85); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; opacity: 0;
  transition: opacity var(--transition); z-index: 2;
}
.theme-card:hover .theme-card-delete { opacity: 1; }
.theme-card-delete svg { color: #fff; }

.theme-card-add {
  border-style: dashed; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  min-height: 90px; color: var(--text-muted); transition: all var(--transition);
}
.theme-card-add:hover { color: var(--text-secondary); border-color: var(--border-hover); background: var(--bg-hover); }
.theme-card-add span { font-size: 11px; font-weight: 600; }

/* ===== WALLPAPER — horizontal layout ===== */
.wallpaper-section {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.wallpaper-preview-wrap {
  width: 180px; height: 100px; flex-shrink: 0;
  background: var(--bg-active); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.wallpaper-preview-img { width: 100%; height: 100%; object-fit: cover; display: none; }
.wallpaper-preview-img.visible { display: block; }
.wallpaper-preview-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--text-muted);
}
.wallpaper-preview-placeholder svg { opacity: 0.35; }
.wallpaper-preview-placeholder span { font-size: 11px; }

.wallpaper-controls {
  display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 160px;
}

.wallpaper-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.wallpaper-upload-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 13px;
  background: var(--bg-active); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.wallpaper-upload-btn:hover { color: var(--text-primary); border-color: var(--border-hover); background: var(--bg-hover); }

.wallpaper-clear-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 13px;
  background: rgba(255,68,68,0.07); border: 1px solid rgba(255,68,68,0.2);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  color: var(--danger); cursor: pointer; transition: all var(--transition);
}
.wallpaper-clear-btn:hover { background: rgba(255,68,68,0.14); border-color: rgba(255,68,68,0.4); }

.wallpaper-fit-row { display: flex; gap: 5px; flex-wrap: wrap; }
.fit-btn {
  padding: 4px 10px; background: var(--bg-active); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.fit-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.fit-btn.active { color: var(--text-primary); background: var(--bg-hover); border-color: rgba(255,255,255,0.25); }

/* ===== PARTICLE SLIDERS ===== */
.particle-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-active);
  border: 1px solid var(--border);
  cursor: pointer;
  outline: none;
  transition: background var(--transition);
}
.particle-slider:hover { background: var(--bg-hover); }
.particle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 40%, transparent);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.particle-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.particle-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  cursor: pointer;
}

/* ===== THEME EDITOR MODAL ===== */
.theme-editor-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px); z-index: 8000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.theme-editor {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 540px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px); overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.theme-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-secondary); z-index: 1;
}
.theme-editor-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.theme-editor-close {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition);
}
.theme-editor-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-editor-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.theme-editor-preview {
  height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border);
  overflow: hidden; display: flex;
}
.theme-editor-preview-swatch { flex: 1; transition: background 0.25s ease; }

.theme-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-color-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.theme-color-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-color-input-wrap { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.theme-color-swatch-wrap { position: relative; width: 22px; height: 22px; }
.theme-color-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); }
.theme-color-swatch-wrap input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: none; padding: 0; }
.theme-color-hex { font-size: 10px; font-family: monospace; color: var(--text-muted); width: 54px; background: var(--bg-active); border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; text-align: center; }
.theme-color-hex:focus { border-color: rgba(255,255,255,0.2); outline: none; color: var(--text-primary); }

.theme-editor-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 22px 18px; border-top: 1px solid var(--border);
}

/* ===== ACCENT COLOR PICKER ===== */
.accent-picker-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.accent-picker-wrap:hover { border-color: var(--border-hover); }

.accent-swatch {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: background 0.2s ease;
}
