/**
 * Cloudinary Gallery Styles
 * Responsive design for tag-based image gallery with modal functionality
 */

/* Gallery Container */
.cloudinary-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Roboto Slab', serif;
}

/* Album Thumbnails */


.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.album-item {
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 10px;
    background-color: #fff;
    overflow: hidden;
}

.album-item:hover {
    transform: translateY(-5px);
}

.album-thumbnail {
    position: relative;
    overflow: hidden;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-placeholder {
    text-align: center;
    color: #212529;
    font-size: 48px;
    transition: opacity 0.3s ease;
}

.album-item:hover .album-placeholder {
    opacity: 1;
}

.album-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 37, 41, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.album-item:hover .album-overlay {
    opacity: 1;
}

.album-info {
    text-align: center;
    color: white;
    padding: 20px;
}

.album-info h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #007b7f;
}

.album-info p {
    font-family: 'Roboto Slab', serif;
    font-size: 14px;
    margin: 0;
    opacity: 0.9;
}

/* Album Footer */
.album-footer {
    padding: 15px 20px;
}

.album-footer h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 5px 0;
}

.album-footer p {
    font-family: 'Roboto Slab', serif;
    font-size: 13px;
    color: #6c757d;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.album-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #007b7f;
    font-weight: 600;
}

.album-count i {
    font-size: 10px;
}

/* Loading Indicator */
.gallery-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ffc800;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tag Gallery Overlay */
.tag-gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.25);
    z-index: 1031;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.overlay-content {
    background: #fff;
    border-radius: 15px;
    max-width: 1200px;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.overlay-header {
    background: #fff;
    color: #007b7f;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.overlay-header h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.overlay-close {
    background: none;
    border: none;
    color: #007b7f;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.overlay-close:hover {
    background: rgba(255, 200, 0, 0.2);
}

.overlay-grid {
    padding: 30px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

/* Image Grid (for overlay) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-item {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    color: white;
    font-size: 24px;
    text-align: center;
}

.gallery-overlay-content i {
    color: #007b7f;
}

/* No Images / Error Messages */
.no-images,
.gallery-error {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 18px;
    grid-column: 1 / -1;
}

.gallery-error {
    color: #dc3545;
}

/* Modal Gallery */
.gallery-modal {
    position: fixed;
    z-index: 1032;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin: 0 auto;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(0,0,0,0.8);
}

.modal-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1001;
}

.modal-prev,
.modal-next {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-prev:hover,
.modal-next:hover {
    background: rgba(0,0,0,0.8);
}

.modal-image-container {
    position: relative;
    max-height: 70vh;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.modal-info {
    background: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
}

.modal-counter {
    font-weight: 600;
    color: #212529;
}

.modal-tag {
    background: #007b7f;
    color: #212529;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cloudinary-gallery {
        padding: 15px;
    }
    
    .album-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .album-thumbnail {
        height: 200px;
    }
    
    .album-placeholder {
        font-size: 36px;
    }
    
    .album-info h3 {
        font-size: 16px;
    }
    
    .album-info p {
        font-size: 12px;
    }
    
    .overlay-content {
        max-height: 95%;
    }
    
    .overlay-header {
        padding: 15px 20px;
    }
    
    .overlay-header h2 {
        font-size: 20px;
    }
    
    .overlay-grid {
        padding: 20px;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .modal-navigation {
        padding: 0 10px;
    }
    
    .modal-prev,
    .modal-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
        padding: 10px 15px;
    }
    
    .modal-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .album-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .album-thumbnail {
        height: 180px;
    }
    
    .album-footer {
        padding: 12px 15px;
    }
    
    .album-footer h4 {
        font-size: 14px;
    }
    
    .album-footer p {
        font-size: 12px;
    }
    
    .album-placeholder {
        font-size: 28px;
    }
    
    .overlay-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-item img {
        height: 250px;
    }
    
    .modal-image-container {
        max-height: 60vh;
    }
    
    .modal-image {
        max-height: 60vh;
    }
}

/* Animation for smooth transitions */
.gallery-item,
.modal-content {
    animation: fadeIn 0.3s ease-in;
}

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