/**
 * WebsitesIdea Pro Gallery - Frontend CSS
 * PROFESSIONAL UI + MOBILE ARROWS AT BOTTOM
 */

/* Reset */
.wipg-wrapper,
.wipg-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Wrapper */
.wipg-wrapper {
    margin: 30px 0;
    width: 100%;
}

/* Grid Layout - Professional */
.wipg-grid {
    display: grid;
    gap: 20px;
}

.wipg-layout-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.wipg-layout-masonry {
    column-count: 3;
    column-gap: 20px;
}

.wipg-layout-masonry .wipg-item {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

/* Gallery Item - Attractive Cards */
.wipg-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wipg-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.15);
}

/* Link Wrapper */
.wipg-link {
    display: block;
    position: relative;
    text-decoration: none;
    line-height: 0;
}

.wipg-lightbox-trigger {
    cursor: zoom-in;
}

/* Image Wrapper - Aspect Ratio */
.wipg-img-wrap {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.wipg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wipg-item:hover .wipg-img {
    transform: scale(1.08);
}

/* Caption Text - Professional */
.wipg-text {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    font-weight: 500;
}

/* Navigation - Modern */
.wipg-nav {
    margin-top: 40px;
    text-align: center;
}

/* Load More Button - Attractive */
.wipg-btn-load {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.wipg-btn-load:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.wipg-btn-load:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wipg-spin {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pagination - Professional */
.wipg-pages {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.wipg-page-link {
    min-width: 44px;
    height: 44px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.wipg-page-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.wipg-page-link.wipg-current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

/* Infinite Trigger */
.wipg-infinite-trigger {
    height: 1px;
    margin: 20px 0;
}

/* No Images - Attractive Message */
.wipg-no-images {
    padding: 60px 40px;
    text-align: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
}

/* ==========================================
   LIGHTBOX - PROFESSIONAL DESIGN
   ========================================== */

.wipg-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: none;
}

.wipg-lightbox.active {
    display: block !important;
}

body.admin-bar .wipg-lightbox {
    top: 0 !important;
}

.wipg-lb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.wipg-lb-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 120px;
}

.wipg-lb-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

/* ==========================================
   LIGHTBOX BUTTONS - DESKTOP
   ========================================== */

.wipg-lb-close {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.25);
    border: 3px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 999999;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.wipg-lb-close:hover {
    background: rgba(255,255,255,0.4);
    transform: rotate(90deg) scale(1.1);
}

/* Navigation Arrows - DESKTOP (Side Position) */
.wipg-lb-prev,
.wipg-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.25);
    border: 3px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 999999;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.wipg-lb-prev {
    left: 40px;
}

.wipg-lb-next {
    right: 40px;
}

.wipg-lb-prev:not(:disabled):hover,
.wipg-lb-next:not(:disabled):hover {
    background: rgba(255,255,255,0.4);
    border-color: rgba(255,255,255,0.7);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
}

.wipg-lb-prev:disabled,
.wipg-lb-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    pointer-events: none;
}

/* ==========================================
   LIGHTBOX IMAGE
   ========================================== */

.wipg-lb-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.wipg-lb-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.3s;
}

.wipg-lb-img.loaded {
    opacity: 1;
}

.wipg-lb-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.wipg-lb-loader.active {
    display: block;
}

.wipg-lb-spin {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.wipg-lb-caption {
    padding: 15px 20px;
    background: rgba(0,0,0,0.7);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.wipg-lb-caption:empty {
    display: none;
}

.wipg-lb-counter {
    text-align: center;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.7);
}

/* ==========================================
   TABLET RESPONSIVE
   ========================================== */

@media (max-width: 1024px) {
    .wipg-layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .wipg-layout-masonry {
        column-count: 2;
    }
    
    .wipg-lb-container {
        padding: 60px 80px;
    }
    
    .wipg-lb-content {
        max-height: calc(100vh - 120px);
    }
    
    .wipg-lb-prev,
    .wipg-lb-next {
        width: 70px;
        height: 70px;
    }
    
    .wipg-lb-prev {
        left: 30px;
    }
    
    .wipg-lb-next {
        right: 30px;
    }
}

/* ==========================================
   MOBILE RESPONSIVE - ARROWS AT BOTTOM
   ========================================== */

@media (max-width: 768px) {
    .wipg-grid {
        gap: 15px;
    }
    
    /* Mobile Columns */
    .wipg-cols-mobile-1 .wipg-layout-grid {
        grid-template-columns: 1fr !important;
    }
    
    .wipg-cols-mobile-1 .wipg-layout-masonry {
        column-count: 1 !important;
    }
    
    .wipg-cols-mobile-2 .wipg-layout-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .wipg-cols-mobile-2 .wipg-layout-masonry {
        column-count: 2 !important;
    }
    
    .wipg-item {
        border-radius: 10px;
    }
    
    .wipg-text {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* ==========================================
       MOBILE LIGHTBOX - ARROWS AT BOTTOM
       ========================================== */
    
    .wipg-lb-container {
        padding: 20px 15px 100px; /* Extra bottom padding for arrows */
    }
    
    .wipg-lb-content {
        max-height: calc(100vh - 120px);
    }
    
    .wipg-lb-close {
        top: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .wipg-lb-close svg {
        width: 28px;
        height: 28px;
    }
    
    /* ==========================================
       ARROWS MOVED TO BOTTOM ON MOBILE
       ========================================== */
    
    .wipg-lb-prev,
    .wipg-lb-next {
        top: auto !important;
        bottom: 20px !important;
        transform: none !important;
        width: 60px;
        height: 60px;
    }
    
    .wipg-lb-prev {
        left: 20% !important;
    }
    
    .wipg-lb-next {
        right: 20% !important;
        left: auto !important;
    }
    
    .wipg-lb-prev:not(:disabled):hover,
    .wipg-lb-next:not(:disabled):hover {
        transform: scale(1.1) !important;
    }
    
    .wipg-lb-prev svg,
    .wipg-lb-next svg {
        width: 40px;
        height: 40px;
    }
    
    .wipg-lb-caption {
        font-size: 14px;
        padding: 12px 15px;
        margin-bottom: 80px; /* Space above arrows */
    }
    
    .wipg-lb-counter {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .wipg-btn-load {
        width: 100%;
        max-width: 320px;
    }
}

/* ==========================================
   SMALL MOBILE - BETTER ARROW SPACING
   ========================================== */

@media (max-width: 480px) {
    .wipg-grid {
        gap: 12px;
    }
    
    .wipg-layout-grid {
        grid-template-columns: 1fr !important;
    }
    
    .wipg-layout-masonry {
        column-count: 1 !important;
    }
    
    .wipg-text {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Mobile Arrows - Bottom Center */
    .wipg-lb-container {
        padding: 15px 10px 90px;
    }
    
    .wipg-lb-content {
        max-height: calc(100vh - 105px);
    }
    
    .wipg-lb-close {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
    
    .wipg-lb-close svg {
        width: 24px;
        height: 24px;
    }
    
    /* Arrows at bottom - centered */
    .wipg-lb-prev,
    .wipg-lb-next {
        bottom: 15px !important;
        width: 55px;
        height: 55px;
    }
    
    .wipg-lb-prev {
        left: 15% !important;
    }
    
    .wipg-lb-next {
        right: 15% !important;
    }
    
    .wipg-lb-prev svg,
    .wipg-lb-next svg {
        width: 35px;
        height: 35px;
    }
    
    .wipg-lb-caption {
        font-size: 13px;
        padding: 10px 12px;
        margin-bottom: 75px;
    }
    
    .wipg-lb-counter {
        font-size: 13px;
    }
}

/* ==========================================
   ADMIN BAR COMPATIBILITY
   ========================================== */

body.admin-bar .wipg-lightbox {
    top: 0 !important;
}

body.admin-bar .wipg-lb-container {
    padding: 80px 120px;
}

body.admin-bar .wipg-lb-content {
    max-height: calc(100vh - 160px);
}

@media (max-width: 782px) {
    body.admin-bar .wipg-lb-container {
        padding: 20px 15px 100px;
    }
    
    body.admin-bar .wipg-lb-content {
        max-height: calc(100vh - 120px);
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.wipg-lb-close:focus,
.wipg-lb-prev:focus,
.wipg-lb-next:focus,
.wipg-lightbox-trigger:focus {
    outline: 3px solid rgba(255,255,255,0.8);
    outline-offset: 3px;
}

@media (hover: none) and (pointer: coarse) {
    .wipg-lb-close {
        width: 55px;
        height: 55px;
    }
    
    .wipg-lb-prev,
    .wipg-lb-next {
        width: 65px;
        height: 65px;
    }
}

@media (prefers-contrast: high) {
    .wipg-lb-close,
    .wipg-lb-prev,
    .wipg-lb-next {
        border-width: 4px;
        border-color: rgba(255,255,255,0.9);
    }
}

#wpadminbar {
    z-index: 99999 !important;
}

.wipg-lightbox {
    z-index: 999999 !important;
}