/* --- CONTAINER --- */
.eag-wrapper {
    width: 100%;
    margin: 0 auto;
    font-family: inherit;
    box-sizing: border-box;
}

/* --- TABS --- */
.eag-nav-wrapper { margin-bottom: 30px; text-align: center; }
.eag-main-nav, .eag-sub-nav { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.eag-btn { padding: 10px 24px; border: 1px solid #ddd; background: #fff; cursor: pointer; border-radius: 30px; font-weight: 600; color: #444; transition: 0.3s; }
.eag-btn:hover { background: #f0f0f0; }
.eag-btn.active { background: #333; color: #fff; border-color: #333; }

/* --- INFO BOX --- */
.eag-info-box {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}
.eag-info-box h3 { margin: 0 0 10px 0; color: #222; }
.eag-info-box p { margin: 0; color: #666; }

/* --- LAYOUT COMMON --- */
.eag-container {
    width: 100%;
    box-sizing: border-box;
}

/* --- GRID MODE (Standard CSS Grid) --- */
.eag-container.eag-grid {
    display: grid;
    gap: 20px;
}
.eag-container.eag-grid.cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.eag-container.eag-grid.cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.eag-container.eag-grid.cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

.eag-container.eag-grid .eag-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1; /* Square */
    overflow: hidden;
    border-radius: 8px;
}
.eag-container.eag-grid .eag-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s;
}

/* --- MASONRY MODE (JS Controlled) --- */
.eag-container.eag-masonry {
    display: block;
    margin: 0 -10px; /* Offset the padding of items */
}

/* Items in Masonry */
.eag-container.eag-masonry .eag-item {
    float: left;
    margin: 0;
    padding: 10px; /* This creates the gap */
    box-sizing: border-box;
    border-radius: 8px;
    /* Height is determined by content */
}

/* Column Widths for Masonry */
.eag-container.eag-masonry.cols-2 .eag-item { width: 50%; }
.eag-container.eag-masonry.cols-3 .eag-item { width: 33.333%; }
.eag-container.eag-masonry.cols-4 .eag-item { width: 25%; }

.eag-container.eag-masonry .eag-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s;
}

/* Hover */
.eag-item:hover img { transform: scale(1.05); }

/* --- VIDEO CARDS --- */
.eag-video-card {
    background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden;
    position: relative;
}
.eag-video-card img { width: 100%; display: block; }
.eag-video-text { padding: 15px; }
.eag-video-text strong { display: block; margin-bottom: 5px; font-size: 16px; }
.eag-video-text p { margin: 0; font-size: 13px; color: #777; }

/* Play Button */
.eag-play-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 60px; height: 40px; background: red; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); pointer-events: none;
    z-index: 5;
}
.eag-arrow { width: 0; height: 0; border-left: 12px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* --- LIGHTBOX --- */
.eag-lightbox { display: none; position: fixed; z-index: 99999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); justify-content: center; align-items: center; }
.eag-lightbox-content { width: 90%; max-width: 900px; position: relative; }
.eag-lightbox-body { display: flex; justify-content: center; }
.eag-lightbox-body img { max-width: 100%; max-height: 80vh; border: 4px solid #fff; }
.eag-lightbox-body iframe { width: 100%; aspect-ratio: 16/9; border: none; }
.eag-close { position: absolute; top: -45px; right: 0; color: #fff; font-size: 40px; cursor: pointer; }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .eag-container.eag-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 50%; }
}
@media (max-width: 480px) {
    .eag-container.eag-grid { grid-template-columns: 1fr !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 100%; }
}


/* --- CONTAINER --- */
.eag-wrapper { width: 100%; margin: 0 auto; font-family: inherit; box-sizing: border-box; }

/* --- TABS --- */
.eag-nav-wrapper { margin-bottom: 30px; text-align: center; }
.eag-main-nav, .eag-sub-nav { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.eag-btn { padding: 10px 24px; border: 1px solid #ddd; background: #fff; cursor: pointer; border-radius: 30px; font-weight: 600; color: #444; transition: 0.3s; }
.eag-btn:hover { background: #f0f0f0; }
.eag-btn.active { background: #333; color: #fff; border-color: #333; }

/* --- INFO BOX --- */
.eag-info-box { text-align: center; margin-bottom: 25px; padding: 20px; border-radius: 8px; width: 100%; box-sizing: border-box; }
.eag-info-box h3 { margin: 0 0 10px 0; }
.eag-info-box p { margin: 0; }

/* --- LAYOUT COMMON --- */
.eag-container { width: 100%; box-sizing: border-box; }

/* --- GRID MODE --- */
.eag-container.eag-grid { display: grid; gap: 20px; }
.eag-container.eag-grid.cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.eag-container.eag-grid.cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.eag-container.eag-grid.cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
.eag-container.eag-grid .eag-item { position: relative; width: 100%; aspect-ratio: 1/1; overflow: hidden; border-radius: 8px; }
.eag-container.eag-grid .eag-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }

/* --- MASONRY MODE --- */
.eag-container.eag-masonry { display: block; margin: 0 -10px; }
.eag-container.eag-masonry .eag-item { float: left; margin: 0; padding: 10px; box-sizing: border-box; border-radius: 8px; }
.eag-container.eag-masonry.cols-2 .eag-item { width: 50%; }
.eag-container.eag-masonry.cols-3 .eag-item { width: 33.333%; }
.eag-container.eag-masonry.cols-4 .eag-item { width: 25%; }
.eag-container.eag-masonry .eag-item img { width: 100%; height: auto; display: block; border-radius: 8px; transition: transform 0.3s; }
.eag-item:hover img { transform: scale(1.05); }

/* --- VIDEO CARDS --- */
.eag-video-card { background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden; position: relative; }
.eag-video-card img { width: 100%; display: block; }
.eag-video-text { padding: 15px; }
.eag-video-text strong { display: block; margin-bottom: 5px; font-size: 16px; }
.eag-video-text p { margin: 0; font-size: 13px; color: #777; }
.eag-play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60px; height: 40px; background: red; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); pointer-events: none; z-index: 5; }
.eag-arrow { width: 0; height: 0; border-left: 12px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* --- LIGHTBOX (FIXED & IMPROVED) --- */
.eag-lightbox {
    display: none;
    position: fixed;
    z-index: 999999; /* Very high z-index */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.eag-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.eag-lightbox-body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Image in Lightbox */
.eag-lightbox-body img {
    max-width: 90vw;
    max-height: 85vh;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain;
}

/* Video in Lightbox */
.eag-lightbox-body iframe {
    width: 80vw;
    height: 45vw; /* 16:9 Aspect */
    max-width: 1000px;
    max-height: 560px;
    border: none;
}

/* Close Button */
.eag-close {
    position: absolute;
    top: -40px;
    right: -10px;
    color: #fff;
    font-size: 35px;
    line-height: 35px;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    text-align: center;
    border-radius: 50%;
    transition: 0.3s;
}
.eag-close:hover { background: rgba(255,0,0,0.8); }

/* Navigation Arrows */
.eag-prev, .eag-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    padding: 15px;
    cursor: pointer;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    transition: 0.3s;
    user-select: none;
}
.eag-prev:hover, .eag-next:hover { background: rgba(0,0,0,0.8); }
.eag-prev { left: 20px; }
.eag-next { right: 20px; }

/* Mobile Response */
@media (max-width: 768px) {
    .eag-container.eag-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 50%; }
    .eag-prev, .eag-next { padding: 10px; font-size: 30px; }
}
@media (max-width: 480px) {
    .eag-container.eag-grid { grid-template-columns: 1fr !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 100%; }
}



/* --- CONTAINER --- */
.eag-wrapper { width: 100%; margin: 0 auto; font-family: inherit; box-sizing: border-box; }

/* --- TABS --- */
.eag-nav-wrapper { margin-bottom: 30px; text-align: center; }
.eag-main-nav, .eag-sub-nav { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.eag-btn { padding: 10px 24px; border: 1px solid #ddd; background: #fff; cursor: pointer; border-radius: 30px; font-weight: 600; color: #444; transition: 0.3s; }
.eag-btn:hover { background: #f0f0f0; }
.eag-btn.active { background: #333; color: #fff; border-color: #333; }

/* --- INFO BOX --- */
.eag-info-box { text-align: center; margin-bottom: 25px; padding: 20px; border-radius: 8px; width: 100%; box-sizing: border-box; background: #f8f8f8; }
.eag-info-box h3 { margin: 0 0 10px 0; }
.eag-info-box p { margin: 0; }

/* --- LAYOUT COMMON --- */
.eag-container { width: 100%; box-sizing: border-box; }

/* --- GRID MODE --- */
.eag-container.eag-grid { display: grid; gap: 20px; }
.eag-container.eag-grid.cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.eag-container.eag-grid.cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.eag-container.eag-grid.cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
.eag-container.eag-grid .eag-item { position: relative; width: 100%; aspect-ratio: 1/1; overflow: hidden; border-radius: 8px; }
.eag-container.eag-grid .eag-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.eag-container.eag-grid .eag-item.type-video { aspect-ratio: auto; } 

/* --- MASONRY MODE --- */
.eag-container.eag-masonry { display: block; width: 100%; }
.eag-container.eag-masonry:after { content: ''; display: block; clear: both; }

.eag-container.eag-masonry .eag-item { 
    float: left; 
    margin: 0; 
    padding: 10px; 
    box-sizing: border-box; 
    border-radius: 8px; 
}

/* FORCED WIDTHS (!important is required to prevent JS stacking delay) */
.eag-container.eag-masonry.cols-2 .eag-item { width: 50% !important; }
.eag-container.eag-masonry.cols-3 .eag-item { width: 33.333% !important; }
.eag-container.eag-masonry.cols-4 .eag-item { width: 25% !important; }

/* Safety for hidden items */
.eag-container.eag-masonry .eag-item[style*="display: none"] { width: 0 !important; padding: 0 !important; margin: 0 !important; }

.eag-container.eag-masonry .eag-item img { width: 100%; height: auto; display: block; border-radius: 8px; transition: transform 0.3s; }
.eag-item:hover img { transform: scale(1.05); }

/* --- VIDEO CARDS --- */
.eag-video-card { background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden; position: relative; height: 100%; display: flex; flex-direction: column; }
.eag-video-card img { width: 100%; display: block; }
.eag-video-text { padding: 15px; flex-grow: 1; }
.eag-video-text strong { display: block; margin-bottom: 5px; font-size: 16px; }
.eag-video-text p { margin: 0; font-size: 13px; color: #777; }
.eag-play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60px; height: 40px; background: red; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); pointer-events: none; z-index: 5; margin-top: -30px; }
.eag-arrow { width: 0; height: 0; border-left: 12px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* --- LIGHTBOX --- */
.eag-lightbox { display: none; position: fixed; z-index: 999999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); flex-direction: column; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.eag-lightbox-content { position: relative; max-width: 90%; max-height: 90vh; display: flex; justify-content: center; align-items: center; }
.eag-lightbox-body { display: flex; justify-content: center; align-items: center; }
.eag-lightbox-body img { max-width: 90vw; max-height: 85vh; border: 2px solid #fff; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); object-fit: contain; }
.eag-lightbox-body iframe { width: 80vw; height: 45vw; max-width: 1000px; max-height: 560px; border: none; }
.eag-close { position: absolute; top: -40px; right: -10px; color: #fff; font-size: 35px; line-height: 35px; cursor: pointer; background: rgba(0,0,0,0.5); width: 40px; height: 40px; text-align: center; border-radius: 50%; transition: 0.3s; }
.eag-close:hover { background: rgba(255,0,0,0.8); }
.eag-prev, .eag-next { position: fixed; top: 50%; transform: translateY(-50%); color: #fff; font-size: 40px; padding: 15px; cursor: pointer; background: rgba(0,0,0,0.3); border-radius: 5px; transition: 0.3s; user-select: none; }
.eag-prev:hover, .eag-next:hover { background: rgba(0,0,0,0.8); }
.eag-prev { left: 20px; }
.eag-next { right: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .eag-container.eag-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 50% !important; }
}
@media (max-width: 480px) {
    .eag-container.eag-grid { grid-template-columns: 1fr !important; }
    .eag-container.eag-masonry.cols-2 .eag-item,
    .eag-container.eag-masonry.cols-3 .eag-item,
    .eag-container.eag-masonry.cols-4 .eag-item { width: 100% !important; }
}