/* Modal Container */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-dialog {
    width: 100%;
    max-width: 600px;
    position: relative;
    margin: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: calc(100vh - 3.5rem);
    overflow-y: auto;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-light);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text);
    margin: 0;
}

/* Modal Body */
.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Modal Actions/Footer */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* Access Groups Section */
.access-groups {
    border: 1px solid var(--color-border);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    background-color: #fdfdfd;
}

.access-groups > div {
    margin-bottom: var(--space-xs);
}

.access-groups label {
    cursor: pointer;
    color: var(--color-text);
}

/* Close Button */
.btn-close {
    background: transparent;
    border: none;
    color: var(--color-text);
    padding: var(--space-xs);
    cursor: pointer;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s, opacity 0.2s;
    position: relative;
    z-index: 1060;
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
}

/* Delete Confirmation */
.delete-confirmation {
    padding: var(--space-xl);
}

.delete-confirmation p {
    margin: 0 0 var(--space-xl);
    color: var(--color-text);
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        padding: 0.5rem;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
    }

    .modal-content {
        border-radius: var(--radius-md);
        max-height: calc(100vh - 2rem);
    }

    .modal-body {
        padding: var(--space-lg);
    }

    .modal-body * {
        max-width: 100%;
        box-sizing: border-box;
    }

    .modal-body img {
        max-width: 100%;
        height: auto;
    }
}

/* Animation */
.modal-fade {
    animation: modalFade 0.2s ease-in-out;
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
