/* ═══════════════════════════════════════════
   Galeria de Fotos - Frontend CSS v4.0
   Non-invasive - scoped to .gf- prefix
   ═══════════════════════════════════════════ */

/* ─── Global: prevent horizontal overflow ─── */
body.gf-lb-open {
    overflow: hidden !important;
}

/* ─── Single Gallery Shortcode [galeria_foto id='X'] ─── */
/* All structural properties use !important to prevent theme overrides */

.gf-shortcode-gallery {
    max-width: 600px !important;
    margin: 30px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.gf-shortcode-cover {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 60% !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    display: block !important;
}

.gf-shortcode-cover:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
}

.gf-shortcode-cover img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.4s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    max-width: 100% !important;
}

.gf-shortcode-cover:hover img {
    transform: scale(1.05) !important;
}

.gf-shortcode-noimg {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f5f5f5 !important;
}

.gf-shortcode-noimg .dashicons {
    font-size: 64px !important;
    width: 64px !important;
    height: 64px !important;
    color: #ddd !important;
}

.gf-shortcode-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.gf-shortcode-cover:hover .gf-shortcode-overlay {
    opacity: 1 !important;
}

.gf-shortcode-info {
    text-align: center !important;
    color: #fff !important;
    padding: 20px !important;
}

.gf-shortcode-title {
    margin: 0 0 10px !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #fff !important;
    line-height: 1.3 !important;
    padding: 0 !important;
    border: none !important;
}

.gf-shortcode-count {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 0 0 16px !important;
    font-size: 14px !important;
    color: rgba(255,255,255,0.9) !important;
}

.gf-shortcode-count .dashicons {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

.gf-shortcode-btn {
    display: inline-block !important;
    padding: 10px 24px !important;
    background: #fff !important;
    color: #1a1a1a !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: all 0.2s !important;
    text-decoration: none !important;
    border: none !important;
}

.gf-shortcode-cover:hover .gf-shortcode-btn {
    background: #1a1a1a !important;
    color: #fff !important;
}

.gf-shortcode-photos {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ─── Gallery Grid (shortcode) ─── */

.gf-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.gf-container *,
.gf-single-wrap *,
.gf-lightbox * {
    box-sizing: border-box;
}

.gf-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.gf-empty .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ddd;
    display: block;
    margin: 0 auto 12px;
}

.gf-empty p {
    font-size: 16px;
    margin: 0;
}

.gf-grid {
    display: grid;
    gap: 20px;
}

.gf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gf-cols-4 { grid-template-columns: repeat(4, 1fr); }

.gf-item {
    display: block;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gf-item:hover,
.gf-item:focus {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    color: inherit !important;
    text-decoration: none !important;
}

.gf-item-cover {
    position: relative;
    width: 100%;
    padding-bottom: 75%;
    overflow: hidden;
    background: #f0f0f0;
}

.gf-item-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gf-item:hover .gf-item-cover img {
    transform: scale(1.06);
}

.gf-item-noimg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.gf-item-noimg .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ddd;
}

.gf-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.gf-item-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.gf-item-count .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.gf-item-footer {
    padding: 14px 16px;
}

.gf-item-title {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

/* ─── Pagination ─── */

.gf-pag {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.gf-pag-current,
.gf-pag-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s;
}

.gf-pag-current {
    background: #1a1a1a;
    color: #fff !important;
}

.gf-pag-link {
    background: #f5f5f5;
    color: #333 !important;
    border: 1px solid #e0e0e0;
}

.gf-pag-link:hover {
    background: #1a1a1a;
    color: #fff !important;
    border-color: #1a1a1a;
}

/* ─── Single Gallery Page ─── */

.gf-single-wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px 0 40px;
    overflow: visible;
    min-height: auto;
}

.gf-single-header {
    text-align: center;
    margin-bottom: 30px;
}

.gf-single-back-top {
    text-align: left;
    margin-bottom: 20px;
}

.gf-single-title-banner {
    background: linear-gradient(135deg, #e91e8c 0%, #d63384 50%, #e91e8c 100%);
    padding: 20px 40px;
    margin: 0 -20px 20px -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.gf-single-title-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.03) 10px,
        rgba(255,255,255,0.03) 20px
    );
    pointer-events: none;
}

.gf-single-title-banner .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #fff;
    position: relative;
    z-index: 1;
}

.gf-single-title-banner h1 {
    margin: 0;
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.gf-single-meta {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.gf-single-cat {
    display: inline-block;
    background: #f0f6fc;
    color: #2271b1;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.gf-single-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #888;
    font-size: 14px;
}

/* Share buttons */
.gf-single-share {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gf-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
    border: none;
    line-height: 1.4;
}

.gf-share-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.gf-copy-url {
    background: #f0f0f0;
    color: #333 !important;
    border: 1px solid #ddd;
}

.gf-copy-url:hover {
    background: #e0e0e0;
    color: #333 !important;
}

.gf-whatsapp-btn {
    background: #25d366;
    color: #fff !important;
}

.gf-whatsapp-btn:hover {
    background: #1fb855;
    color: #fff !important;
}

/* Photo grid */
.gf-single-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.gf-single-photo {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    background: #f0f0f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gf-single-photo:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.gf-single-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-width: 100%;
}

.gf-single-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.gf-single-empty .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #ddd;
    display: block;
    margin: 0 auto 12px;
}

/* Back button */
.gf-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #f5f5f5;
    color: #333 !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid #e0e0e0;
}

.gf-back-btn:hover {
    background: #1a1a1a;
    color: #fff !important;
    border-color: #1a1a1a;
}

.gf-back-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ═══════════════════════════════════════════
   LIGHTBOX - Fixed overlay, arrows NEXT to image
   ═══════════════════════════════════════════ */

.gf-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.gf-lb-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.95) !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.gf-lb-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.gf-lb-wrapper > * {
    pointer-events: auto !important;
}

/* Close button - always visible, top-right */
.gf-lb-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(255,255,255,0.2) !important;
    color: #fff !important;
    border: 2px solid rgba(255,255,255,0.4) !important;
    border-radius: 50% !important;
    font-size: 26px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: auto !important;
}

.gf-lb-close:hover {
    background: rgba(255,255,255,0.35) !important;
    border-color: #fff !important;
    transform: scale(1.1) !important;
}

/* Main area: [PREV] [IMAGE] [NEXT] - flex row, arrows next to image */
.gf-lb-main {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 90vw !important;
    max-height: 80vh !important;
    padding: 0 20px !important;
    margin: 0 !important;
    border: none !important;
}

/* Navigation arrows - positioned beside image, not at screen edges */
.gf-lb-prev,
.gf-lb-next {
    flex-shrink: 0 !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border: 2px solid rgba(255,255,255,0.35) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gf-lb-prev:hover,
.gf-lb-next:hover {
    background: rgba(255,255,255,0.3) !important;
    border-color: #fff !important;
    transform: scale(1.1) !important;
}

.gf-lb-prev svg,
.gf-lb-next svg {
    display: block;
}

/* Image container */
.gf-lb-content {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#gf-lb-img {
    max-width: 100% !important;
    max-height: 80vh !important;
    object-fit: contain !important;
    border-radius: 6px !important;
    display: block !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: none !important;
}

/* Footer bar */
.gf-lb-footer {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    background: rgba(0,0,0,0.7) !important;
    padding: 10px 24px !important;
    border-radius: 30px !important;
    z-index: 100 !important;
    max-width: 90vw !important;
    margin: 0 !important;
    border: none !important;
}

.gf-lb-title {
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    max-width: 300px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.gf-lb-counter {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════ */

/* Tablet landscape */
@media (max-width: 1024px) {
    .gf-cols-4 { grid-template-columns: repeat(3, 1fr); }
    .gf-single-grid { grid-template-columns: repeat(3, 1fr); }
    
    .gf-lb-main { max-width: 95vw; gap: 12px; }
}

/* Tablet portrait */
@media (max-width: 768px) {
    .gf-cols-3,
    .gf-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .gf-single-grid { grid-template-columns: repeat(2, 1fr); }
    
    .gf-grid { gap: 14px; }
    .gf-item-footer { padding: 12px 14px; }
    
    .gf-single-header { margin-bottom: 20px; }
    
    /* Lightbox tablet */
    .gf-lb-main { max-width: 98vw; gap: 8px; padding: 0 10px; }
    .gf-lb-prev, .gf-lb-next { width: 40px; height: 40px; }
    .gf-lb-prev svg, .gf-lb-next svg { width: 20px; height: 20px; }
    .gf-lb-close { width: 40px; height: 40px; font-size: 22px; top: 12px; right: 12px; }
    .gf-lb-footer { padding: 8px 16px; gap: 10px; }
    .gf-lb-title { max-width: 200px; font-size: 13px; }
}

/* Tablet */
@media (max-width: 768px) {
    .gf-container { padding: 16px; }
    
    .gf-cols-3,
    .gf-cols-4 { grid-template-columns: repeat(2, 1fr); }
    
    .gf-grid { gap: 18px; }
    .gf-item-cover { padding-bottom: 62%; }
    .gf-item-footer { padding: 14px 16px; }
    .gf-item-title { font-size: 15px !important; }
    
    .gf-single-title-banner { 
        padding: 18px 30px; 
        margin: 0 -16px 18px -16px;
    }
    .gf-single-title-banner h1 { 
        font-size: 24px; 
    }
    
    .gf-single-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .gf-single-back-top { text-align: center; margin-bottom: 16px; }
    .gf-single-header { margin-bottom: 20px; }
}

/* Mobile */
@media (max-width: 480px) {
    .gf-container { padding: 12px; }
    
    .gf-cols-2,
    .gf-cols-3,
    .gf-cols-4 { grid-template-columns: 1fr; }
    
    .gf-grid { gap: 16px; }
    .gf-item { border-radius: 10px; }
    .gf-item-cover { padding-bottom: 65%; }
    .gf-item-footer { padding: 12px 14px; }
    .gf-item-title { font-size: 14px !important; }
    
    .gf-single-wrap { padding: 8px 0 30px; }
    .gf-single-back-top { text-align: center; margin-bottom: 16px; }
    .gf-single-header { margin-bottom: 20px; }
    .gf-single-title-banner { 
        padding: 16px 20px; 
        margin: 0 -12px 16px -12px;
        gap: 8px;
    }
    .gf-single-title-banner .dashicons { 
        font-size: 24px; 
        width: 24px; 
        height: 24px; 
    }
    .gf-single-title-banner h1 { 
        font-size: 20px; 
        letter-spacing: 0.3px;
    }
    .gf-single-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .gf-single-photo { border-radius: 6px; }
    .gf-single-share { flex-direction: column; align-items: center; }
    .gf-share-btn { width: 100%; max-width: 250px; justify-content: center; }
    .gf-back-btn { width: 100%; max-width: 250px; justify-content: center; padding: 10px 16px; }
    
    /* Lightbox mobile - arrows still beside image but smaller */
    .gf-lb-main { gap: 4px; padding: 0 4px; }
    .gf-lb-prev, .gf-lb-next { width: 36px; height: 36px; min-width: 36px; }
    .gf-lb-prev svg, .gf-lb-next svg { width: 18px; height: 18px; }
    .gf-lb-close { width: 38px; height: 38px; font-size: 20px; top: 10px; right: 10px; }
    .gf-lb-content { max-height: 70vh; }
    #gf-lb-img { max-height: 70vh; border-radius: 4px; }
    .gf-lb-footer { bottom: 12px; padding: 6px 14px; gap: 8px; border-radius: 20px; }
    .gf-lb-title { max-width: 150px; font-size: 12px; }
    .gf-lb-counter { font-size: 12px; }
}

/* Very small screens */
@media (max-width: 360px) {
    .gf-single-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .gf-lb-prev, .gf-lb-next { width: 32px; height: 32px; min-width: 32px; }
    .gf-lb-prev svg, .gf-lb-next svg { width: 16px; height: 16px; }
}
