/* Ensure the body and html elements cover the full height of the viewport */
html,
body {
    height: 100%;
    margin: 0;
    color: var(--primary_text_color);
    /* Dark gray text for readability */
    font-family: Arial, sans-serif;
    /* Consistent font */
}

/* Container for the list page */
.list-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    background: var(--background);

    /* White background for the container */
    /* Added styles for header */
    header {
        background: var(--primary_color);
        color: white;
        padding: 10px 20px;
        border-radius: 5px;
        margin-bottom: 20px;
        text-align: center;
    }
}

/* Styling for the search form */
.search-form {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    /* Stack elements vertically */
    gap: 10px;

    /* Focus states */
    input[type="text"]:focus,
    button:focus {
        border-color: var(--primary_dark_color);
        outline: none;
        box-shadow: 0 0 5px var(--primary_light_color);
    }
}

.search-form input[type="text"] {
    padding: 10px;
    border: 1px solid var(--border_color);
    /* Light gray border */
    border-radius: 4px;
    width: 100%;
    /* Full width on smaller screens */
    max-width: 100%;
    /* Adjust to container's width */
    box-sizing: border-box;
    background: var(--input_background);
}

.search-form button {
    padding: 10px;
    background: var(--primary_button_color);
    /* Dark blue button */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    /* Full width on smaller screens */
    transition: background 0.3s ease;
}

.search-form button:hover {
    background: var(--primary_button_hover_color);
    /* Lighter blue on hover */
}

/* Grid container styling */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Four equal-width columns by default */
    gap: 20px;
    flex-grow: 1;
    /* Allow the grid container to fill available space */
}

/* Individual grid item styling */
.grid-item {
    background: var(--background);
    /* White background for grid items */
    border: 1px solid var(--border_color);
    /* Light gray border */
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px var(--box_shadow_color);
    /* Subtle shadow for depth */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Distribute space evenly */
    height: 100%;
    /* Make all items equal height */
    transition: background 0.3s ease, transform 0.3s ease;
}

.grid-item:hover {
    background: var(--hover_bg_color);
    /* Change background on hover */
    transform: translateY(-5px);
    /* Slight lift on hover */
    cursor: pointer;
}

/* Ensure text links are styled properly */
.grid-item .title {
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    color: var(--header_color);
    /* Dark blue text */
    margin-bottom: 10px;
}

.grid-item .title:hover {
    text-decoration: underline;
}

.grid-item .details {
    margin-top: 10px;
    font-size: 14px;
}

.grid-item .date-time {
    font-weight: bold;
    color: var(--secondary_text_color);
}

.grid-item .topic,
.grid-item .location,
.grid-item .city {
    display: block;
}

/* Tag styling */
.tag {
    padding: 8px 12px;
    /* Padding around the tag */
    background: var(--blue_light);
    /* Background color for tags */
    color: #fff;
    /* White text color for contrast */
    border-radius: 100px;
    /* Fully rounded corners for tags */
    display: inline-block;
    /* Make tags inline-block for padding and margin */
    transition: background 0.3s ease;
    /* Smooth transition for hover effect */
}

.tag:hover {
    background: var(--blue_dark);
    /* Darker color on hover */
}

/* Topics styling */
.topics {
    margin: 10px 0;
    /* Add margin for spacing */
}

.topics p {
    font-size: 1.25rem;
    /* Larger font size for the title */
    font-weight: bold;
    /* Bold text for emphasis */
    margin-bottom: 10px;
    /* Spacing below the title */
}

.topics ul {
    list-style: none;
    /* Remove default list styles */
    padding: 0;
    /* Remove default padding */
    margin: 10px 0;
    /* Add margin for spacing */
    display: flex;
    /* Use flexbox for tags */
    flex-wrap: wrap;
    /* Allow tags to wrap to the next line */
}

.topics li {
    margin: 5px;
    /* Add margin between tags */
}

/* Pagination styling */
.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.pagination a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--blue_light);
    transition: color 0.3s ease;
}

.pagination a:hover {
    color: var(--blue_dark);
}

.pagination span {
    margin: 0 10px;
    font-weight: bold;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        /* Three columns for tablets */
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        /* Two columns for mobile devices */
    }

    .search-form {
        flex-direction: column;
        /* Stack elements vertically */
        gap: 10px;
    }

    .search-form input[type="text"],
    .search-form button {
        width: 100%;
        /* Full width */
    }

    .grid-item .title {
        font-size: 16px;
        /* Slightly smaller text on small screens */
    }

    .grid-item .details {
        font-size: 12px;
        /* Smaller font size for details */
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
        /* Single column layout for very small screens */
    }

    .search-form {
        padding: 10px;
        /* Adjust padding for small screens */
    }

    .grid-item .title {
        font-size: 14px;
        /* Further decrease font size */
    }

    .grid-item .details {
        font-size: 12px;
        /* Keep details font size consistent */
    }
}

.pagination span {
    margin: 0 10px;
    font-weight: bold;
    margin: auto 0;
}

.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 20px;
}

.button {
    background-color: var(--primary_color) !important;
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1em;
}

.button:hover {
    background-color: var(--primary_button_hover_color) !important;
}