/* ==========================================================================
   Color Switcher Component Styles (Right-Aligned / RTL)
   ========================================================================== */

.color-switcher {
  position: fixed;
  top: 85px; /* ارتفاع بهینه شده نزدیک هدر و جلوگیری از همپوشانی با هیرو */
  right: -240px; /* وضعیت پیش‌فرض: پنهان در لبه سمت راست */
  left: auto;
  display: flex;
  align-items: flex-start;
  direction: rtl;
  z-index: 1050;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.color-switcher.active {
  transform: translateX(-240px) translateZ(0); /* باز شدن روان به سمت داخل صفحه */
}

/* Panel Body */
.color-switcher-panel {
  width: 240px;
  background-color: var(--bg-card-glass, rgba(22, 25, 30, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 16px 0 0 16px;
  padding: 1.25rem 1rem;
  box-shadow: -8px 12px 35px rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

[data-bs-theme="light"] .color-switcher-panel {
  box-shadow: -8px 12px 35px rgba(0, 0, 0, 0.08);
}

.color-switcher-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme Mode Switch (Dark / Light Buttons) */
.theme-mode-section {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.theme-mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: rgba(125, 125, 125, 0.08);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base, all 0.3s ease);
}

.theme-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
}

.theme-btn.active {
  background-color: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Color Swatches Grid */
.color-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.color-option-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  outline: none;
  padding: 0;
}

.color-option-btn:hover {
  transform: scale(1.15);
}

.color-option-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

[data-bs-theme="light"] .color-option-btn.active {
  border-color: #1c1917;
}

.color-option-btn i {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.color-option-btn.active i {
  opacity: 1;
}

/* Gradient Swatches Grid */
.gradient-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.gradient-option-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  outline: none;
  padding: 0;
}

.gradient-option-btn:hover {
  transform: scale(1.15);
}

.gradient-option-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

[data-bs-theme="light"] .gradient-option-btn.active {
  border-color: #1c1917;
}

.gradient-option-btn i {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gradient-option-btn.active i {
  opacity: 1;
}

/* Floating Toggle Gear Button */
.color-switcher-toggle {
  width: 44px;
  height: 44px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 12px 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-color);
  box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease, color 0.3s ease;
  padding: 0;
}

[data-bs-theme="light"] .color-switcher-toggle {
  box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.08);
}

.color-switcher-toggle:hover {
  background-color: var(--bg-card);
  filter: brightness(1.1);
}

/* Spinning Gear Animation */
.color-switcher-toggle i {
  font-size: 1.25rem;
  animation: spinGear 6s linear infinite;
  display: inline-block;
}

@keyframes spinGear {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
