/* ================================================
   COPELLA SURVEY MODAL - STYLES
   Modern Design 2025 - Matching Topics & Blocks Style
   ================================================ */

/* Убираем горизонтальную прокрутку браузера */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
}

/* Font Definitions */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@700;800;900&display=swap');

@font-face {
  font-family: 'Gilroy-SemiBold';
  src: url('https://copella.live/assets/fonts/Gilroy-SemiBold.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gilroy-Bold';
  src: url('https://copella.live/assets/fonts/Gilroy-Bold.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --cp-bg: #0b0b0b;
  --cp-card: #121212;
  --cp-text: #fff;
  --cp-dim: rgba(255, 255, 255, 0.6);
  --cp-accent: #00ff88;
  --cp-accent-hover: #00e07a;
  --cp-radius: 20px;
  --cp-border: rgba(255, 255, 255, 0.08);
  --cp-border-hover: rgba(255, 255, 255, 0.12);
}

.cp-survey-open {
  overflow: hidden;
}

#cp-survey-modal[hidden] {
  display: none;
}

#cp-survey-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  font-family: 'Gilroy-SemiBold', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

.cp-survey-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: saturate(120%) blur(4px);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cp-survey-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  background: var(--cp-card);
  color: var(--cp-text);
  width: min(600px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 32px 28px 28px;
  border-radius: var(--cp-radius);
  border: 1px solid var(--cp-border);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 1;
  isolation: isolate;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease,
              box-shadow 0.3s ease;
  box-sizing: border-box;
  position: relative;
}

.cp-survey-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--cp-radius);
  background: radial-gradient(85% 85% at 50% 50%, rgba(0, 255, 136, 0.08) 0%, rgba(0, 0, 0, 0) 60%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(12px);
  pointer-events: none;
}

.cp-survey-card * {
  box-sizing: border-box;
}

#cp-survey-modal.is-open .cp-survey-backdrop {
  opacity: 1;
}

#cp-survey-modal.is-open .cp-survey-card {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#cp-survey-modal.is-open .cp-survey-card::before {
  opacity: 0.5;
}

#cp-survey-modal.is-closing .cp-survey-backdrop {
  opacity: 0;
}

#cp-survey-modal.is-closing .cp-survey-card {
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .cp-survey-backdrop,
  .cp-survey-card,
  .cp-survey-card::before {
    transition: none;
  }
}

.cp-survey-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 28px;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.cp-survey-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
}

.cp-survey-close:active {
  transform: scale(0.95);
}

.cp-survey-heading {
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.2;
  margin: 0 0 12px;
  font-weight: 800;
  text-align: center;
  font-family: 'Unbounded', 'Gilroy-Bold', sans-serif;
  letter-spacing: -0.02em;
  color: #fff;
}

.cp-survey-question {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin: 0 0 24px;
  line-height: 1.5;
  font-weight: 500;
}

.cp-survey-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cp-survey-option {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--cp-border);
  background: transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cp-survey-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.04);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.cp-survey-option:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--cp-border-hover);
  transform: translateX(2px);
}

.cp-survey-option:hover::before {
  opacity: 1;
}

.cp-survey-option:has(input:checked) {
  background: rgba(0, 255, 136, 0.08);
  border-color: rgba(0, 255, 136, 0.2);
  box-shadow: 
    0 0 0 1px rgba(0, 255, 136, 0.1),
    0 4px 12px rgba(0, 255, 136, 0.1);
}

.cp-survey-option:has(input:checked)::before {
  background: rgba(0, 255, 136, 0.06);
  opacity: 1;
}

.cp-radio {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: inline-grid;
  place-items: center;
  position: relative;
  background: transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.cp-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cp-accent);
  transform: scale(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.cp-radio:checked {
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
  background: rgba(0, 255, 136, 0.1);
}

.cp-radio:checked::after {
  transform: scale(1);
}

.cp-survey-option span {
  flex: 1;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.cp-survey-option:has(input:checked) span {
  font-weight: 600;
  color: #fff;
}

.cp-survey-other {
  margin-left: 36px;
  margin-top: 4px;
  display: none;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cp-survey-other.show {
  display: block;
}

.cp-survey-other input {
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--cp-border);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-family: 'Gilroy-SemiBold', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cp-survey-other input:focus {
  outline: none;
  border-color: var(--cp-accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.cp-survey-other.error input {
  border-color: rgba(255, 76, 76, 0.5);
  background: rgba(255, 76, 76, 0.05);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { 
    transform: translateX(0); 
  }
  10%, 30%, 50%, 70%, 90% { 
    transform: translateX(-4px); 
  }
  20%, 40%, 60%, 80% { 
    transform: translateX(4px); 
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-survey-other.error input {
    animation: none;
  }
}

.cp-survey-other input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  opacity: 1;
  font-family: 'Gilroy-SemiBold', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

.cp-survey-submit {
  margin: 8px auto 0;
  padding: 14px 28px;
  background: var(--cp-accent);
  color: #000;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Gilroy-Bold', 'Gilroy-SemiBold', system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 160px;
}

.cp-survey-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cp-survey-submit:hover {
  background: var(--cp-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.25);
}

.cp-survey-submit:hover::before {
  opacity: 1;
}

.cp-survey-submit:active {
  transform: translateY(0);
}

.cp-survey-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  position: relative;
}

.cp-survey-submit:disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: loading-shimmer 1.5s ease-in-out infinite;
}

@keyframes loading-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-survey-submit:disabled::after {
    animation: none;
  }
}

.cp-survey-help {
  margin: 12px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1.5;
}

.cp-survey-thanks {
  padding: 40px 0;
  text-align: center;
  font-size: 18px;
  color: var(--cp-accent);
  font-weight: 600;
}

/* A11y */
.cp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fallback для браузеров без поддержки :has() */
@supports not selector(:has(*)) {
  .cp-survey-option input:checked + span {
    font-weight: 600;
    color: #fff;
  }
  
  .cp-survey-option input:checked ~ span {
    font-weight: 600;
    color: #fff;
  }
  
  .cp-survey-option.checked {
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.2);
    box-shadow: 
      0 0 0 1px rgba(0, 255, 136, 0.1),
      0 4px 12px rgba(0, 255, 136, 0.1);
  }
  
  .cp-survey-option.checked::before {
    background: rgba(0, 255, 136, 0.06);
    opacity: 1;
  }
}

/* Планшеты */
@media (min-width: 768px) and (max-width: 1024px) {
  .cp-survey-card {
    width: min(640px, 86vw);
    padding: 30px 26px;
    border-radius: 22px;
  }
}

/* Мобильные устройства */
@media (max-width: 640px) {
  .cp-survey-card {
    width: calc(100vw - 32px);
    padding: 24px 20px;
    border-radius: 18px;
  }
  
  .cp-survey-heading {
    font-size: 22px;
    margin-bottom: 10px;
  }
  
  .cp-survey-question {
    font-size: 16px;
    margin-bottom: 20px;
  }
  
  .cp-survey-option {
    font-size: 15px;
    padding: 14px 16px;
    gap: 12px;
  }
  
  .cp-survey-submit {
    width: 100%;
    font-size: 15px;
    padding: 14px;
  }
  
  .cp-survey-close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 24px;
  }
}

/* Маленькие экраны */
@media (max-width: 420px) {
  .cp-survey-card {
    width: calc(100vw - 24px);
    padding: 22px 18px;
    border-radius: 16px;
  }
  
  .cp-survey-heading {
    font-size: 20px;
  }
  
  .cp-survey-question {
    font-size: 15px;
  }
  
  .cp-survey-option {
    font-size: 14px;
    padding: 12px 14px;
  }
  
  .cp-survey-other {
    margin-left: 26px;
  }
}

/* Плотные старые экраны (Lumia/старые Android) */
@media screen and (max-width: 360px), screen and (max-height: 560px) {
  .cp-survey-card {
    top: 52%;
    transform: translate(-50%, -50%) scale(1);
    max-height: 90vh;
    width: calc(100vw - 24px);
  }
  
  #cp-survey-modal.is-open .cp-survey-card {
    transform: translate(-50%, -50%) scale(1);
  }
}

