body {
    font-family: sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align content to the top */
    min-height: 100vh;      /* Ensure body takes at least full viewport height */
    margin: 0;
    padding: 2rem 0;        /* Add some vertical padding for spacing */
    box-sizing: border-box; /* Include padding in height calculation */
}

.container {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px; /* Restored for default pages */
}

h1 {
    text-align: center;
    color: #333;
}

form {
    display: flex;
    flex-direction: column;
}

label {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #555;
}

input[type="text"],
input[type="datetime-local"] {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.checkbox-container {
    margin-top: 1rem;
    display: flex;
    align-items: center;
}

input[type="checkbox"] {
    margin-right: 0.5rem;
}

#map-container {
    margin-top: 1rem;
}

#map {
    height: 500px;
    width: 100%;
    background-color: #eee;
}

button {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0056b3;
}

.hidden {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    table-layout: fixed; /* Fix table layout */
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    word-wrap: break-word; /* Wrap long words */
}

th {
    background-color: #f2f2f2;
}

#qrcode {
    margin: 1rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#qr-size-slider {
    width: 100%;
    max-width: 512px;
    margin: 0.5rem auto 1rem;
    display: block;
}

.attendance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
}

.attendance-header h2 {
    margin: 0;
}

/* Event Page Specific Layout - Using CSS Grid */
.event-page-container {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: single column */
    grid-template-areas:
        "info"
        "map"
        "attendance";
    gap: 2rem;
}

.event-info-area {
    grid-area: info;
}

.map-area {
    grid-area: map;
}

.attendance-area {
    grid-area: attendance;
}

#map-container-event {
    width: 100%;
    height: 100%;
    min-height: 300px; /* Ensure map has a minimum height */
}

#map-event {
    width: 100%;
    height: 100%;
}

/* Sorting Styles */
th[data-sort-by] {
    cursor: pointer;
    position: relative;
}

.sort-arrows {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-left: 5px;
    vertical-align: middle;
}

.sort-arrows::before,
.sort-arrows::after {
    content: '';
    position: absolute;
    right: 8px;
    border: 4px solid transparent;
}

.sort-arrows::before {
    top: 50%;
    margin-top: -10px;
    border-bottom-color: #ccc;
}

.sort-arrows::after {
    top: 50%;
    margin-top: 2px;
    border-top-color: #ccc;
}

th.sorted-asc .sort-arrows::before {
    border-bottom-color: #333;
}

th.sorted-desc .sort-arrows::after {
    border-top-color: #333;
}

/* Responsive Design for Desktop */
@media (min-width: 769px) {
    .event-page-container {
        /* Adjust columns to make the map area wider */
        grid-template-columns: 1fr 1.5fr;
        grid-template-areas:
            "info       map"
            "attendance map";
        align-items: start; /* Align items to the top of their grid area */
    }

    .map-area {
        /* Ensure the map area takes up the full height of its grid space */
        height: 100%;
    }
}

/* Time Info Alignment */
.event-time {
    display: grid;
    grid-template-columns: 120px auto; /* Adjust the first value based on the longest label */
    gap: 10px; /* Space between label and time */
    align-items: center;
    margin-bottom: 0.5rem; /* Add some space between the time rows */
}

.event-time strong {
    font-weight: bold;
    text-align: right; /* Align the labels to the right for a clean edge */
}

/* Responsive adjustments for mobile layout */
@media (max-width: 768px) {
    .attendance-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .attendance-header button {
        margin-top: 1em;
    }

    body {
        /* Override flex centering for mobile to allow simpler block layout */
        display: block;
        padding: 0;
    }

    .container.event-page-container {
        /* Add relative positioning to act as a container for the absolute banner */
        position: relative;
        /* Add padding to the top to make space for the banner */
        padding-top: 6em;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .create-event-banner {
        /* Position the banner at the top of the container */
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        box-sizing: border-box;
        z-index: 10;
        border-radius: 0;
    }
}
