* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
    color: #333;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.event-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.event-card.has-poster {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1rem;
}

.event-main-content {
    min-width: 0;
}

.event-poster-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.event-poster-sidebar img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s;
}

.event-poster-sidebar img:hover {
    transform: scale(1.02);
}

.poster-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.poster-modal.active {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.9);
}

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

.poster-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.poster-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.poster-modal-close:hover {
    color: #ccc;
}

@media (max-width: 768px) {
    .event-card.has-poster {
        display: flex;
        flex-direction: column;
    }
    
    /* Break out of event-main-content wrapper - make all children direct flex items */
    .event-card.has-poster .event-main-content {
        display: contents; /* This makes children behave as if they're direct children of event-card */
    }
    
    /* Mobile order: 1) title 2) date-time 3) event-tag 4) poster 5) description 6) location 7) destination 8) organised by */
    .event-card.has-poster .event-title {
        order: 1;
    }
    
    .event-card.has-poster .event-date-time {
        order: 2;
    }
    
    .event-card.has-poster .event-type-badge {
        order: 3;
    }
    
    .event-card.has-poster .event-poster-sidebar {
        order: 4;
    }
    
    .event-card.has-poster .event-section:has(.description) {
        order: 5;
    }
    
    .event-card.has-poster .location-section {
        order: 6;
    }
    
    .event-card.has-poster .destination-section {
        order: 7;
    }
    
    .event-card.has-poster .info-grid {
        order: 8;
    }
    
    /* Dividers don't need explicit ordering - let them follow their sections naturally */
    .event-card.has-poster .divider {
        display: none;
    }
    
    /* Bottom navigation at the end */
    .event-card.has-poster .bottom-nav {
        order: 10;
    }
    
    .event-poster-sidebar img {
        max-width: 300px;
        margin: 0 auto;
    }
}

.event-type-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.event-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.event-date-time {
    font-size: 1.25rem;
    color: #3498db;
    margin-bottom: 2rem;
    font-weight: 600;
}
.event-date {
    display: block;
}
.event-time {
    display: block;
    margin-top: 0.25rem;
    font-size: inherit; /* same size as date */
    font-weight: inherit;
    color: inherit;
}

.event-section {
    margin-bottom: 1rem;
}

/* Location below poster should be full-width when poster exists */
.location-section {
    /* default behaviour: same spacing as other sections */
}

.event-card.has-poster .location-section {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}

    /* Destination should also be full-width below the Location when a poster exists */
    .event-card.has-poster .event-section.destination-section {
        grid-column: 1 / -1;
        margin-top: 0.25rem;
    }

    .event-card.has-poster .info-grid {
        /* Ensure organiser/info grid sits below destination on wider screens */
        grid-column: 1 / -1;
        margin-top: 0.25rem;
    }

    .event-section.destination-section .section-content {
        padding-left: 0; /* keep left-aligned content */
    }

/* Location container: address on left, map on right */
.location-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.location-address {
    color: #555;
}

.location-map {
    width: 100%;
    min-height: 400px;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.location-map iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
}

.section-content {
    padding-left: 2rem;
    color: #555;
}

.address-line {
    margin-bottom: 0.25rem;
}

.address-line.address-link {
    margin-top: 0.5rem;
}

.description {
    white-space: pre-wrap;
    line-height: 1.8;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-item {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.info-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.info-value {
    color: #555;
}

.info-value a {
    color: #3498db;
    text-decoration: none;
    word-break: break-all;
}

.info-value a:hover {
    text-decoration: underline;
}

/* Organiser item with logo */
.organiser-item .organiser-value {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.organiser-logo-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.bottom-nav {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.btn-back {
    background-color: #2c3e50;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-back:hover {
    background-color: #34495e;
    color: white;
}

.map-placeholder {
    width: 100%;
    height: 300px;
    background: #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    margin-top: 1rem;
}

.event-card .divider {
    /* Span the full event card so left/right edges align equally with the card padding */
    grid-column: 1 / -1; /* when event-card is a grid (has poster), force full-width */
    height: 1px;
    background: #e0e0e0;
    margin: 0.4rem 0;
    width: calc(100% - 2rem); /* account for 1rem padding on each side of card */
    margin-left: auto;
    margin-right: auto;
}

/* Fallback for dividers outside event-card (rare) */
.divider:not(.inside-event-card) {
    height: 1px;
    background: #e0e0e0;
    margin: 0.4rem 0;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .event-card {
        padding: 1.5rem;
    }

    /* Mobile: divider should inset by 1.5rem each side (event-card padding) */
    .divider {
        width: calc(100% - 3rem);
        margin-left: auto;
        margin-right: auto;
    }
    
    .event-title {
        font-size: 1.5rem;
    }
    
    .section-content {
        padding-left: 0;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }

    .location-container {
        grid-template-columns: 1fr;
    }

    .location-map {
        height: 250px;
    }
}

/* Footer: match leftlist footer colors and center text */
footer {
  background-color: #1f2937;
  color: #e5e7eb;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/* Map Directions Styling */
.map-directions {
    margin-top: 1rem;
}

.map-directions-link {
    color: #3498db;
    text-decoration: none;
}

.map-directions-link:hover {
    text-decoration: underline;
}
