/* Global reset and base font */
* {
    box-sizing: border-box;
    max-width: 100%;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    background-color: #fafafa;
    color: #111517;
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
}

/* Top navigation-like bar */
.top-bar {
    background-color: white;
    padding: 30px 20px; /* Reduced right/left padding */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.top-bar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: #111517;
}

/* Wrapper to align search and cards uniformly */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Reduced for mobile */
}

/* Controls aligned left */
.controls {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap; /* Prevent overflow */
    margin-bottom: 40px;
}

/* Search box aligned to left */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 14px 16px 14px 44px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
    color: #111517;
}

#searchInput::placeholder {
    color: #aaa;
}

/* Cards grid aligned with search */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    justify-content: center;
}

/* Country Card */
.country-card {
    background-color: #ffffff;
    border-radius: 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.3s ease;
    max-width: 100%;
    min-height: 360px;
}

.country-card:hover {
    transform: translateY(-6px);
}

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

.country-info {
    padding: 20px;
}

.country-name {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 12px;
    color: #111517;
}

.country-details p {
    font-size: 14px;
    margin: 4px 0;
    color: #333;
}

.country-details strong {
    font-weight: 600;
}

/*  Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .top-bar {
        padding: 20px;
    }

    .main-content {
        padding: 0 15px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 30px;
    }

    .countries-grid {
        gap: 20px;
    }

    #searchInput {
        font-size: 14px;
        padding: 12px 14px 12px 40px;
    }

    .country-name {
        font-size: 16px;
    }

    .country-details p {
        font-size: 13px;
    }
}
