/* CSS Variables for consistent theming */
:root {
  --primary-blue: #2982ff;
  --secondary-blue: #24AAE1;
  --accent-red: #FF6F64;
  --accent-red-hover: #ED5A4F;
  --error-color: #ff4757;
  --error-bg: rgba(255, 71, 87, 0.1);
  --success-color: #2ed573;
  --success-bg: rgba(46, 213, 115, 0.1);
  --white: #fff;
  --text-light: rgba(255, 255, 255, 0.8);
  --border-light: #cfd0d3;
  --shadow-blue: rgba(36, 155, 203, 0.55);
  --shadow-soft: rgba(0, 0, 0, 0.1);
  --border-radius-lg: 30px;
  --border-radius-md: 15px;
  --border-radius-sm: 5px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Wrapper Styles */
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 2rem;
  box-sizing: border-box;
}

/* Trigger Button */
.open-popup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  text-transform: uppercase;
  background: var(--primary-blue);
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  border: 2px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  font-family: Inter, sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(41, 130, 255, 0.3);
}

.open-popup:hover {
  background: #1a6de0;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(41, 130, 255, 0.4);
}

.open-popup:active {
  transform: translateY(0);
}

/* Popup Overlay */
.popup__bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.popup__bg.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Popup Container */
.popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: linear-gradient(135deg, var(--secondary-blue) 0%, #1a8bc0 100%);
  width: 90%;
  max-width: 400px;
  padding: 2.5rem;
  transition: var(--transition);
  border-radius: var(--border-radius-lg);
  opacity: 0;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.15),
    0 8px 32px var(--shadow-blue);
}

.popup.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Popup Content */
.popup.active picture {
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup.active img {
  margin: 0.5rem 0 1.25rem;
  height: 50px;
  max-width: none;
  object-fit: contain;
}

.popup h6 {
  color: var(--white);
  font-family: Inter, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  margin: 0.5rem 0 1.5rem;
  text-align: center;
}

.popup.active h6 {
  color: var(--white);
  font-family: Inter, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  margin: 0.5rem 0 1.5rem;
}

/* Close Button */
.close-popup {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--white);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.1);
  border: none;
}

.close-popup:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* Form Elements */
.popup label {
  width: 100%;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column-reverse;
  position: relative;
}

.popup .label__text {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.5rem;
  transition: var(--transition);
  letter-spacing: 0.5px;
}

.popup input {
  width: 100%;
  height: 48px;
  font-size: 1rem;
  font-family: Inter, sans-serif;
  border: 2px solid transparent;
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  padding: 0 1rem;
  border-radius: 25px;
  color: var(--white) !important;
  transition: var(--transition);
}

.popup input[type="tel"] {
  color: var(--white) !important;
}

.popup input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

.popup input[type="tel"]::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Стили для автозаполнения */
.popup input:-webkit-autofill,
.popup input:-webkit-autofill:hover,
.popup input:-webkit-autofill:focus,
.popup input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--white) !important;
  -webkit-box-shadow: 0 0 0px 1000px rgba(255, 255, 255, 0.1) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.popup input:autofill {
  color: var(--white) !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.popup input:focus {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

.popup input[type="tel"]:focus {
  color: var(--white) !important;
}

/* Стили для невалидных полей */
.popup input.wpcf7-not-valid {
  border-color: var(--error-color) !important;
  background: var(--error-bg) !important;
  box-shadow: 0 0 0 1px var(--error-color);
  color: var(--white) !important;
}

.popup input.wpcf7-not-valid::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Textarea Styles */
.popup textarea {
  resize: vertical;
  width: 100%;
  min-height: 120px;
  font-size: 1rem;
  font-family: Inter, sans-serif;
  border: 2px solid transparent;
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  padding: 1rem;
  border-radius: 20px;
  color: var(--white);
  transition: var(--transition);
}

.popup textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.popup textarea:focus {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.popup textarea:focus + .label__text {
  color: var(--white);
  transform: translateY(-2px);
}

/* Submit Button */
.popup button {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Inter, sans-serif;
  font-weight: 600;
  color: var(--white);
  font-size: 0.875rem;
  background: var(--accent-red);
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  transition: var(--transition);
  border-radius: var(--border-radius-md);
  margin: 2rem 0 1rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(255, 111, 100, 0.3);
}

.popup button:hover {
  background: var(--accent-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(237, 90, 79, 0.4);
}

.popup button:active {
  transform: translateY(0);
}

/* Стили для чекбокса согласия */
.formbox__wraptext {
  margin-top: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 2px solid transparent;
  transition: var(--transition);
}

/* Стили для невалидного чекбокса согласия */
.formbox__wraptext input[type="checkbox"].wpcf7-not-valid {
  accent-color: var(--error-color) !important;
  outline: 2px solid var(--error-color) !important;
  outline-offset: 2px;
}

.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) {
  border-color: var(--error-color) !important;
  background: var(--error-bg) !important;
  box-shadow: 0 0 0 1px var(--error-color);
}

.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) .conf__text {
  color: var(--error-color) !important;
}

.formbox__wraptext.wpcf7-not-valid {
  border-color: var(--error-color) !important;
  background: var(--error-bg) !important;
  box-shadow: 0 0 0 1px var(--error-color);
}

.formbox__wraptext.wpcf7-not-valid .conf__text {
  color: var(--error-color) !important;
}

.formbox__wraptext.wpcf7-not-valid input[type="checkbox"] {
  accent-color: var(--error-color) !important;
  outline: 2px solid var(--error-color) !important;
  outline-offset: 2px;
}

.formbox__wraptext:focus-within {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.formbox__wraptext input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  flex-shrink: 0;
  accent-color: var(--accent-red);
  cursor: pointer;
  position: relative;
  top: 0;
}

/* Confirmation Text */
.popup .conf__text {
  color: var(--text-light);
  font-family: Inter, sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  margin: 10px;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
}

/* Стили для ссылки в тексте согласия */
.popup .conf__text a {
  color: rgba(255, 255, 255, 0.9) !important;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  transition: var(--transition);
}

.popup .conf__text a:hover {
  color: var(--white) !important;
  border-bottom-color: var(--white);
}

/* Для невалидного состояния */
.formbox__wraptext.wpcf7-not-valid .conf__text a,
.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) .conf__text a {
  color: var(--error-color) !important;
  border-bottom-color: var(--error-color);
}

.formbox__wraptext.wpcf7-not-valid .conf__text a:hover,
.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) .conf__text a:hover {
  color: var(--error-color) !important;
  border-bottom-color: var(--error-color);
  opacity: 0.8;
}

.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) .conf__text {
  color: var(--error-color) !important;
}

.formbox__wraptext:hover .conf__text {
  color: var(--white);
}

/* Contact Form 7 Specific Styles */
.formbox__wrapbtn {
  display: inline-block;
  width: 100%;
}

.access {
  display: inline-flex;
}

.access__submit {
  position: relative;
  vertical-align: middle;
}

/* Скрываем стандартные сообщения об ошибках CF7 */
.wpcf7-not-valid-tip {
  display: none !important;
}

/* Оставляем только общие сообщения формы */
.wpcf7 form .wpcf7-response-output {
  margin: 1rem 0 0 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  animation: slideIn 0.4s ease;
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output {
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.1);
  color: #ffb8b8;
}

.wpcf7 form.sent .wpcf7-response-output {
  border-color: rgba(81, 207, 102, 0.3);
  background: rgba(81, 207, 102, 0.1);
  color: #a8ffb8;
}

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

/* Анимация "тряски" для невалидных полей */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.popup input.wpcf7-not-valid,
.formbox__wraptext.wpcf7-not-valid,
.formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) {
  animation: shake 0.5s ease-in-out;
}

/* Отключение скролла при открытом попапе */
body.no-scroll {
  overflow: hidden;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
  .wrapper {
    padding: 1.5rem;
  }
  
  .popup {
    padding: 2rem;
    max-width: 380px;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .wrapper {
    padding: 1rem;
    justify-content: flex-start;
    min-height: 50vh;
  }
  
  .open-popup {
    padding: 0.875rem 1.75rem;
    font-size: 0.8rem;
  }
  
  .popup {
    width: 95%;
    max-width: 340px;
    padding: 1.75rem 1.5rem;
    border-radius: 20px;
  }
  
  .popup.active img {
    height: 45px;
    margin: 0.25rem 0 1rem;
  }
  
  .popup.active h6 {
    font-size: 0.9rem;
    margin: 0.25rem 0 1.25rem;
  }
  
  .popup input {
    height: 44px;
    font-size: 0.9rem;
  }
  
  .popup textarea {
    min-height: 100px;
    font-size: 0.9rem;
  }
  
  .popup button {
    height: 44px;
    font-size: 0.8rem;
    margin: 1.75rem 0 0.875rem;
  }
  
  .popup .conf__text {
    font-size: 0.625rem;
    margin: 8px;
  }
  
  .popup .conf__text a {
    font-size: 0.625rem;
  }
  
  .close-popup {
    top: 0.75rem;
    right: 1rem;
    font-size: 1.25rem;
    width: 28px;
    height: 28px;
  }
  
  .formbox__wraptext {
    padding: 0.625rem;
    gap: 0.625rem;
  }
  .popup input.access__submit {
   height: 20px;
   width: 20px;
   vertical-align: -webkit-baseline-middle;
}
}

/* Small Mobile Responsive */
@media (max-width: 480px) {
  .wrapper {
    padding: 0.75rem;
  }
  
  .open-popup {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    width: 100%;
    max-width: 280px;
  }
  
  .popup {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
  }
  
  .popup.active img {
    height: 40px;
  }
  
  .popup.active h6 {
    font-size: 0.8rem;
  }
  
  .popup input,
  .popup textarea {
    font-size: 0.85rem;
  }
  
  .popup .label__text {
    font-size: 0.7rem;
  }
  
  .popup button {
    height: 42px;
  }
  
  .popup .conf__text {
    font-size: 0.5625rem;
    margin: 6px;
  }
  
  .popup .conf__text a {
    font-size: 0.5625rem;
  }
  
  .formbox__wraptext {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .formbox__wraptext input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }
  .popup input.access__submit {
   height: 16px;
   width: 16px;
   vertical-align: -webkit-baseline-middle;
}
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .popup__bg,
  .popup,
  .open-popup,
  .popup button,
  .close-popup {
    transition: none;
  }
  
  .popup input.wpcf7-not-valid,
  .formbox__wraptext.wpcf7-not-valid,
  .formbox__wraptext:has(input[type="checkbox"].wpcf7-not-valid) {
    animation: none;
  }
}

/* Focus styles for accessibility */
.open-popup:focus-visible,
.close-popup:focus-visible,
.popup input:focus-visible,
.popup textarea:focus-visible,
.popup button:focus-visible,
.formbox__wraptext:focus-within {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* Loading state for form submission */
.popup button.loading {
  position: relative;
  color: transparent;
}

.popup button.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
} 

/*************************************/

/* Success Popup Styles */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #24AAE1 0%, #1a8bc0 100%);
    width: 90%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.18),
        0 12px 40px rgba(36, 155, 203, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 10002;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.success-popup.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.success-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #2ed573;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
    position: relative;
    box-shadow: 0 8px 20px rgba(46, 213, 115, 0.3);
    animation: pulse 2s infinite;
}

.success-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: ripple 2s infinite;
}

/* Стили для иконки */
.success-icon i {
    font-size: 2.2rem;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    z-index: 1;
}

.success-popup h3 {
    color: #fff;
    font-family: Inter, sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.02em;
}

.success-popup p {
    color: rgba(255, 255, 255, 0.9);
    font-family: Inter, sans-serif;
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
    max-width: 320px;
}

.success-close-btn {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Inter, sans-serif;
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #FF6F64 0%, #ED5A4F 100%);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 14px;
    margin-top: 2.25rem;
    letter-spacing: 0.8px;
    box-shadow: 0 6px 16px rgba(255, 111, 100, 0.35);
    position: relative;
    overflow: hidden;
}

.success-close-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.success-close-btn:hover {
    background: linear-gradient(135deg, #ED5A4F 0%, #D9483B 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(237, 90, 79, 0.45);
}

.success-close-btn:hover::before {
    left: 100%;
}

.success-close-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 90, 79, 0.4);
}

/* Анимации */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.4);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(46, 213, 115, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 213, 115, 0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .success-popup {
        width: 90%;
        max-width: 360px;
        padding: 2.5rem 2rem;
        border-radius: 20px;
    }
    
    .success-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 1.5rem;
    }
    
    .success-icon i {
        font-size: 1.9rem;
    }
    
    .success-popup h3 {
        font-size: 1.5rem;
        margin-bottom: 0.875rem;
    }
    
    .success-popup p {
        font-size: 1rem;
    }
    
    .success-close-btn {
        height: 50px;
        font-size: 0.9rem;
        margin-top: 2rem;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .success-popup {
        width: 92%;
        max-width: 320px;
        padding: 2rem 1.5rem;
        border-radius: 18px;
    }
    
    .success-icon {
        width: 65px;
        height: 65px;
        margin-bottom: 1.25rem;
    }
    
    .success-icon i {
        font-size: 1.7rem;
    }
    
    .success-popup h3 {
        font-size: 1.35rem;
    }
    
    .success-popup p {
        font-size: 0.95rem;
    }
    
    .success-close-btn {
        height: 48px;
        margin-top: 1.75rem;
    }
}

/* Плавные переходы между окнами */
.popup, .success-popup {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Убедимся, что оба окна не показываются одновременно */
.popup.active ~ .success-popup,
.success-popup.active ~ .popup {
    display: none;
}