@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --spg-primary: #2563eb;
    --spg-text: #1f2937;
    --spg-font: 'Outfit', sans-serif;
    --spg-bg: #ffffff;
    --spg-card-bg: #ffffff;
    --spg-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --spg-radius: 12px;
}

.spg-events-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.spg-event-card:first-child {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .spg-event-card:first-child {
        grid-column: span 1;
    }
}

.spg-event-card {
    background: var(--spg-card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    animation: spgFadeIn 0.8s ease-out backwards;
}

.spg-event-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.3);
}

.spg-event-card a {
    text-decoration: none !important;
    color: inherit;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Smooth Loading State */
.spg-event-thumbnail {
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    min-height: 250px;
    background: #f1f5f9;
}

.spg-event-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease, opacity 0.6s ease;
    opacity: 0;
}

.spg-event-thumbnail img[src] {
    opacity: 1;
}

.spg-event-card:hover .spg-event-thumbnail img {
    transform: scale(1.15);
}

@media (max-width: 768px) {
    .spg-events-grid, .spg-photos-grid, .spg-videos-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    .spg-event-card:first-child, .spg-photo-item:first-child {
        grid-column: span 1 !important;
    }
}

.spg-photo-count {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--spg-primary);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}



.spg-event-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,0.85) 100%);
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: all 0.4s ease;
}

.spg-event-info-overlay {
    width: 100%;
    color: white;
}

.spg-event-info-overlay h3 {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: white !important;
    font-family: var(--spg-font);
    line-height: 1.2;
}

.spg-event-info-overlay p {
    margin: 0 0 15px 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.4;
}

.spg-explore-btn {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--spg-primary);
    background: white;
    padding: 8px 16px;
    border-radius: 50px;
    display: inline-block;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
}

.spg-event-card:hover .spg-explore-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Detail View */
.spg-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
    gap: 20px;
}

.spg-event-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--spg-font);
    color: var(--spg-text);
    overflow: hidden;
    text-overflow: ellipsis;
}

.spg-back-button {
    text-decoration: none !important;
    color: var(--spg-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: none !important;
}

.spg-back-button:hover {
    color: #1d4ed8;
}

.spg-photos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
    animation: spgFadeIn 0.8s ease-out;
}

@media (max-width: 1024px) {
    .spg-photo-item:first-child {
        grid-column: span 1;
    }
    .spg-photos-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes spgFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.spg-photo-item {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: block !important;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.spg-photo-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.spg-photo-item a {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 100% !important;
    overflow: hidden;
    margin: 0 !important;
    border: none !important;
}

.spg-photo-item img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    transition: filter 0.3s ease;
}

.spg-photo-item:hover img {
    filter: brightness(1.05);
}

.spg-photo-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    font-family: var(--spg-font);
    line-height: 1.4;
    transition: all 0.3s ease;
}

.spg-photo-item:hover .spg-photo-caption-overlay {
    padding-bottom: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0) 100%);
}

.spg-photo-item:hover img {
    transform: scale(1.05);
}

@media (max-width: 640px) {
    .spg-events-grid {
        grid-template-columns: 1fr;
    }
    .spg-event-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Pagination */
.spg-pagination {
    margin-top: 40px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.spg-pagination .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border-radius: 8px;
    text-decoration: none !important;
    color: var(--spg-text);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.spg-pagination .page-numbers:hover {
    background: var(--spg-primary);
    color: #fff;
    transform: translateY(-2px);
}

.spg-pagination .page-numbers.current {
    background: var(--spg-primary);
    color: #fff;
}

/* Video Section */
.spg-videos-grid {
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.spg-video-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.spg-video-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.25);
}

.spg-video-card a {
    text-decoration: none !important;
    color: inherit;
}

.spg-video-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.spg-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.3s ease;
}

.spg-video-card:hover .spg-video-thumbnail img {
    transform: scale(1.1);
    opacity: 0.8;
}

.spg-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.spg-play-icon {
    width: 60px;
    height: 60px;
    background: var(--spg-primary);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.5);
    transition: all 0.3s ease;
}

.spg-play-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #ffffff;
}

.spg-video-card:hover .spg-play-icon {
    transform: scale(1.15);
    background: #1d4ed8;
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.8);
}

.spg-video-info {
    padding: 20px;
    background: #fff;
}

.spg-video-info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--spg-font);
    color: var(--spg-text);
    line-height: 1.4;
}

/* Lightbox */
.spg-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.spg-lightbox-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.spg-lightbox-content img {
    max-width: 90%;
    max-height: 80vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border-radius: 4px;
}

.spg-lightbox-caption {
    margin-top: 20px;
    color: #fff;
    font-size: 1.1rem;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 20px;
}

.spg-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 50px;
    font-weight: 300;
    cursor: pointer;
    transition: 0.3s;
    z-index: 100000;
    width: 60px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

.spg-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.2);
}

.spg-prev, .spg-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 20px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    text-decoration: none !important;
}

.spg-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.spg-prev {
    left: 0;
}

.spg-prev:hover, .spg-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

@media (max-width: 640px) {
    .spg-prev, .spg-next {
        padding: 10px;
        font-size: 20px;
    }
}

/* ==========================================================================
   EVENT LISTING TEMPLATES
   ========================================================================== */

/* 1. Modern Overlay (Default) */
.spg-tpl-modern .spg-event-info-classic { display: none; }

/* 2. Classic Card Grid */
.spg-tpl-classic .spg-event-overlay { display: none; }
.spg-tpl-classic .spg-event-info-classic { 
    display: block !important; 
    padding: 25px;
    background: #fff;
}
.spg-tpl-classic .spg-event-info-classic h3 { margin: 0 0 10px 0; font-size: 1.25rem; color: var(--spg-text); }
.spg-tpl-classic .spg-event-info-classic p { margin: 0 0 15px 0; font-size: 0.9rem; color: #64748b; }
.spg-tpl-classic .spg-classic-btn { color: var(--spg-primary); font-weight: 700; font-size: 0.85rem; }

/* 3. Glassmorphism Style */
.spg-tpl-glass .spg-event-info-classic { display: none; }
.spg-tpl-glass .spg-event-card { background: transparent; border: none; box-shadow: none; }
.spg-tpl-glass .spg-event-overlay {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 20px;
    height: calc(100% - 40px);
    width: calc(100% - 40px);
    border-radius: 20px;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
}
.spg-tpl-glass .spg-event-card:hover .spg-event-overlay { opacity: 1; }

/* 4. Masonry Dynamic Grid - Redesigned */
.spg-tpl-masonry { 
    column-count: 2; 
    column-gap: 40px; 
    display: block !important; 
    padding: 20px 0;
}

.spg-tpl-masonry .spg-event-info-classic { display: none !important; }

.spg-tpl-masonry .spg-event-card { 
    break-inside: avoid; 
    margin-bottom: 40px; 
    display: inline-block;
    width: 100%;
    border-radius: 24px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.spg-tpl-masonry .spg-event-card:hover {
    transform: translateY(-20px) scale(1.02);
    box-shadow: 0 40px 100px -20px rgba(37, 99, 235, 0.25);
    border-color: var(--spg-primary);
}

.spg-tpl-masonry .spg-event-thumbnail { 
    min-height: auto; 
    aspect-ratio: auto; 
    height: auto;
}

.spg-tpl-masonry .spg-event-thumbnail img {
    height: auto !important;
    position: static !important;
    transition: all 1s ease;
}

.spg-tpl-masonry .spg-event-card:hover .spg-event-thumbnail img {
    transform: scale(1.1) rotate(-1deg);
}

.spg-tpl-masonry .spg-event-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0) 100%);
    padding: 30px;
}

.spg-tpl-masonry .spg-event-info-overlay {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
}

.spg-tpl-masonry .spg-event-info-overlay h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Eye-catching badge for Masonry */
.spg-tpl-masonry .spg-photo-count {
    background: var(--spg-primary);
    color: #fff;
    padding: 8px 15px;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4);
}

@media (max-width: 768px) {
    .spg-tpl-masonry { column-count: 1; }
}

/* 5. Sleek List View */
.spg-tpl-list { display: flex !important; flex-direction: column; gap: 20px; }
.spg-tpl-list .spg-event-card a { flex-direction: row; align-items: center; }
.spg-tpl-list .spg-event-thumbnail { width: 300px; flex-shrink: 0; height: 200px; min-height: 200px; }
.spg-tpl-list .spg-event-info-classic { display: block !important; flex-grow: 1; padding: 30px; }
.spg-tpl-list .spg-event-overlay { display: none; }

/* 6. Timeline Card (New) */
.spg-tpl-timeline .spg-event-overlay,
.spg-tpl-timeline .spg-event-info-classic { display: none !important; }

/* Force 3 columns and reset first-child span for timeline template */
.spg-events-grid.spg-tpl-timeline {
    grid-template-columns: repeat(3, 1fr) !important;
}

@media (max-width: 1024px) {
    .spg-events-grid.spg-tpl-timeline {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .spg-events-grid.spg-tpl-timeline {
        grid-template-columns: 1fr !important;
    }
}

.spg-tpl-timeline .spg-event-card:first-child {
    grid-column: span 1 !important;
}

.spg-tpl-timeline .spg-event-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.spg-tpl-timeline .spg-event-thumbnail {
    aspect-ratio: 4 / 3;
    min-height: auto;
    border-bottom: 1px solid #f1f5f9;
}

.spg-tpl-timeline .spg-event-info-timeline {
    padding: 20px;
    background: #fff;
    display: flex !important;
    flex-direction: column;
    flex-grow: 1;
}

.spg-tpl-timeline .spg-event-info-timeline h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    font-family: var(--spg-font);
}

.spg-event-timeline-info {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.spg-event-timeline-info strong {
    color: #475569;
    font-weight: 600;
}

.spg-tpl-timeline .spg-photo-count {
    background: rgba(255, 255, 255, 0.95);
    color: #334155;
    font-size: 0.7rem;
    padding: 4px 10px;
}

/* ==========================================================================
   PHOTO GALLERY TEMPLATES
   ========================================================================== */

/* 1. Standard Grid - Modern "Floating" Design */
.spg-photo-tpl-grid {
    gap: 30px !important;
}

.spg-photo-tpl-grid .spg-photo-item {
    border-radius: 20px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.spg-photo-tpl-grid .spg-photo-item:hover {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 0 30px 60px rgba(0,0,0,0.12);
}

.spg-photo-tpl-grid .spg-photo-inner {
    border-radius: 15px;
    overflow: hidden;
}

.spg-photo-tpl-grid .spg-polaroid-caption { display: none; }

/* 2. Masonry Gallery - Artistic "Art Board" Design */
.spg-photo-tpl-masonry { column-gap: 30px; display: block !important; padding: 20px 0; }
.spg-photo-tpl-masonry .spg-photo-item { 
    break-inside: avoid; 
    margin-bottom: 30px; 
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.spg-photo-tpl-masonry .spg-photo-inner img { 
    aspect-ratio: auto !important; 
    filter: grayscale(20%);
    transition: all 0.8s ease;
}

.spg-photo-tpl-masonry .spg-photo-item:hover .spg-photo-inner img {
    filter: grayscale(0%);
    transform: scale(1.1);
}

.spg-photo-tpl-masonry .spg-photo-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 0 solid var(--spg-primary);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.spg-photo-tpl-masonry .spg-photo-item:hover::after {
    border-width: 8px;
}

.spg-photo-tpl-masonry .spg-photo-caption-overlay {
    background: var(--spg-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    padding: 10px;
    transform: translateY(100%);
}

.spg-photo-tpl-masonry .spg-photo-item:hover .spg-photo-caption-overlay {
    transform: translateY(0);
}

.spg-photo-tpl-masonry .spg-polaroid-caption { display: none; }

/* 3. Polished Tiles */
.spg-photo-tpl-tiles { gap: 5px !important; }
.spg-photo-tpl-tiles .spg-photo-item { border-radius: 0; }
.spg-photo-tpl-tiles .spg-photo-item img { border-radius: 0; }

/* 4. Vintage Polaroid */
.spg-photo-tpl-polaroid { gap: 40px !important; }
.spg-photo-tpl-polaroid .spg-photo-item { 
    background: #fff; 
    padding: 15px 15px 50px 15px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: rotate(-2deg);
    transition: all 0.3s;
}
.spg-photo-tpl-polaroid .spg-photo-item:nth-child(even) { transform: rotate(2deg); }
.spg-photo-tpl-polaroid .spg-photo-item:hover { transform: rotate(0) scale(1.05); z-index: 10; }
.spg-photo-tpl-polaroid .spg-photo-caption-overlay { display: none; }
.spg-photo-tpl-polaroid .spg-polaroid-caption { 
    display: block !important; 
    text-align: center; 
    padding-top: 15px;
    font-family: 'Outfit', sans-serif;
    color: #333;
    font-size: 1.1rem;
    font-weight: 700;
}

/* 5. Artistic Circle Grid */
.spg-photo-tpl-circle .spg-photo-item { border-radius: 50% !important; overflow: hidden; aspect-ratio: 1/1; }
.spg-photo-tpl-circle .spg-photo-inner { border-radius: 50%; }
.spg-photo-tpl-circle .spg-photo-caption-overlay { display: none; }
.spg-photo-tpl-circle .spg-polaroid-caption { display: none; }

