/**
 * IR Gallery - Frontend Styles
 *
 * @author    IntelliRascals
 * @copyright IntelliRascals
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0
 */

/* Gallery Grid */
.ir-gallery {
    padding: 20px 0;
}

.ir-gallery-description {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    line-height: 1.6;
}

.ir-gallery-description p:last-child {
    margin-bottom: 0;
}

.ir-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ir-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

.ir-gallery-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease;
}

.ir-gallery-trigger:hover {
    transform: scale(1.02);
}

.ir-gallery-trigger:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

.ir-gallery-thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    border-radius: 8px 8px 0 0;
}

.ir-gallery-item-title {
    display: block;
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border-radius: 0 0 8px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ir-gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Lightbox */
.ir-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ir-lightbox[hidden] {
    display: none;
}

.ir-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.ir-lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
    box-sizing: border-box;
}

.ir-lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ir-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.ir-lightbox-caption {
    margin-top: 20px;
    text-align: center;
    color: #fff;
    max-width: 800px;
}

.ir-lightbox-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 600;
}

.ir-lightbox-description {
    margin: 0;
    font-size: 15px;
    opacity: 0.85;
    line-height: 1.5;
}

/* Lightbox Close Button */
.ir-lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    z-index: 10;
}

.ir-lightbox-close:hover,
.ir-lightbox-close:focus {
    background: rgba(255, 255, 255, 0.2);
}

.ir-lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Lightbox Navigation */
.ir-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
    z-index: 10;
}

.ir-lightbox-nav:hover,
.ir-lightbox-nav:focus {
    background: rgba(255, 255, 255, 0.2);
}

.ir-lightbox-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ir-lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ir-lightbox-prev {
    left: 20px;
}

.ir-lightbox-next {
    right: 20px;
}

/* Lightbox Counter */
.ir-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .ir-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .ir-lightbox-container {
        padding: 50px 15px;
    }

    .ir-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .ir-lightbox-prev {
        left: 10px;
    }

    .ir-lightbox-next {
        right: 10px;
    }

    .ir-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .ir-lightbox-title {
        font-size: 16px;
    }

    .ir-lightbox-description {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ir-gallery-grid {
        grid-template-columns: 1fr;
    }

    .ir-gallery-thumbnail {
        aspect-ratio: 16 / 9;
    }
}

/* Loading state */
.ir-lightbox-image.loading {
    opacity: 0.5;
}

/* Animation */
.ir-lightbox {
    animation: irFadeIn 0.2s ease;
}

@keyframes irFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ir-lightbox-image {
    animation: irSlideIn 0.2s ease;
}

@keyframes irSlideIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
