/**
 * Форма отправки лидов - уровень "Оскар"
 * Максимальная UX/UI изысканность
 */

/* Анимации появления формы */
@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fieldFocus {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes checkmarkDraw {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Контейнер формы */
.form-oscar {
    animation: formSlideIn 0.6s ease-out;
    position: relative;
}

/* Поля ввода - улучшенный дизайн */
.form-oscar .form__field {
    position: relative;
    margin-bottom: 24px;
}

.form-oscar .form__input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Кайдзен улучшение: улучшенная визуальная обратная связь на формах */
.form-oscar .form__input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-oscar .form__input:hover {
    border-color: var(--color-gray-300);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.form-oscar .form__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1),
                0 8px 16px rgba(37, 99, 235, 0.15);
    animation: fieldFocus 0.6s ease-out;
}

.form-oscar .form__input:valid:not(:placeholder-shown) {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%2328a745' d='M10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0zm-1 15l-5-5 1.41-1.41L9 12.17l7.59-7.59L18 6l-9 9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

/* Лейблы с анимацией */
.form-oscar .form__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: color 0.3s;
}

.form-oscar .form__field:focus-within .form__label {
    color: var(--color-primary);
}

/* Кнопка отправки - премиум дизайн */
.form-oscar .btn-submit {
    position: relative;
    width: 100%;
    padding: 18px 32px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    text-transform: none;
    letter-spacing: 0.2px;
}

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

.form-oscar .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.form-oscar .btn-submit:hover::before {
    left: 100%;
}

.form-oscar .btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

.form-oscar .btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Состояние загрузки */
.form-oscar .btn-submit.loading {
    pointer-events: none;
}

.form-oscar .btn-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Сообщение об успехе - премиум */
.form-success-oscar {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 10000;
    opacity: 0;
    animation: successShow 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes successShow {
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.form-success-oscar__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPulse 0.6s ease-out 0.3s;
}

.form-success-oscar__icon svg {
    width: 50px;
    height: 50px;
    stroke: #fff;
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmarkDraw 0.6s ease-out 0.5s forwards;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-success-oscar__title {
    font-size: 24px;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 12px;
}

.form-success-oscar__message {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Статьи в модальном окне успеха */
.form-success-oscar__articles {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.form-success-oscar__articles-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-align: left;
}

.form-success-oscar__articles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-success-oscar__article-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    text-align: left;
}

.form-success-oscar__article-link:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.form-success-oscar__article-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.form-success-oscar__article-title {
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

/* Оверлей для модального окна */
.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Прогресс-бар заполнения формы */
.form-progress {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-bottom: 24px;
    overflow: hidden;
}

.form-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
}

.form-progress__bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

/* Валидация в реальном времени */
.form-oscar .form__field.error .form__input {
    border-color: #dc3545;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.form-oscar .form__error-message {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #dc3545;
    animation: slideDown 0.3s ease-out;
}

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

.form-oscar .form__field.success .form__input {
    border-color: #28a745;
}

.form-oscar .form__success-message {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #28a745;
    animation: slideDown 0.3s ease-out;
}

/* Чекбокс согласия - улучшенный */
.form-oscar .form__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.form-oscar .form__checkbox:hover {
    background-color: #f8f9fa;
}

.form-oscar .form__checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.form-oscar .form__checkbox span {
    font-size: 14px;
    line-height: 1.5;
    color: #666;
}

/* Адаптивность */
@media (max-width: 768px) {
    .form-oscar .form__input {
        min-height: 56px; /* Увеличиваем для thumb-zone */
        padding: 16px 18px; /* Больше padding */
        font-size: 16px; /* Важно для iOS - предотвращает zoom */
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Примечание: inputmode и autocapitalize - это HTML атрибуты, 
       они должны быть добавлены в HTML, а не в CSS */
    
    .form-oscar .btn-submit {
        padding: 16px 24px;
        font-size: 16px;
        min-height: 56px; /* Удобная высота для thumb-zone */
    }
    
    .form-success-oscar {
        padding: 30px 20px;
        margin: 20px;
    }
}

/* Микроинтерактивность - пульсация при фокусе */
.form-oscar .form__field:focus-within::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    opacity: 0;
    z-index: -1;
    animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    50% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* Плавное появление полей */
.form-oscar .form__field {
    animation: fieldSlideIn 0.4s ease-out backwards;
}

.form-oscar .form__field:nth-child(1) { animation-delay: 0.1s; }
.form-oscar .form__field:nth-child(2) { animation-delay: 0.2s; }
.form-oscar .form__field:nth-child(3) { animation-delay: 0.3s; }
.form-oscar .form__field:nth-child(4) { animation-delay: 0.4s; }

@keyframes fieldSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

