/* ==========================================================================
   AM - Fotos — Frontend Styles
   ========================================================================== */

/* Gallery Grid */
.amgg-gallery-grid {
    display: grid;
    gap: 20px;
}

/* Gallery Card - remove all hover effects from card */
.amgg-gallery-card,
.amgg-gallery-item {
    cursor: pointer;
    box-shadow: none !important;
    transform: none !important;
}

.amgg-gallery-card:hover,
.amgg-gallery-item:hover {
    box-shadow: none !important;
    transform: none !important;
}

.amgg-gallery-title,
.amgg-item-title,
.amgg-gallery-card h3,
.amgg-gallery-item h4 {
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    background: transparent !important;
    transform: none !important;
}

/* Override any inline styles from Elementor */
[class*="amgg-gallery"]:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Cover */
.amgg-gallery-cover,
.amgg-item-cover {
    position: relative;
    overflow: hidden;
    background: #e0e0e0;
}

.amgg-gallery-cover img,
.amgg-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Placeholder */
.amgg-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* Overlay - controlled by JS class .amgg-hover */
.amgg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(59, 130, 246, 0) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    pointer-events: none;
}

.amgg-gallery-cover.amgg-hover .amgg-overlay,
.amgg-item-cover.amgg-hover .amgg-overlay {
    background: rgba(59, 130, 246, 0.8) !important;
}

.amgg-view-text {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
}

.amgg-gallery-cover.amgg-hover .amgg-view-text,
.amgg-item-cover.amgg-hover .amgg-view-text {
    opacity: 1;
    transform: translateY(0);
}

/* Title */
.amgg-gallery-title {
    margin: 0;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.amgg-item-title {
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* Gallery Item */
.amgg-gallery-item {
    text-decoration: none;
}

.amgg-gallery-item a {
    text-decoration: none;
    color: inherit;
}

.amgg-item-cover {
    border-radius: 12px;
    overflow: hidden;
}

/* Pagination */
.amgg-pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.amgg-pagination a,
.amgg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.amgg-pagination a {
    background: #f5f5f5;
    color: #333;
}

.amgg-pagination a:hover {
    background: #e0e0e0;
}

.amgg-pagination .current {
    background: #3b82f6;
    color: #fff;
}

/* ==========================================================================
   Lightbox — Modal de Fotos
   ========================================================================== */
.amgg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.amgg-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.amgg-lightbox-container {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    width: 92vw;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: amgg-fade-in 0.3s ease;
}

@keyframes amgg-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* Header do Lightbox */
.amgg-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.amgg-lightbox-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
}

.amgg-lightbox-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.amgg-lightbox-close:hover {
    background: #f0f0f0;
    color: #1a1a1a;
}

/* Body do Lightbox */
.amgg-lightbox-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Loading */
.amgg-lightbox-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.amgg-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: amgg-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes amgg-spin {
    to { transform: rotate(360deg); }
}

/* Grid de Fotos no Lightbox */
.amgg-lightbox-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

@media (max-width: 600px) {
    .amgg-lightbox-photos {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

.amgg-lightbox-photo {
    position: relative;
    padding-top: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f0f0f0;
}

.amgg-lightbox-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.amgg-lightbox-photo:hover img {
    transform: scale(1.05);
}

.amgg-no-photos,
.amgg-error {
    text-align: center;
    padding: 40px;
    color: #666;
    grid-column: 1 / -1;
}

.amgg-error {
    color: #d63638;
}

/* ==========================================================================
   Photo Viewer — Visualização individual
   ========================================================================== */
.amgg-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: amgg-fade-in 0.2s ease;
}

.amgg-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
    line-height: 1;
}

.amgg-viewer-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.amgg-viewer-prev,
.amgg-viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.amgg-viewer-prev { left: 16px; }
.amgg-viewer-next { right: 16px; }

.amgg-viewer-prev:hover,
.amgg-viewer-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.amgg-viewer-image-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.amgg-viewer-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
}

.amgg-viewer-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 20px;
}

/* Esconder scrollbar do body quando lightbox aberto */
body.amgg-lightbox-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .amgg-lightbox-container {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .amgg-lightbox-header {
        padding: 16px;
    }
    
    .amgg-lightbox-body {
        padding: 16px;
    }
    
    .amgg-viewer-prev,
    .amgg-viewer-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}
