.tmp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    padding: 15px;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh; /* Ограничение высоты */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: translateY(-20px);
    animation: slideIn 0.3s forwards;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0; /* Запрещаем сжатие */
}

.modal-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #2c3e50;
    padding-right: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    color: #e74c3c;
    background-color: #f8f8f8;
}

#temporary-modal .modal-body {
    padding: 20px 25px;
    font-size: 1.05rem;
    line-height: 1.6;
    overflow-y: auto; /* Прокрутка внутри тела модального окна */
    flex-grow: 1; /* Занимает доступное пространство */
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
}

#temporary-modal .modal-body ul {
	margin: inherit;
	padding: 0 10px 10px 10px;
	list-style: inherit;
}

#temporary-modal .modal-body ul li {
	list-style: inherit;
}

/* Стили для длинного текста */
.modal-text-content {
    max-height: 100%;
}

.modal-text-content p {
    margin-bottom: 15px;
}

.modal-text-content ul, .modal-text-content ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

.modal-text-content li {
    margin-bottom: 8px;
}

.modal-footer {
    padding: 15px 25px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0; /* Запрещаем сжатие */
}

.modal-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
    min-height: 44px; /* Минимальный размер для сенсорных устройств */
}

.modal-button:hover {
    background-color: #2980b9;
}

/* Анимации */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    to {
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

@keyframes slideOut {
    to {
        transform: translateY(-20px);
    }
}

/* Скрытие модального окна */
.tmp-modal-overlay.hiding {
    animation: fadeOut 0.3s forwards;
}

.tmp-modal-overlay.hiding .modal-content {
    animation: slideOut 0.3s forwards;
}

/* Скрытие модального окна полностью */
.tmp-modal-overlay.hidden {
    display: none;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .modal-content {
        max-height: 95vh; /* На мобильных увеличиваем доступную высоту */
        max-width: 95%; /* Уменьшаем максимальную ширину на мобильных */
    }
    
    .modal-header {
        padding: 15px 20px 12px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .modal-footer {
        padding: 12px 20px 15px;
        flex-direction: column; /* Кнопки в столбик на очень маленьких экранах */
    }
    
    .modal-button {
        width: 100%; /* Кнопки на всю ширину */
        text-align: center;
    }
    
    .modal-close {
        min-width: 44px; /* Минимальный размер для сенсорных устройств */
        min-height: 44px;
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
        height: 100%;
    }
    
    .tmp-modal-overlay {
        padding: 0;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 15px;
    }
}