/* modal.css - стили модального окна в стиле главной страницы */
:root {
    --heading-gradient: linear-gradient(112deg, #AE8625 5%, #F7EF8A 45%, #D2AC47 85%);
    --button-gradient: linear-gradient(132deg, #D2AC47 5%, #F7EF8A 45%, #AE8625 85%);
    --modal-bg: rgba(51, 52, 54, 0.95);
    --modal-border: rgba(215, 172, 71, 0.3);
}

/* Модальное окно */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    background: var(--modal-bg);
    border-radius: 12px;
    padding: 40px 30px 30px;
    z-index: 10001;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--modal-border);
}

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

.modal-content {
    position: relative;
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(215, 172, 71, 0.1);
    color: #F7EF8A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(215, 172, 71, 0.3);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(215, 172, 71, 0.2);
    transform: rotate(90deg);
    color: #fff;
}

/* Заголовок модального окна */
.modal h3 {
    color: #fff;
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    font-family: 'Prata', serif;
    position: relative;
    padding-bottom: 20px;
}

.modal h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--heading-gradient);
    border-radius: 2px;
}

/* Форма */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Поля ввода */
.modal-form input,
.modal-form textarea {
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    outline: none;
}

.modal-form input::placeholder,
.modal-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.modal-form input:focus,
.modal-form textarea:focus {
    border-color: #F7EF8A;
    box-shadow: 0 0 0 2px rgba(215, 172, 71, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.modal-form textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Кнопка отправки */
.modal-form button {
    padding: 18px;
    background: var(--button-gradient);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
}

.modal-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(215, 172, 71, 0.3);
}

.modal-form button:active {
    transform: translateY(0);
}

.modal-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Индикатор загрузки */
#loadingSpinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
}

#loadingSpinner .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Сообщения формы */
#formMessage {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    animation: fadeIn 0.3s ease;
    display: none;
}

#formMessage.success {
    background: linear-gradient(135deg, rgba(21, 87, 36, 0.1) 0%, rgba(195, 230, 203, 0.1) 100%);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

#formMessage.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(245, 198, 203, 0.1) 100%);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
}

/* Стили для ошибок валидации */
.modal-form input:invalid:not(:focus):not(:placeholder-shown),
.modal-form textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.05);
}

.modal-form input:valid:not(:focus):not(:placeholder-shown),
.modal-form textarea:valid:not(:focus):not(:placeholder-shown) {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.05);
}

/* Маска телефона - стили состояния */
.modal-form input.invalid-phone {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.05);
    color: #f87171;
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        padding: 35px 20px 25px;
        border-radius: 10px;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 12px;
        right: 12px;
    }
    
    .modal h3 {
        font-size: 24px;
        margin-bottom: 25px;
        padding-bottom: 15px;
    }
    
    .modal-form {
        gap: 16px;
    }
    
    .modal-form input,
    .modal-form textarea {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .modal-form textarea {
        min-height: 100px;
    }
    
    .modal-form button {
        padding: 16px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .modal {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        padding: 30px 15px 20px;
        transform: translate(-50%, -50%) scale(0.95);
    }
    
    .modal.active {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .modal-overlay {
        display: none !important;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        background: rgba(215, 172, 71, 0.2);
    }
    
    .modal-form {
        gap: 12px;
    }
    
    .modal-form button {
        padding: 14px;
        font-size: 15px;
    }
}

/* Дополнительные эффекты для темной темы */
@media (prefers-color-scheme: dark) {
    .modal {
        background: rgba(30, 31, 33, 0.98);
    }
    
    .modal-form input,
    .modal-form textarea {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* Эффект блеска на кнопке */
.modal-form button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
    transition: left 0.5s ease;
}

.modal-form button:hover::after {
    left: 140%;
}

/* Декоративные элементы модального окна */
.modal-content::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 13px;
    background: linear-gradient(45deg, transparent, rgba(215, 172, 71, 0.1), transparent);
    z-index: -1;
    pointer-events: none;
}

/* Плавная анимация появления */
.modal {
    animation: modalFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal.closing {
    animation: modalFadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}