/**
 * Speaking Events Styles
 * Styles for the speaking events grid and cards (carousel-style)
 */

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    justify-items: center;
}

/* Event Thumbnail Cards (Carousel Style) */
.event-thumbnail {
    width: 280px;
    height: 320px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.event-thumbnail:hover {
    transform: translateY(-5px);
    border: 2px solid #5DA7E7;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.event-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upcoming-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 193, 7, 0.9);
    color: #212529;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.completed-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(40, 167, 69, 0.9);
    color: var(--text-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.inactive-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(108, 117, 125, 0.9);
    color: var(--text-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.event-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 15px 10px 15px;
    color: var(--text-white);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.event-thumbnail:hover .event-overlay {
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.event-date {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.4s ease;
}

.event-thumbnail:hover .event-date {
    font-size: 16px;
    margin-bottom: 15px;
    opacity: 1;
}

.event-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    transition: all 0.4s ease;
}

.event-thumbnail:hover .event-name {
    font-size: 20px;
    margin-bottom: 25px;
    line-height: 1.4;
}

.event-details-btn {
    background: transparent;
    color: var(--text-white);
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 10px;
    align-self: center;
    display: none;
    cursor: pointer;
}

.event-thumbnail:hover .event-details-btn {
    display: inline-block;
    animation: slideUpFade 0.3s ease forwards;
}

.event-details-btn:hover {
    background: white;
    color: #333;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
    background: #f9fafb;
    border-radius: 16px;
    border: 2px dashed #d1d5db;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-message {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Desktop Optimization */
@media (min-width: 1200px) {
    .event-modal-content {
        max-width: 1000px;
    }
    
    .event-modal-header {
        height: 350px;
    }
    
    .event-modal-body {
        padding: 40px;
    }
    
    #modal-event-title {
        font-size: 2.2rem;
        margin-bottom: 28px;
    }
    
    .modal-event-meta {
        padding: 28px;
        margin-bottom: 32px;
    }
    
    .modal-event-description {
        font-size: 1.1rem;
        margin-bottom: 36px;
    }
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .event-modal-content {
        max-width: 800px;
        margin: 15px;
    }
    
    .event-modal-header {
        height: 280px;
    }
    
    .event-modal-body {
        padding: 28px;
    }
    
    #modal-event-title {
        font-size: 1.9rem;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .events-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .event-thumbnail {
        width: 100%; /* Responsive width for mobile */
        height: 320px; /* Match videos carousel height */
    }
    
    .container {
        padding: 0 15px;
    }
    
    .section-header {
        padding: 40px 0 20px 0;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .section-header p {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .event-modal {
        padding: 15px;
    }
    
    .event-modal-content {
        max-width: none;
        width: 100%;
        max-height: 92vh;
        margin: 0;
        border-radius: 12px;
    }
    
    .event-modal-header {
        height: 220px;
        border-radius: 12px 12px 0 0;
    }
    
    .event-modal-body {
        padding: 24px;
    }
    
    #modal-event-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    .modal-event-meta {
        padding: 18px;
        margin-bottom: 24px;
        gap: 12px;
    }
    
    .modal-event-date,
    .modal-event-location,
    .modal-event-category {
        font-size: 0.95rem;
        gap: 12px;
    }
    
    .modal-event-meta i {
        width: 20px;
        font-size: 16px;
    }
    
    .modal-event-description {
        font-size: 1rem;
        margin-bottom: 28px;
    }
    
    .modal-event-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-event-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Small Mobile Responsive */
@media (max-width: 480px) {
    .events-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .event-thumbnail {
        height: 320px; /* Match videos carousel height */
    }
    
    .container {
        padding: 0 10px;
    }
    
    .section-header {
        padding: 30px 0 15px 0;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .section-header p {
        font-size: 0.9rem;
        padding: 0 5px;
        line-height: 1.5;
    }
    
    .event-modal {
        padding: 10px;
    }
    
    .event-modal-content {
        border-radius: 10px;
        max-height: 95vh;
    }
    
    .event-modal-header {
        height: 180px;
        border-radius: 10px 10px 0 0;
    }
    
    .event-modal-body {
        padding: 20px;
    }
    
    #modal-event-title {
        font-size: 1.4rem;
        margin-bottom: 18px;
    }
    
    .modal-event-meta {
        padding: 16px;
        margin-bottom: 20px;
        gap: 10px;
    }
    
    .modal-event-date,
    .modal-event-location,
    .modal-event-category {
        font-size: 0.9rem;
        gap: 10px;
    }
    
    .modal-event-meta i {
        width: 18px;
        font-size: 15px;
    }
    
    .modal-event-description {
        font-size: 0.95rem;
        margin-bottom: 24px;
        line-height: 1.6;
    }
    
    .modal-event-actions {
        gap: 10px;
    }
    
    .modal-event-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-icon {
        font-size: 3rem;
    }
}

/* Filter and Search Styles */
.filters-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-filter {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #5DA7E7;
    box-shadow: 0 0 0 3px rgba(93, 167, 231, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: #5DA7E7;
}

.topic-filter {
    min-width: 200px;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #5DA7E7;
    box-shadow: 0 0 0 3px rgba(93, 167, 231, 0.1);
}

/* Load More Button - copied exactly from videos page (sg.css) */
.load-more-container {
    text-align: center !important;
    margin: 40px auto !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.load-more-btn {
    background: transparent !important;
    color: #5DA7E7 !important;
    border: 2px solid #5DA7E7 !important;
    padding: 15px 40px !important;
    border-radius: 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin: 0 auto !important;
    display: inline-block !important;
}

/* Force hide when no more events */
.load-more-btn[style*="display: none"],
.load-more-btn.hidden,
.load-more-container.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.load-more-btn:hover {
    background: #5DA7E7;
    color: var(--text-white);
    transform: translateY(-2px);
}

/* Admin Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex !important;
}

.modal[style*="display: block"] {
    display: flex !important;
}

.modal-dialog {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content {
    background: white;
    border-radius: 10px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Additional Images Styles */
.additional-image-item {
    margin-bottom: 10px;
}

.media-input-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.media-input-group .form-control {
    flex: 1;
}

.media-input-group .btn {
    flex-shrink: 0;
}

.image-preview {
    margin-top: 10px;
    display: none;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Event Details Modal */
.event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.event-modal[style*="display: flex"] {
    display: flex !important;
}

.event-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.event-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    z-index: 2;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.event-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 100;
    transition: all 0.3s ease;
}

.event-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* New Layout Structure */
.event-modal-layout {
    display: flex;
    min-height: 500px;
    max-height: 85vh;
}

.event-modal-left {
    flex: 0 0 60%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Keep desktop scrolling for left panel */
}

.event-modal-right {
    flex: 0 0 40%;
    background: #f8f9fa;
    padding: 30px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e9ecef;
    overflow-y: auto; /* Keep desktop scrolling for right panel */
}

/* Mobile-specific override to unify scrolling */
@media (max-width: 768px) {
    .event-modal-left {
        overflow-y: visible !important; /* Override desktop scrolling on mobile */
    }
    
    .event-modal-right {
        overflow-y: visible !important; /* Override desktop scrolling on mobile */
    }
}

.modal-event-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.modal-event-status.upcoming {
    background: rgba(255, 193, 7, 0.9);
    color: #212529;
}

.modal-event-status.completed {
    background: rgba(40, 167, 69, 0.9);
    color: var(--text-white);
}

.modal-event-status.inactive {
    background: rgba(108, 117, 125, 0.9);
    color: var(--text-white);
}

#modal-event-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 25px 0;
    line-height: 1.2;
}

.modal-event-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
    border-left: 4px solid #0a66c2;
}

.modal-event-date,
.modal-event-location {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

.modal-event-meta i {
    color: #0a66c2;
    width: 18px;
    font-size: 16px;
}

.modal-event-description {
    color: #666;
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 30px;
    flex: 1;
}

.modal-event-description h1,
.modal-event-description h2,
.modal-event-description h3 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-event-description ul,
.modal-event-description ol {
    margin: 15px 0;
    padding-left: 25px;
}

.modal-event-description li {
    margin-bottom: 8px;
}

.modal-event-description strong {
    color: #333;
}

.modal-event-images {
    flex: 1;
}

.modal-event-images h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Simplified Image Gallery Layout - Fixed Overlapping Issues */
.modal-images-container {
    display: block;
    width: 100%;
    height: auto;
    min-height: 200px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

/* Single Image Layout */
.modal-images-container.single-image {
    display: flex;
}

.modal-images-container.single-image .modal-image-item {
    width: 100%;
    aspect-ratio: 16/9;
    min-height: 280px;
}

/* Two Images Layout - Stacked Vertically */
.modal-images-container.two-images {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-images-container.two-images .modal-image-item {
    width: 100%;
    aspect-ratio: 16/9;
    min-height: 140px;
}

/* Unified Layout for 3+ Images - Big Image + 2x2 Grid */
.modal-images-container.three-images,
.modal-images-container.four-images,
.modal-images-container.many-images {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    min-height: 400px;
}

.modal-images-container.three-images .modal-image-item:first-child,
.modal-images-container.four-images .modal-image-item:first-child,
.modal-images-container.many-images .modal-image-item:first-child {
    width: 100%;
    aspect-ratio: 16/9;
    height: 280px;
    min-height: 280px;
}

.modal-images-container.three-images .modal-images-bottom-row,
.modal-images-container.four-images .modal-images-bottom-row,
.modal-images-container.many-images .modal-images-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 200px;
    min-height: 200px;
}

.modal-images-container.three-images .modal-images-bottom-row .modal-image-item,
.modal-images-container.four-images .modal-images-bottom-row .modal-image-item,
.modal-images-container.many-images .modal-images-bottom-row .modal-image-item {
    width: 100%;
    height: 100%;
    min-height: 96px;
    aspect-ratio: 4/3;
}

/* Base Image Item Styles */
.modal-images-container .modal-image-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f9fa;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.modal-images-container .modal-image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.modal-images-container .modal-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.modal-images-container .modal-image-item:hover img {
    transform: scale(1.05);
}

/* More images overlay */
.modal-image-item.has-more {
    position: relative;
}

.modal-image-item.has-more::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
    border-radius: 8px;
}

.modal-image-item.has-more::after {
    content: attr(data-more-count);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-white);
    font-size: 28px;
    font-weight: 700;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}



/* Loading state */
.modal-image-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Scrollbar styling */
.modal-images-container::-webkit-scrollbar {
    width: 4px;
}

.modal-images-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.modal-images-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.modal-images-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.modal-image-item.thumbnail {
    border: 2px solid #0a66c2;
    box-shadow: 0 0 0 1px rgba(10, 102, 194, 0.1);
}

.thumbnail-badge {
    display: none; /* Remove "Main" badge to reduce visual clutter */
}



/* Responsive adjustments */
@media (max-width: 768px) {
    .event-modal {
        padding: 10px;
        align-items: stretch;
    }
    
    .event-modal-layout {
        flex-direction: column;
        max-height: none; /* Remove height restriction */
        overflow-y: auto; /* Enable unified scrolling */
    }
    
    .event-modal-content {
        max-width: 100%;
        width: 100%;
        max-height: calc(100vh - 20px);
        height: calc(100vh - 20px);
        border-radius: 12px;
        overflow-y: auto; /* Enable scrolling on the entire modal */
    }
    
    .event-modal-left {
        padding: 25px;
        flex: none;
        overflow-y: visible; /* Remove individual scrolling */
    }
    
    .event-modal-right {
        background: white;
        border-left: none;
        border-top: 1px solid #e9ecef;
        padding: 20px 25px;
        flex: none;
        max-height: none; /* Remove height restriction */
        overflow-y: visible; /* Remove individual scrolling */
    }
    
    #modal-event-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    .modal-event-meta {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .modal-event-description {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    /* Fix images container to not have separate scrolling */
    .modal-event-images {
        flex: none; /* Don't flex, just take natural height */
    }
    
    /* Tablet responsive - stack some layouts */
    .modal-images-container.single-image {
        display: flex;
    }
    
    .modal-images-container.two-images {
        flex-direction: column;
        height: auto;
    }
    
    .modal-images-container.two-images .modal-image-item {
        aspect-ratio: 16/9;
        min-height: 140px;
    }
    
    .modal-images-container.three-images {
        flex-direction: column;
        height: auto;
        min-height: 350px;
    }
    
    .modal-images-container.three-images .modal-image-item:first-child {
        aspect-ratio: 16/9;
        min-height: 200px;
        height: auto;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row {
        flex-direction: row;
        height: auto;
        min-height: 140px;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row .modal-image-item {
        aspect-ratio: 4/3;
        min-height: 140px;
    }
    
    .modal-images-container.three-images,
    .modal-images-container.four-images,
    .modal-images-container.many-images {
        flex-direction: column;
        height: auto;
        min-height: 400px;
    }
    
    .modal-images-container.three-images .modal-image-item:first-child,
    .modal-images-container.four-images .modal-image-item:first-child,
    .modal-images-container.many-images .modal-image-item:first-child {
        aspect-ratio: 16/9;
        min-height: 200px;
        height: auto;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row,
    .modal-images-container.four-images .modal-images-bottom-row,
    .modal-images-container.many-images .modal-images-bottom-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        height: auto;
        min-height: 180px;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row .modal-image-item,
    .modal-images-container.four-images .modal-images-bottom-row .modal-image-item,
    .modal-images-container.many-images .modal-images-bottom-row .modal-image-item {
        aspect-ratio: 4/3;
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .event-modal {
        padding: 8px;
    }
    
    .event-modal-content {
        border-radius: 10px;
        max-height: calc(100vh - 16px);
        height: calc(100vh - 16px);
        width: 100%;
        overflow-y: auto; /* Ensure unified scrolling */
    }
    
    .event-modal-layout {
        overflow-y: visible; /* Remove layout-level scrolling */
    }
    
    .event-modal-left,
    .event-modal-right {
        padding: 20px;
        overflow-y: visible; /* Remove individual section scrolling */
    }
    
    #modal-event-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    
    .modal-event-meta {
        padding: 12px;
        margin-bottom: 15px;
        gap: 8px;
    }
    
    .modal-event-date,
    .modal-event-location {
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .modal-event-meta i {
        width: 16px;
        font-size: 14px;
    }
    
    .modal-event-description {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }
    
    /* Ensure images don't have separate scrolling */
    .modal-event-images {
        flex: none;
    }
    
    /* Mobile - all layouts become single column */
    .modal-images-container.single-image,
    .modal-images-container.two-images,
    .modal-images-container.three-images,
    .modal-images-container.four-images,
    .modal-images-container.many-images {
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: auto;
    }
    
    .modal-images-container .modal-image-item {
        aspect-ratio: 16/9;
        min-height: 120px;
        width: 100%;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row,
    .modal-images-container.four-images .modal-images-bottom-row,
    .modal-images-container.many-images .modal-images-bottom-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-x: visible;
        overflow-y: visible;
    }
    
    .modal-images-container.three-images .modal-images-bottom-row .modal-image-item,
    .modal-images-container.four-images .modal-images-bottom-row .modal-image-item,
    .modal-images-container.many-images .modal-images-bottom-row .modal-image-item {
        width: 100%;
        aspect-ratio: 16/9;
        min-height: 120px;
    }
}

.modal-event-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    align-items: center;
}

.modal-event-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.modal-event-btn.primary {
    background: linear-gradient(135deg, #5DA7E7, #4a8bc2);
    color: var(--text-white);
}

.modal-event-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(93, 167, 231, 0.3);
    text-decoration: none;
    color: var(--text-white);
}

.modal-event-btn.secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.modal-event-btn.secondary:hover {
    background: #e9ecef;
    color: #495057;
}

/* Animation for new events loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-thumbnail.new-item {
    animation: fadeInUp 0.5s ease forwards;
}

/* Video Modal Styles (for homepage videos) */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal[style*="display: flex"] {
    display: flex !important;
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.video-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    z-index: 2;
    animation: videoModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes videoModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.video-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 100;
    transition: all 0.3s ease;
}

.video-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.video-modal-header {
    padding: 25px 25px 15px 25px;
    border-bottom: 1px solid #e9ecef;
}

#modal-video-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.3;
    padding-right: 50px; /* Space for close button */
}

.video-modal-body {
    padding: 0;
}

.video-embed-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-modal-description {
    padding: 25px;
    border-top: 1px solid #e9ecef;
}

.video-modal-description h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.video-modal-description p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* Mobile responsive for video modal */
@media (max-width: 768px) {
    .video-modal {
        padding: 10px;
    }
    
    .video-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 10px;
    }
    
    .video-modal-header {
        padding: 20px 20px 15px 20px;
    }
    
    #modal-video-title {
        font-size: 1.3rem;
        padding-right: 45px;
    }
    
    .video-modal-description {
        padding: 20px;
    }
    
    .video-modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .video-modal {
        padding: 5px;
    }
    
    .video-modal-content {
        border-radius: 8px;
    }
    
    .video-modal-header {
        padding: 15px 15px 10px 15px;
    }
    
    #modal-video-title {
        font-size: 1.2rem;
        padding-right: 40px;
    }
    
    .video-modal-description {
        padding: 15px;
    }
}

/* Video Modal Styles (for homepage videos) */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal[style*="display: flex"] {
    display: flex !important;
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.video-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    z-index: 2;
    animation: videoModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes videoModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.video-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 100;
    transition: all 0.3s ease;
}

.video-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.video-modal-header {
    padding: 20px 60px 20px 20px;
    border-bottom: 1px solid #e9ecef;
}

.video-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.video-modal-body {
    padding: 0;
}

.video-embed-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-modal-description {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.video-modal-description h4 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.video-modal-description p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

/* Mobile responsive for video modal */
@media (max-width: 768px) {
    .video-modal {
        padding: 10px;
    }
    
    .video-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .video-modal-header {
        padding: 15px 50px 15px 15px;
    }
    
    .video-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .video-modal-description {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .video-modal-header {
        padding: 12px 45px 12px 12px;
    }
    
    .video-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .video-modal-description {
        padding: 12px;
    }
}

/* Enhanced Image Modal with Navigation */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: imageModalSlideIn 0.3s ease forwards;
}

@keyframes imageModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal Controls */
.image-modal-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 4;
}

.image-modal-close,
.image-modal-nav {
    background: rgba(0, 0, 0, 0.9);
    color: var(--text-white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.image-modal-close:hover,
.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transform: scale(1.1);
}

.image-modal-close:active,
.image-modal-nav:active {
    transform: scale(0.95);
}

/* Navigation Buttons */
.image-modal-nav.prev {
    position: fixed;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    font-size: 14px;
    z-index: 999999;
}

.image-modal-nav.next {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    font-size: 14px;
    z-index: 999999;
}

.image-modal-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%) scale(1);
    background: rgba(100, 100, 100, 0.8) !important;
}

.image-modal-nav:disabled:hover {
    background: rgba(100, 100, 100, 0.8) !important;
    color: var(--text-white);
    transform: translateY(-50%) scale(1);
}

/* Debug: Make navigation buttons more visible */
.image-modal-nav {
    border: 3px solid rgba(255, 255, 255, 0.8) !important;
    background: rgba(0, 0, 0, 0.9) !important;
}

.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    border-color: #007bff !important;
}

/* Image Container */
.image-modal-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

#image-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease;
}

/* Image Counter */
.image-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-white);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    z-index: 4;
}

/* Loading State */
.image-modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-white);
    font-size: 16px;
}



@media (max-width: 768px) {
    .image-modal-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        color: var(--text-white);
    }
    
    .image-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
}
/* I
mage Modal/Lightbox Styles */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-modal[style*="display: flex"] {
    display: flex !important;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.image-modal-content {
    position: relative;
    background: transparent;
    border-radius: 12px;
    width: 90vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 800px;
    overflow: hidden;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.image-modal-close {
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 10;
}

.image-modal-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.image-modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.9);
}

.image-modal-nav.prev {
    left: 20px;
}

.image-modal-nav.next {
    right: 20px;
}

.image-modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.image-modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.image-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
}

/* Mobile responsive for image modal */
@media (max-width: 768px) {
    .image-modal-content {
        width: 95vw;
        height: 70vh;
        max-height: 600px;
    }
    
    .image-modal-nav {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .image-modal-nav.prev {
        left: 10px;
    }
    
    .image-modal-nav.next {
        right: 10px;
    }
    
    .image-modal-close {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .image-modal-controls {
        top: 10px;
        right: 10px;
    }
    
    .image-modal-counter {
        bottom: 15px;
        font-size: 13px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .image-modal-content {
        width: 98vw;
        height: 60vh;
        max-height: 500px;
    }
    
    .image-modal-nav {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .image-modal-close {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}/* Artic
les Page Grid Styles */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    justify-items: center;
}

/* Articles Page - Article Thumbnail Styles */
.articles-content-section .article-thumbnail {
    width: 280px;
    height: 220px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.articles-content-section .article-thumbnail:hover {
    transform: translateY(-5px);
    border: 2px solid #5DA7E7;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.articles-content-section .article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.articles-content-section .article-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: var(--text-white);
    padding: 10px;
    transition: all 0.3s ease;
}

.articles-content-section .article-meta {
    font-size: 11px;
    margin-bottom: 4px;
    opacity: 0.9;
}

.articles-content-section .article-date {
    color: #5DA7E7;
    font-weight: 600;
}

.articles-content-section .article-separator {
    color: rgba(255, 255, 255, 0.7);
}

.articles-content-section .article-reading-time {
    color: rgba(255, 255, 255, 0.9);
}

.articles-content-section .article-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 6px;
}

.articles-content-section .article-read-btn {
    background: transparent;
    color: #5DA7E7;
    border: 1px solid #5DA7E7;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.articles-content-section .article-read-btn:hover {
    background: #5DA7E7;
    color: var(--text-white);
}

/* Articles Page Mobile Responsive */
@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .articles-content-section .article-thumbnail {
        width: 100%;
        height: 220px;
    }
}

@media (max-width: 480px) {
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .articles-content-section .article-thumbnail {
        height: 220px;
    }
}

/* Empty State for Articles */
.articles-content-section .empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
    background: #f9fafb;
    border-radius: 16px;
    border: 2px dashed #d1d5db;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.articles-content-section .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.articles-content-section .empty-message {
    font-size: 1.1rem;
    line-height: 1.6;
}