/* ============================================================
   Панель управления (Fixed)
   ============================================================ */

/* 1. Сама панель */
.control-panel {
  position: fixed !important; 
  inset: auto 0 0 !important;
  bottom: 0 !important; 
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  background: transparent !important;
  z-index: 2147483647 !important;
  display: flex !important;
  justify-content: flex-end !important; 
  align-items: flex-end !important;
  padding-bottom: 20px !important; 
  padding-right: 30px !important;
  pointer-events: none !important; 
  margin: 0 !important;
  transform: none !important;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Состояние "скрыто" при скролле */
.control-panel.is-hidden {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none !important;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 2. Плашка с выключателями */
.control-panel__inner {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  pointer-events: auto; 
  background: rgb(20 20 20 / 60%);
  backdrop-filter: blur(15px);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  border: 1px solid rgb(255 255 255 / 8%);
  box-shadow: 0 5px 20px rgb(0 0 0 / 20%);
  max-width: 100%;
}

/* --- ОБЕРТКИ (работают везде) --- */
.control-panel__switches {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.control-panel__actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

/* 3. Обертка для выключателя */
.switch-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.switch-title {
  font-family: Comfortaa, system-ui, sans-serif;
  font-size: 0.65rem;
  color: #D1D1D1; 
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s, text-shadow 0.3s;
  text-shadow: 0 1px 2px rgb(0 0 0 / 80%); 
}

/* Подсветка названия при включении (янтарный) */
.switch-wrapper.is-on .switch-title {
  color: #C8963E;
  text-shadow: 0 0 8px rgb(200 150 62 / 60%), 0 1px 2px rgb(0 0 0 / 80%);
}

/* 4. СЕНСОРНАЯ ПАНЕЛЬ */
.real-switch {
  display: inline-block;
}

.real-switch__body {
  width: 40px;
  height: 40px;
  background: rgb(42 42 42 / 80%);
  border-radius: 10px;
  border: 1px solid rgb(255 255 255 / 10%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.real-switch__indicator {
  width: 8px;
  height: 8px;
  background: #444;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* Состояние ВКЛ (базовое) */
.switch-wrapper.is-on .real-switch__body {
  background: rgb(200 150 62 / 15%);
  border-color: #C8963E;
  box-shadow: 0 0 10px rgb(200 150 62 / 20%);
}

body.flicker-effect .btn--accent, 
body.flicker-effect .real-switch__indicator {
  animation: flicker-anim 3s ease-in-out infinite;
}

.switch-wrapper.is-on .real-switch__indicator {
  background: #C8963E;
  box-shadow: 0 0 6px #C8963E, 0 0 10px #C8963E;
}

/* Разделитель в панели */
.control-panel__divider {
  width: 1px;
  height: 30px;
  background: rgb(255 255 255 / 10%);
  margin: 0 0.5rem;
}

/* Круглые кнопки действий */
.panel-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(42 42 42 / 80%);
  color: #D1D1D1;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid rgb(255 255 255 / 10%);
  margin-bottom: 0.2rem;
  cursor: pointer;
}

.panel-action:hover {
  background: #C8963E;
  color: #1E1E1E;
  border-color: #C8963E;
}

/* Кнопка Telegram */
.panel-action--tg {
  background: #08c !important;
  color: #FFF !important;
  border-color: #08c !important;
}

.panel-action--tg:hover {
  background: #0077b3 !important;
  border-color: #0077b3 !important;
  color: #FFF !important;
}

/* Кнопка звонка — янтарная */
.panel-action--phone {
  background: #C8963E;
  color: #1E1E1E;
  border-color: #C8963E;
}

.panel-action--phone:hover {
  background: #E0B03A;
  border-color: #E0B03A;
  color: #1E1E1E;
}

/* Кнопка перехода к заявке — графит с золотой обводкой */
.panel-action--lead {
  background: rgb(42 42 42 / 90%);
  color: #C8963E;
  border-color: rgb(200 150 62 / 60%);
}

.panel-action--lead:hover {
  background: #C8963E;
  border-color: #C8963E;
  color: #1E1E1E;
}

/* ============================================================
   ЭФФЕКТЫ
   ============================================================ */

@keyframes flicker-anim {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes flicker-color {
  0%, 100% { color: #1E1E1E; opacity: 1; transform: scale(1); }
  50% { color: #C8963E; opacity: 0.7; transform: scale(1.01); }
}

body.flicker-effect h1, 
body.flicker-effect h2 {
  animation: flicker-color 3s ease-in-out infinite;
}

@keyframes wind-sway {
  0% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(2deg) translateX(3px); }
  75% { transform: rotate(-2deg) translateX(-3px); }
  100% { transform: rotate(0deg) translateX(0); }
}

body.wind-effect img {
  animation: wind-sway 3s linear infinite; 
  transform-origin: bottom center;
  will-change: transform;
}

body.wind-effect h1, 
body.wind-effect h2 {
  animation: wind-sway 4s linear infinite;
  will-change: transform;
}

/* 3. Подсветка (Неоновая рамка) */
body.neon-border-active .control-panel::before {
  content: "";
  position: fixed;
  inset: 10px;
  border: 2px solid #C8963E;
  border-radius: 20px;
  z-index: 99997;
  pointer-events: none;
  box-shadow: 0 0 20px rgb(200 150 62 / 50%), inset 0 0 20px rgb(200 150 62 / 30%);
  animation: neon-pulse 2s infinite alternate;
}

@keyframes neon-pulse {
  from { opacity: 0.5; box-shadow: 0 0 10px rgb(200 150 62 / 30%); }
  to { opacity: 1; box-shadow: 0 0 30px rgb(200 150 62 / 80%); }
}

/* Запрет горизонтального скролла */
html, body {
  overflow-x: clip !important;
  max-width: 100vw;
}

/* ============================================================
   Мобильная версия
   ============================================================ */
@media (width <= 768px) {
  .control-panel {
    padding-bottom: 15px !important;
    padding-right: 0 !important;
    justify-content: center !important;
  }

  .control-panel__inner {
    flex-flow: column nowrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    width: calc(100% - 30px);
    max-width: 400px;
  }

  /* Выключатели в ряд (благодаря обертке) */
  .control-panel__switches {
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }

  /* Кнопки связи на второй строке */
  .control-panel__actions {
    justify-content: center;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(255 255 255 / 10%);
    width: 100%;
  }

  /* Скрываем вертикальный разделитель */
  .control-panel__divider {
    display: none !important;
  }

  .panel-action {
    margin: 0;
    width: 40px;
    height: 40px;
  }

  .real-switch__body {
    width: 40px;
    height: 40px;
  }

  .switch-title {
    font-size: 0.6rem;
  }

  /* Скрываем панель, когда дошли до футера */
  .control-panel.is-hidden-at-footer {
    opacity: 0;
    transform: translateY(100%) !important;
    pointer-events: none;
  }
}