#carModal {
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#carModal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    width: 90%;
    max-width: 950px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px;
    padding: 40px;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);

    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

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

.modal-img {
    width: 100%;
    border-radius: 18px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}

.modal-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 20px;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 26px;
    cursor: pointer;
    transition: 0.3s;
    opacity: 0.6;
}

.close-modal:hover {
    opacity: 1;
    transform: rotate(90deg);
}

body.modal-open {
    overflow: hidden;
}
.modal-gallery {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.modal-gallery img {
    width: 100%;
    border-radius: 18px;
    max-height: 400px;
    object-fit: cover;
}

.modal-gallery {
    position: relative;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    
    width: 50px;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    border: 1px solid var(--border);

    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);

    color: white;
    font-size: 1rem;

    cursor: pointer;
    transition: all 0.25s ease;
}

.nav-btn.prev { left: 20px; }
.nav-btn.next { right: 20px; }

.nav-btn:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-50%) scale(1.08);
}

.nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}


@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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


@media (max-width: 768px) {
    .spec-grid {
        grid-template-columns: 1fr;
    }
    .nav-btn {
        width: 30px;
        height: 30px;
    }
}
