/* ========================================
   Frontend Gallery Pages Styles
   BEM Methodology: Block__Element--Modifier
   ======================================== */

/* ========================================
   1. GALLERIES INDEX PAGE (LIST)
   ======================================== */

/* Gallery Section */
.galleries-section {
    padding: 60px 0 80px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 50%, #f8f9fa 100%);
    min-height: 600px;
    position: relative;
}

.galleries-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(52, 84, 209, 0.1) 50%, transparent 100%);
}

/* Gallery Filters */
.gallery-filters {
    margin-bottom: 30px;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.filter-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 12px;
}

.filter-buttons .btn {
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #495057;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-buttons .btn i {
    font-size: 13px;
}

.filter-buttons .btn:hover {
    background-color: #f8f9fa;
    border-color: #3454D1;
    color: #3454D1;
}

.filter-buttons .btn.active {
    background-color: #3454D1;
    color: #fff;
    border-color: #3454D1;
}

/* Galleries Grid - 4 columns */
.galleries-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

/* Gallery Card */
.gallery-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 280px;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.gallery-card__link {
    display: block;
    height: 100%;
    width: 100%;
    text-decoration: none;
    color: inherit;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

.gallery-card__image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    pointer-events: none;
}

.gallery-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-card__image img {
    transform: scale(1.1);
}

.gallery-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 48px;
}

.gallery-card__video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3454D1;
    font-size: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
    transition: all 0.3s ease;
}

.gallery-card__video-badge i {
    margin-left: 3px;
}

.gallery-card:hover .gallery-card__video-badge {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: #3454D1;
    color: #fff;
}

.gallery-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    padding: 20px 18px;
    z-index: 2;
}

.gallery-card:hover .gallery-card__overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.5) 70%, transparent 100%);
}

.gallery-card__info {
    position: relative;
    z-index: 1;
}

.gallery-card__title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card__count {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.gallery-card__count i {
    font-size: 13px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 100px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.empty-state__icon {
    font-size: 100px;
    color: #d0d0d0;
    margin-bottom: 30px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.empty-state__title {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
    line-height: 1.3;
}

.empty-state__text {
    font-size: 18px;
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 10px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
}

/* ========================================
   2. GALLERY DETAIL/SHOW PAGE
   ======================================== */

/* Gallery Detail Section */
.gallery-detail-section {
    padding: 60px 0 80px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 50%, #f8f9fa 100%);
    min-height: 600px;
    position: relative;
}

.gallery-detail-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(52, 84, 209, 0.1) 50%, transparent 100%);
}

/* Gallery Component */
.gallery-component {
    position: relative;
}

/* Gallery Controls */
.gallery-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.gallery-controls__btn {
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #495057;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.gallery-controls__btn i {
    font-size: 13px;
}

.gallery-controls__btn:hover {
    background-color: #f8f9fa;
    border-color: #3454D1;
    color: #3454D1;
}

.gallery-controls__btn.active {
    background-color: #3454D1;
    color: #fff;
    border-color: #3454D1;
}

/* Gallery Grid - 6 columns layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

/* Gallery Item */
.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.gallery-item[data-item-type="image"] {
    cursor: pointer;
}

.gallery-item[data-item-type="video"] {
    cursor: default;
}

/* Image Wrapper */
.gallery-item__image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f5f5f5;
    height: 180px;
}

.gallery-item__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

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

.gallery-item__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(55, 78, 148, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #fff;
    font-size: 32px;
}

.gallery-item__image-wrapper:hover .gallery-item__overlay {
    opacity: 1;
}

/* Video Wrapper */
.gallery-item__video-wrapper {
    position: relative;
    width: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-item__video-thumbnail {
    position: relative;
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    height: 180px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item__thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item__video-thumbnail:hover .gallery-item__thumbnail-img {
    transform: scale(1.05);
}

.gallery-item__play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3454D1;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.gallery-item__play-button i {
    margin-left: 3px;
}

.gallery-item__video-thumbnail:hover .gallery-item__play-button {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: #3454D1;
    color: #fff;
}

/* Video Embed */
.gallery-item__embed {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 5;
}

.gallery-item__embed.gallery-video-active {
    display: block;
}

.gallery-item__embed iframe,
.gallery-item__embed object,
.gallery-item__embed embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video Player */
.gallery-item__video {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 5;
}

.gallery-item__video.gallery-video-active {
    display: block;
}

.gallery-item__video-player {
    width: 100%;
    height: 100%;
    display: block;
    background-color: #000;
}

.gallery-video-hidden {
    display: none !important;
}

/* Caption */
.gallery-item__caption {
    padding: 12px;
    background-color: #fff;
    height: 70px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gallery-item__caption h4 {
    font-size: 13px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.gallery-item__caption p {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.gallery-item__caption h4:only-child {
    -webkit-line-clamp: 2;
    margin: 0;
}

/* ========================================
   3. LIGHTBOX
   ======================================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox__close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox__close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.lightbox__prev,
.lightbox__next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox__prev {
    left: 20px;
}

.lightbox__next {
    right: 20px;
}

.lightbox__prev:hover,
.lightbox__next:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox__content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox__content img {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

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

.lightbox__caption h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.lightbox__caption p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.6;
}

body.lightbox-open {
    overflow: hidden;
}

/* ========================================
   4. LOADING STATES
   ======================================== */

.gallery-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}

.gallery-loading__spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #374E94;
    border-radius: 50%;
    animation: gallery-spin 1s linear infinite;
}

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

/* ========================================
   5. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .galleries-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }

    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .galleries-section,
    .gallery-detail-section {
        padding: 40px 0;
    }

    .galleries-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .gallery-card {
        height: 250px;
    }
    
    .gallery-card__title {
        font-size: 15px;
    }
    
    .gallery-card__count {
        font-size: 12px;
        padding: 4px 10px;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .gallery-item__image-wrapper,
    .gallery-item__video-thumbnail {
        height: 160px;
    }
    
    .gallery-item__caption {
        height: 65px;
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .galleries-section,
    .gallery-detail-section {
        padding: 30px 0;
    }

    .gallery-filters {
        padding: 0;
    }

    .filter-buttons {
        justify-content: flex-start;
        padding: 0;
    }

    .filter-buttons .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .galleries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-card {
        height: 220px;
    }

    .gallery-card__title {
        font-size: 14px;
        -webkit-line-clamp: 1;
    }
    
    .gallery-card__overlay {
        padding: 15px 12px;
    }
    
    .gallery-card__count {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .gallery-card__video-badge {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .gallery-item__image-wrapper,
    .gallery-item__video-thumbnail {
        height: 140px;
    }
    
    .gallery-item__caption {
        height: 60px;
        padding: 10px;
    }
    
    .gallery-item__caption h4 {
        font-size: 12px;
    }
    
    .gallery-item__caption p {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    
    .gallery-item__play-button {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .lightbox__prev,
    .lightbox__next {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .lightbox__prev {
        left: 10px;
    }

    .lightbox__next {
        right: 10px;
    }

    .lightbox__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .gallery-controls {
        gap: 10px;
        padding: 20px 15px;
        justify-content: flex-start;
    }

    .gallery-controls__btn {
        font-size: 13px;
        padding: 8px 18px;
    }

    .gallery-controls__btn span {
        display: inline;
    }
}

@media (max-width: 576px) {
    .galleries-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .gallery-card {
        height: 260px;
    }
    
    .gallery-card__title {
        font-size: 15px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .gallery-item__image-wrapper,
    .gallery-item__video-thumbnail {
        height: 120px;
    }
    
    .gallery-item__caption {
        height: 55px;
        padding: 8px;
    }
    
    .gallery-item__caption h4 {
        font-size: 11px;
        margin-bottom: 3px;
    }
    
    .gallery-item__caption p {
        font-size: 10px;
        -webkit-line-clamp: 1;
    }
    
    .gallery-item__play-button {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }

    .empty-state {
        padding: 60px 20px;
    }

    .empty-state__icon {
        font-size: 60px;
    }

    .empty-state__title {
        font-size: 22px;
    }

    .empty-state__text {
        font-size: 14px;
    }

    .gallery-item__play-button {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }

    .lightbox {
        padding: 10px;
    }

    .lightbox__caption {
        margin-top: 15px;
    }

    .lightbox__caption h3 {
        font-size: 18px;
    }

    .lightbox__caption p {
        font-size: 14px;
    }
}

/* ========================================
   6. PAGINATION
   ======================================== */

.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

/* Print Styles */
@media print {
    .gallery-filters,
    .gallery-controls,
    .lightbox,
    .pagination-wrapper {
        display: none !important;
    }

    .galleries-grid,
    .gallery-grid {
        break-inside: avoid;
    }

    .gallery-card,
    .gallery-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
