/* Modal Base */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 25, 47, 0.95); /* matching primary color */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 2rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container */
.modal-container {
    background: white;
    width: 100%;
    max-width: 1100px;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--color-bg-alt);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--color-primary);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-secondary);
    color: white;
    transform: rotate(90deg);
}

/* Gallery Section (Left) */
.modal-gallery {
    flex: 1.2;
    background: #000;
    padding: 0;
    position: relative;
    min-width: 0; /* fixes flexbox overflow */
}

.modal-gallery .project-carousel {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modal-gallery .carousel-main {
    flex: 1;
    height: auto;
    min-height: 400px;
}

/* Override existing carousel styles slightly for modal context */
.modal-gallery .carousel-thumbnails {
    background: #111;
}

/* Info Section (Right) */
.modal-info {
    flex: 0.8;
    padding: 3rem 2.5rem;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--color-border);
}

.modal-info .project-category {
    color: var(--color-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.modal-title {
    font-size: 2.2rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    line-height: 1.2;
}

.modal-desc p {
    font-size: 1.05rem;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.modal-desc h4 {
    color: var(--color-primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.modal-desc ul {
    list-style-type: none;
    padding: 0;
}

.modal-desc ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.modal-desc ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--color-secondary);
    font-weight: bold;
}

/* Responsive Modal */
@media (max-width: 900px) {
    .modal-container {
        flex-direction: column;
        max-height: none;
    }
    
    .modal-gallery {
        flex: none;
        height: 50vh;
    }
    
    .modal-gallery .carousel-main {
        min-height: auto;
    }
    
    .modal-info {
        flex: none;
        padding: 2rem;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }
    
    .modal-overlay {
        padding: 1rem;
    }
}

/* Prevent body scroll when modal open */
body.modal-open {
    overflow: hidden;
}
