/* ============================================
   MODALS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active,
.modal.show {
    display: flex;
}

.modal.show[data-confirm-modal],
.modal-stacked {
    z-index: 10001;
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

/* form внутри modal-content должен вести себя как flex-контейнер,
   чтобы modal-body мог сжиматься и скроллиться */
.modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-large .modal-content,
.modal-content.modal-large {
    max-width: 800px;
}

.modal-md .modal-content,
.modal-content.modal-md {
    max-width: 700px;
}

.modal-content.modal-content-vacancy {
    max-width: 520px;
}


@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.modal-header h2 svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.close-button {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.close-button svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

.modal-body {
    padding: var(--space-6);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.modal-body > form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.modal-body .form-field,
.modal-body .form-row {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-footer--center {
    justify-content: center;
}

.modal-footer .btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.modal-footer .btn svg {
    width: var(--icon-sm);
    height: var(--icon-sm);
}

/* Modal header icon spacing */
.modal-header-icon {
    margin-inline-end: var(--space-3);
}

/* Entity detail map container */
.entity-map {
    height: calc(400px * var(--space-scale));
    width: 100%;
    border-radius: var(--radius-sm);
}

/* Entity detail map hint */
.entity-map-hint {
    margin-top: var(--space-2);
}

/* Vacancy delete button in modal footer */
.btn-vacancy-delete {
    margin-inline-end: auto;
}

/* Status dot inline indicator */
.status-dot-inline {
    display: inline-block;
    width: var(--space-2);
    height: var(--space-2);
    border-radius: 50%;
    margin-inline-end: var(--space-1);
    vertical-align: middle;
}

/* === Responsive === */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: var(--space-3);
        max-height: 85vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .modal-header {
        padding: var(--space-4) var(--space-5);
    }

    .modal-body {
        padding: var(--space-5);
    }

    .modal-footer {
        padding: var(--space-3) var(--space-5);
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}
