/* Основные переменные и базовые стили */
:root {
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #000000;
    --tg-theme-hint-color: #999999;
    --tg-theme-link-color: #2481cc;
    --tg-theme-button-color: #2481cc;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #f5f5f5;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --transition-speed: 0.3s;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2c3e50 !important;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Контейнер */
.container {
    max-width: 100%;
    padding: 20px 16px;
    padding-bottom: 120px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Прогресс-бар */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.step-indicator {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #718096 !important;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Шаги формы */
.step {
    display: none;
    animation: slideIn var(--transition-speed) ease;
}

.step.active {
    display: block;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(30px);
    }
    to { 
        opacity: 1; 
        transform: translateX(0);
    }
}

.step h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #2c3e50 !important;
    text-align: center;
    position: relative;
    padding-bottom: 12px;
}

.step h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Группы форм */
.form-group {
    margin-bottom: 24px;
    animation: fadeInUp 0.4s ease;
}

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

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #34495e !important;
    letter-spacing: 0.3px;
}

/* Текстовые поля и выпадающие списки */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.other-field {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    background: #ffffff !important;
    color: #2c3e50 !important;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    appearance: none;
    -webkit-text-fill-color: #2c3e50 !important;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

.form-group input:focus,
.form-group select:focus,
.other-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.form-group input::placeholder {
    color: #a0aec0 !important;
    -webkit-text-fill-color: #a0aec0 !important;
    opacity: 1;
}

/* Карточки выбора для radio и checkbox */
.radio-group,
.checkbox-group {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

.radio-group.horizontal,
.checkbox-group.horizontal {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.radio-item,
.checkbox-item {
    position: relative;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.radio-item input,
.checkbox-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-item span,
.checkbox-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #ffffff !important;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50 !important;
    transition: all var(--transition-speed);
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    text-align: center;
    min-height: 60px;
}

.radio-item span::before,
.checkbox-item span::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-speed);
    z-index: -1;
}

.radio-item:hover span,
.checkbox-item:hover span {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
    border-color: #667eea;
}

.radio-item input:checked + span,
.checkbox-item input:checked + span {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
    color: #667eea;
    font-weight: 600;
    transform: scale(1.02);
}

/* Убрана галочка - только цветовое выделение */

.radio-item span small,
.checkbox-item span small {
    display: block;
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
    font-weight: 400;
}

/* Стили для блока "Что важнее" */
.radio-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    text-align: center;
}

.radio-subtitle {
    display: block;
    font-size: 12px;
    color: #718096 !important;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    margin-top: 6px;
}

.radio-item input:checked + span .radio-subtitle {
    color: #667eea;
}

/* Специальные стили для карточек с подзаголовками */
.radio-item span:has(.radio-subtitle) {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px;
}

/* Большие карточки для классов авто */
.checkbox-group:has([name="car_class"]) {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.checkbox-group:has([name="car_class"]) .checkbox-item span {
    flex-direction: column;
    padding: 20px 12px;
    font-size: 13px;
}

/* Кнопки навигации */
.nav-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, white 80%, rgba(255, 255, 255, 0));
    display: flex;
    gap: 12px;
    z-index: 100;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Убрана анимация волны при клике */

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: #4a5568;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Финальная информация */
.final-info {
    background: linear-gradient(135deg, rgba(132, 250, 176, 0.1) 0%, rgba(143, 211, 244, 0.1) 100%);
    border: 2px solid #84fab0;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 24px;
    position: relative;
}

/* Убрана хлопушка */

.final-info p {
    font-size: 14px;
    color: #2d3748 !important;
    line-height: 1.6;
}

/* Экран успеха */
.success-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.success-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    animation: successPop 0.5s ease;
}

@keyframes successPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.success-icon {
    font-size: 72px;
    margin-bottom: 24px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.success-content h2 {
    font-size: 28px;
    margin-bottom: 16px;
    color: #2c3e50 !important;
}

.success-content p {
    font-size: 16px;
    color: #718096 !important;
    margin-bottom: 12px;
}

.success-content p strong {
    color: #667eea;
    font-size: 18px;
}

/* Поле "Другое" */
.other-field {
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}

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

/* Адаптивность для мобильных устройств */
@media (max-width: 640px) {
    .container {
        padding: 16px 12px;
        padding-bottom: 100px;
    }
    
    .step h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .radio-group.horizontal,
    .checkbox-group.horizontal {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .checkbox-group:has([name="car_class"]) {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .radio-item span,
    .checkbox-item span {
        padding: 12px;
        font-size: 13px;
        min-height: 50px;
    }
    
    .nav-buttons {
        padding: 16px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .radio-group.horizontal,
    .checkbox-group.horizontal {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group:has([name="car_class"]) {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 12px 8px;
    }
}

/* Удаляем автоматическую темную тему чтобы избежать конфликтов с Telegram */

/* Убрана цветовая анимация внутри кнопок */

/* Пульсация для привлечения внимания */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

.btn-primary {
    animation: pulse 2s infinite;
}

/* Улучшенная типографика */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Фокус для доступности */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}