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

html, body {
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: black;
    background: linear-gradient(to bottom, #f0f0f0, #ffffff);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
header {
    background-color: #003B95;
    color: white;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Permanent Marker', cursive;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.desktop-nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-nav {
    display: none;
}

/* Main content styles */
main {
    padding-top: 60px;
    flex: 1 0 auto;
    transition: padding-top 0.3s ease;
}

main.hero-hidden {
    padding-top: 120px;
}

/* Restaurants hero section styles */
.restaurants-hero {
    background-color: #003B95;
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.restaurants-hero.hidden {
    display: none;
}

.restaurants-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.restaurants-hero p {
    font-size: 1.2rem;
}

/* Search bar styles */
.search-bar {
    display: flex;
    max-width: 600px;
    margin: 2rem auto 0;
    -webkit-appearance: none;
    appearance: none;
}

.search-bar input {
    flex-grow: 1;
    padding: 0.75rem;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    -webkit-appearance: none;
    appearance: none;
}

.search-button {
    background-color: #0056b3;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 16px;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
}

.search-button:hover {
    background-color: #003d82;
}

/* Restaurants list section styles */
.restaurants-list {
    padding: 4rem 0;
}

.restaurants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.restaurants-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0;
}

.restaurants-header h2.showing-matches {
    font-size: 0.9rem;
    color: #666;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-container label {
    font-weight: bold;
}

.sort-container select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.restaurant-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.restaurant-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.restaurant-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    margin-bottom: 0.5rem;
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: auto;
}

.star-icon {
    color: #FFD700;
    fill: #FFD700;
}

.card-footer {
    background-color: #f4f4f4;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-details {
    background-color: #0056b3;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    text-decoration: none;
}

.view-details:hover {
    background-color: #003d82;
    transform: scale(1.05);
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-button {
    background-color: #003B95;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
}

.pagination-button:hover:not(:disabled) {
    background-color: #0056b3;
}

.pagination-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#page-info {
    font-size: 1rem;
    color: #333;
}

/* Footer styles */
footer {
    background-color: #1a1a1a;
    color: white;
    padding: 3rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style-type: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ddd;
    text-decoration: none;
}

.footer-section a:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: white;
    font-size: 1.5rem;
}

.copyright {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: #ddd;
}

/* No results message */
.no-results-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #666;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 19px;
    left: 10px;
    z-index: 1002;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.side-menu {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background-color: #003B95;
    z-index: 1001;
    transition: left 0.3s ease-in-out;
    padding: 60px 20px 20px;
    box-sizing: border-box;
}

.side-menu a {
    display: block;
    color: white;
    text-decoration: none;
    margin-bottom: 10px;
}

/* Responsive design */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .container {
        padding: 0 10px;
    }

    header .container {
        justify-content: center;
        padding: 0 15px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .desktop-nav {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #003B95;
        justify-content: space-around;
        padding: 5px 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .mobile-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 5px;
        color: white;
        text-decoration: none;
        font-size: 0.7rem;
    }

    .mobile-nav .nav-link i {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    .restaurants-hero {
        padding: 2rem 0;
    }

    .restaurants-hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .restaurants-hero p {
        font-size: 0.9rem;
    }

    .search-bar {
        flex-direction: row;
        max-width: 100%;
        margin: 1rem auto 0;
    }

    .search-bar input,
    .search-button {
        font-size: 16px;
        padding: 0.5rem;
        height: 44px;
    }

    .search-bar input {
        flex-grow: 1;
        border-radius: 4px 0 0 4px;
    }

    .search-button {
        width: auto;
        border-radius: 0 4px 4px 0;
    }

    .restaurants-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .restaurants-header h2 {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    .sort-container {
        display: flex;
        align-items: center;
        font-size: 0.8rem;
        width: auto;
    }

    .sort-container label {
        margin-right: 0.5rem;
        white-space: nowrap;
    }

    .sort-container select {
        padding: 0.3rem;
        font-size: 0.8rem;
        width: auto;
    }

    .restaurant-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .restaurant-card {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .restaurant-card img {
        height: 100px;
        object-fit: cover;
    }

    .card-content {
        padding: 0.5rem;
    }

    .card-content h3 {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .rating {
        font-size: 0.75rem;
    }

    .card-footer {
        padding: 0.4rem;
        font-size: 0.75rem;
    }

    .location {
        font-size: 0.7rem;
    }

    .view-details {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .pagination {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        margin-top: 1rem;
        margin-bottom: 5rem;
    }

    .pagination-button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    #page-info {
        font-size: 0.8rem;
    }

    footer {
        display: none;
    }
}

@media (max-width: 480px) {
    .restaurant-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .restaurant-card img {
        height: 90px;
    }

    .card-content h3 {
        font-size: 0.8rem;
    }

    .rating, .card-footer, .location {
        font-size: 0.7rem;
    }

    .view-details {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
}

@supports (padding: max(0px)) {
    .mobile-nav {
        padding-bottom: max(5px, env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: calc(60px + max(10px, env(safe-area-inset-bottom)));
    }
}

@media (max-width: 320px) {
    body {
        font-size: 12px;
    }

    .restaurants-hero h1 {
        font-size: 1.3rem;
    }

    .restaurants-hero p {
        font-size: 0.8rem;
    }

    .search-bar input,
    .search-button {
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    .restaurant-grid {
        gap: 6px;
    }

    .restaurant-card img {
        height: 80px;
    }

    .card-content h3 {
        font-size: 0.75rem;
    }

    .rating, .card-footer, .location {
        font-size: 0.65rem;
    }

    .view-details {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .search-button,
    .view-restaurant-button,
    .randomize-button,
    .recommendation-button,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
    }
}

@supports (-webkit-touch-callout: none) {
    .search-bar input,
    .search-button,
    .form-select {
        font-size: 16px;
    }

    .search-bar {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}