/* assets/css/mosaic-gallery.css */

.mosaic-gallery-wrapper {
    position: relative;
}

.mosaic-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
    height: 400px;
    overflow: hidden;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
    z-index: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item.main-image {
    grid-row: 1 / 3;
}

.gallery-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.gallery-item:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
}

.gallery-item:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
}

.gallery-item:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

.gallery-item.hidden-image {
    display: none;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.show-all-btn {
    background: #ffffff;
    color: #333333;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.show-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.show-all-btn svg {
    width: 16px;
    height: 16px;
}

/* Modal Styles (Real Estate Style) */
.mosaic-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.mosaic-modal.show {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mosaic-modal-content {
    position: relative;
    background-color: white;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.mosaic-modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #666;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    border: none;
}

.mosaic-modal-close:hover {
    color: #000;
    background: white;
    transform: scale(1.1);
}

.mosaic-modal-gallery {
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    padding-top: 60px;
}

.mosaic-modal-gallery::-webkit-scrollbar {
    width: 8px;
}

.mosaic-modal-gallery::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.mosaic-modal-gallery::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.mosaic-modal-gallery::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.mosaic-modal-image {
    display: block;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.mosaic-modal-image:hover {
    transform: scale(1.02);
}

.mosaic-modal-image:last-child {
    margin-bottom: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mosaic-gallery {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 200px 100px 100px;
        height: auto;
    }
    
    .gallery-item.main-image {
        grid-column: 1 / 3;
        grid-row: 1;
    }
    
    .gallery-item:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .gallery-item:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }
    
    .gallery-item:nth-child(4) {
        grid-column: 1;
        grid-row: 3;
    }
    
    .gallery-item:nth-child(5) {
        grid-column: 2;
        grid-row: 3;
    }
    
    .mosaic-modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 85vh;
    }
    
    .mosaic-modal-gallery {
        padding: 15px;
        padding-top: 50px;
    }
    
    .show-all-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mosaic-gallery {
        grid-template-columns: 1fr;
        grid-template-rows: 200px 100px 100px 100px 100px;
    }
    
    .gallery-item.main-image {
        grid-column: 1;
        grid-row: 1;
    }
    
    .gallery-item:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    
    .gallery-item:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }
    
    .gallery-item:nth-child(4) {
        grid-column: 1;
        grid-row: 4;
    }
    
    .gallery-item:nth-child(5) {
        grid-column: 1;
        grid-row: 5;
    }
    
    .show-all-btn {
        padding: 8px 12px;
        font-size: 11px;
        gap: 4px;
    }
    
    .mosaic-modal-close {
        top: 10px;
        right: 15px;
        font-size: 28px;
        width: 35px;
        height: 35px;
    }
}

/* Animation for gallery load */
.gallery-item {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal animations */
.mosaic-modal.show {
    display: block !important;
    animation: modalFadeIn 0.3s ease;
}

.mosaic-modal.hide {
    animation: modalFadeOut 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Focus styles for accessibility */
.show-all-btn:focus,
.mosaic-modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.gallery-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}