/* Исправления для модальных окон - центрирование */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal.show {
    display: flex !important;
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    pointer-events: none;
}

.modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: #333;
    background-color: #f0f0f0;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* Стили для форм в модальных окнах */
.modal-form {
    margin-top: 20px;
}

.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form input,
.modal-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.modal-form input:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.modal-form .btn-accent {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

/* Стили для видео модального окна */
.video-modal {
    background-color: rgba(0, 0, 0, 0.9); /* Более темный фон для видео */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal .modal-dialog {
    max-width: 90vw; /* 90% ширины экрана */
    width: 90vw;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: none;
    width: 100%;
    position: relative;
    transform: none; /* Убираем трансформацию */
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 соотношение сторон */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto; /* Центрируем контейнер */
}

.video-modal iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.video-modal .modal-close {
    position: absolute;
    top: -60px;
    right: 0;
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    font-size: 24px;
    z-index: 1051;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal .modal-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-dialog {
        max-width: 100%;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .video-modal {
        padding: 10px;
    }
    
    .video-modal .modal-dialog {
        max-width: 95vw;
        width: 95vw;
    }
    
    .video-container {
        padding-bottom: 56.25%; /* Сохраняем 16:9 */
        border-radius: 4px;
    }
    
    .video-modal .modal-close {
        top: -50px;
        right: 5px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .video-modal .modal-dialog {
        max-width: 98vw;
        width: 98vw;
    }
    
    .video-modal .modal-close {
        top: -45px;
        right: 2px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Предотвращение прокрутки body когда модальное окно открыто */
body.modal-open {
    overflow: hidden;
    padding-right: 17px; /* Компенсация скрытого скроллбара */
} 