

.modal { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: var(--modal-overlay); 
    display: flex; 
    justify-content: center; 
    align-items: flex-end; /* На мобилках выезжает снизу */
    z-index: 1000; 
    visibility: hidden; 
    opacity: 0; 
    transition: opacity 0.3s; 
}

.modal:not(.hidden) { 
    visibility: visible; 
    opacity: 1; 
}


.modal-content { 
    background: #f9f9f9; 
    width: 100%; 
    max-width: 500px; 
    height: 85%; 
    border-radius: 24px 24px 0 0; 
    display: flex; 
    flex-direction: column; 
    padding: 0; 
    overflow: hidden; 
    transform: translateY(100%); 
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28); 
    pointer-events: auto; 
}

.modal:not(.hidden) .modal-content { 
    transform: translateY(0); 
}


.modal-header { 
    flex-shrink: 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 20px; 
    background: #f9f9f9; 
    border-bottom: 1px solid #e0e0e0; 
    z-index: 10; 
}


.close-btn { 
    background: #eee; 
    border: none; 
    font-size: 20px; 
    width: 30px; 
    height: 30px; 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    pointer-events: auto; 
}


.scrollable-list { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 15px; 
    -webkit-overflow-scrolling: touch; 
    pointer-events: auto; 
}
.scrollable-list::-webkit-scrollbar { display: none; }


.center-modal { 
    align-items: center !important; 
}


.modal-content.confirmation-content {
    height: auto !important;
    min-height: 180px;
    width: 90%;
    max-width: 320px;
    border-radius: 24px !important;
    padding: 20px !important;
    
    /* === ГЛАВНОЕ ИСПРАВЛЕНИЕ === */
    max-height: 80vh; /* Окно не может быть выше 80% экрана */
    overflow-y: auto; /* Если не влезает — появится прокрутка */
    
    /* Магия для iPhone: добавляем отступ снизу, равный высоте системной полоски */
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    /* =========================== */

    transform: scale(0.8);
    opacity: 0;
    transition: all 0.2s ease-out;
}

.center-modal:not(.hidden) .confirmation-content { 
    transform: scale(1); 
    opacity: 1; 
}

.modal-header.no-border { 
    border-bottom: none; 
    padding-bottom: 0; 
}

.confirm-text { 
    text-align: center; 
    margin: 10px 0 20px; 
    color: #555; 
    font-size: 14px; 
}

.confirmation-buttons { 
    display: flex; 
    gap: 10px; 
    width: 100%; 
    justify-content: center; 
}

.confirmation-buttons button { 
    flex: 1; 
    padding: 10px; 
    font-size: 14px; 
    border-radius: 12px; 
    border: none; 
    color: white; 
    pointer-events: auto; 
    cursor: pointer; 
}

.cancel-btn { background: #ef5350 !important; }
.confirm-btn { background: #66bb6a !important; }


@media (min-width: 769px) { 
    .modal { align-items: center; } 
    .modal-content { border-radius: 24px; height: 80%; } 
}