/* unit-modal.css - Styles for the unit detail modal */

/* View Details Button */
.view-details-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background-color: #013220;
    color: #FEFB3B;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    text-align: center;
}

.view-details-btn:hover {
    background-color: #014d32;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
}

.view-details-btn:focus {
    outline: 2px solid #FEFB3B;
    outline-offset: 2px;
}

/* Modal Overlay */
.unit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.unit-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.unit-modal {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(76, 175, 32, 0.95), rgba(56, 142, 60, 0.9));
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.unit-modal-overlay.active .unit-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Close Button */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background-color: rgba(1, 50, 32, 0.8);
    color: #FEFB3B;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 24px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background-color: #013220;
    transform: scale(1.1);
}

/* Modal Content */
.modal-content {
    display: flex;
    flex-direction: row;
    height: 100%;
    max-height: 90vh;
    overflow: hidden;
}

/* Modal Gallery */
.modal-gallery {
    flex: 1;
    min-width: 45%;
    max-width: 50%;
    background-color: rgba(1, 50, 32, 0.05);
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-gallery-main {
    position: relative;
    width: 100%;
    height: 350px; /* Fixed height for consistency */
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
}

#modalMainImage {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Use contain instead of cover for full image display */
    transition: transform 0.5s ease, opacity 0.3s ease;
    padding: 10px; /* Add padding for better spacing */
}

.modal-gallery-controls {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    z-index: 10;
}

.modal-gallery-prev, 
.modal-gallery-next {
    background-color: rgba(1, 50, 32, 0.7);
    color: #FEFB3B;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.modal-gallery-prev:hover, 
.modal-gallery-next:hover {
    background-color: rgba(1, 50, 32, 0.9);
    transform: scale(1.1);
}

.modal-gallery-counter {
    background-color: rgba(1, 50, 32, 0.7);
    color: #FEFB3B;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.modal-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    gap: 10px;
    height: calc(90vh - 350px); /* Adjusted based on main image height */
    overflow-y: auto;
    background-color: rgba(1, 50, 32, 0.1);
}

.modal-gallery-thumb {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.modal-gallery-thumb:hover {
    transform: scale(1.05);
}

.modal-gallery-thumb.active {
    border-color: #FEFB3B;
    box-shadow: 0 0 8px rgba(254, 251, 59, 0.8);
}

/* Modal Details */
.modal-details {
    flex: 1;
    min-width: 45%;
    max-width: 50%;
    padding: 30px 40px; /* Increased right padding */
    overflow-y: auto;
    max-height: 90vh;
    color: #fff;
}

#modalTitle {
    font-size: 2rem;
    color: #FEFB3B;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(254, 251, 59, 0.3);
    padding-bottom: 10px;
}

.modal-status {
    display: inline-block;
    padding: 8px 15px;
    background-color: #FEFB3B;
    color: #4CAF50;
    font-weight: bold;
    border-radius: 6px;
    margin-bottom: 20px;
}

.modal-description {
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-specs {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    padding-right: 20px;
    margin-bottom: 20px;
    margin-right: 20px;
}

.modal-specs h3 {
    color: #FEFB3B;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.modal-specs h4 {
    color: #FEFB3B;
    margin: 15px 0 8px;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(254, 251, 59, 0.2);
    padding-bottom: 5px;
}

.modal-specs ul {
    margin: 0 0 10px 0;
    padding-left: 25px;
}

.modal-specs li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.modal-pricing {
    margin-bottom: 25px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-pricing p {
    margin: 5px 0;
}

.modal-pricing strong {
    color: #FEFB3B;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-btn {
    flex: 1;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.call-btn {
    background-color: #FEFB3B;
    color: #013220;
}

.call-btn:hover {
    background-color: #F4E800;
    transform: translateY(-2px);
}

.contact-btn {
    background-color: #013220;
    color: #FEFB3B;
}

.contact-btn:hover {
    background-color: #014d32;
    transform: translateY(-2px);
}

/* Mobile Responsive Adjustments */
@media screen and (max-width: 900px) {
    .modal-content {
        flex-direction: column;
    }
    
    .modal-gallery {
        min-width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 45vh;
    }
    
    .modal-details {
        min-width: 100%;
        max-width: 100%;
        padding: 20px 25px; /* Adjusted padding for mobile */
        max-height: 40vh;
    }
    
    #modalTitle {
        font-size: 1.6rem;
    }
    
    .modal-gallery-main {
        height: 250px; /* Adjusted for mobile */
    }
    
    .modal-gallery-thumbs {
        height: auto;
        max-height: calc(45vh - 250px);
        padding: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .modal-gallery-thumb {
        width: 80px;
        height: 60px;
        margin-right: 8px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media screen and (max-width: 600px) {
    .unit-modal {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-close-btn {
        top: 10px;
        right: 10px;
    }
    
    .modal-gallery-main {
        height: 220px; /* Further reduced for small screens */
    }
    
    .modal-gallery-thumbs {
        max-height: calc(45vh - 220px);
        padding: 8px;
    }
    
    .modal-gallery-thumb {
        width: 70px;
        height: 50px;
        margin-right: 6px;
    }
    
    #modalTitle {
        font-size: 1.4rem;
    }
    
    .modal-description, 
    .modal-pricing {
        font-size: 1rem;
    }
    
    .modal-specs {
        padding: 15px;
    }
    
    .modal-specs h3 {
        font-size: 1.2rem;
    }
    
    .modal-specs h4 {
        font-size: 1rem;
    }
    
    .modal-btn {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* Very small mobile devices */
@media screen and (max-width: 480px) {
    .modal-gallery-main {
        height: 200px;
    }
    
    .modal-details {
        padding: 15px 20px;
    }
    
    .modal-gallery-thumbs {
        max-height: calc(45vh - 200px);
    }
    
    .modal-gallery-thumb {
        width: 60px;
        height: 45px;
    }
}

/* Animation for the modal fade in/out */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}