/**
 * Modern Modal Styles
 * Enhanced with smooth animations and contemporary design
 */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 22, 38, 0.75); /* Uses var(--primary-color) in rgba */
    backdrop-filter: blur(8px);
    z-index: 1000;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    animation: fadeIn 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: 2rem;
    padding: 3rem;
    width: 100%;
    max-width: 900px;
    position: relative;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

/* Custom scrollbar for modal content */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--background-light);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--neutral-500);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--neutral-500);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--background-light);
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

.modal-close:hover {
    color: var(--primary-color);
    background: var(--neutral-500);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

body.modal-open {
    overflow: hidden;
}

/* Modal header styling */
.modal-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--background-light);
}

.modal-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* Modal body styling */
.modal-body {
    color: var(--text-color);
    line-height: 1.75;
}

/* Modal footer styling */
.modal-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--background-light);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Mobile responsiveness - Full screen on mobile */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        margin: 0;
        padding: var(--spacing-6);
        padding-top: var(--spacing-16); /* Space for close button */
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        overflow-y: auto;
        transform: none;
    }
    
    .modal.active .modal-content {
        transform: none;
    }
    
    .modal-close {
        top: var(--spacing-4);
        right: var(--spacing-4);
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        background: var(--primary-color);
        color: white;
        border-radius: var(--radius-full);
        z-index: 10;
    }
    
    .modal-close:hover {
        background: var(--primary-dark);
        transform: none; /* Disable scale on mobile */
    }
    
    .modal-header {
        margin-bottom: var(--spacing-6);
    }
    
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: white;
        padding: var(--spacing-4) 0;
        margin-left: calc(var(--spacing-6) * -1);
        margin-right: calc(var(--spacing-6) * -1);
        padding-left: var(--spacing-6);
        padding-right: var(--spacing-6);
        border-top: 2px solid var(--background-light);
    }
}