/* ===== Modal (общие стили) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);

    z-index: 1000;

    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;

    opacity: 0;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 2rem;

    width: min(560px, 100%);
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    margin: 0 auto;
    overflow-y: auto;

    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content.card:hover {
    transform: scale(0.95);
    border-color: var(--bg-card-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content.card:hover::before {
    opacity: 0;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-overlay.open .modal-content.card:hover {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--error);
}

#modal-edit-group .edit-group-modal {
    width: min(980px, calc(100vw - 2rem));
    max-height: none;
    overflow: visible;
}

#modal-edit-group #edit-group-form {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

#modal-edit-group .edit-group-form-row {
    display: grid;
    gap: 1rem;
    align-items: end;
}

#modal-edit-group .edit-group-form-row-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#modal-edit-group .edit-group-form-row-details {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

#modal-edit-group .form-group {
    min-width: 0;
}

#modal-edit-group .edit-group-submit {
    display: flex;
    align-items: flex-end;
}

#modal-edit-group .edit-group-submit .btn {
    width: 100%;
}

@media (max-width: 980px) {
    #modal-edit-group .edit-group-form-row-main,
    #modal-edit-group .edit-group-form-row-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    #modal-edit-group .edit-group-form-row-main,
    #modal-edit-group .edit-group-form-row-details {
        grid-template-columns: 1fr;
    }
}

#schedule-conflict-modal {
    padding: 0.35rem;
    overflow-x: hidden;
    overflow-y: auto;
}

#schedule-conflict-modal .modal-content {
    width: min(1760px, calc(100vw - 0.7rem));
    max-width: calc(100vw - 0.7rem);
    max-height: none;
    box-sizing: border-box;
    margin: auto;
    padding: 1rem;
    overflow: visible;
}

#schedule-move-slot-modal .modal-content {
    width: min(620px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: none;
    box-sizing: border-box;
    margin: auto;
    padding: 1rem;
    overflow: visible;
}
