* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    list-style-type: none;
}

:root {
    --text-color: hsl(200,15%,8%);
    --shadow-color: hsl(0,0%,52%);
    --main-bg-color: hsl(0,0%,98%);
    --accent-color: hsl(0,0%,100%);
}

[data-theme='dark'] {
    --text-color: hsl(0,0%,100%);
    --shadow-color: hsl(0,0%,52%);
    --main-bg-color: hsl(207,26%,17%);
    --accent-color: hsl(209,23%,22%);
}

img {
    max-width: 100%;
    display: block;
}

body {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    font-family: 'Nunito Sans';
    transition: background-color 250ms ease, color 250ms ease;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: auto;
}

header {
    background-color: var(--accent-color);
    padding: 1rem 0;
}

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

.dark-mode-btn {
    cursor: pointer;
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: .5rem 1rem;
    font-size: 1.25rem;
    font-weight: bold;
    border: 0;
    box-shadow: 0 0 5px var(--shadow-color);
    border-radius: .25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark-mode-btn i {
    display: inline-block;
    vertical-align: middle;
}

main {
    padding: 3rem 0;
}

.user-inputs {
    margin-bottom: 4rem;
    display: flex;
    justify-content: space-between;
}

.user-inputs .search-box {
    background-color: var(--accent-color);
    box-shadow: 0 0 5px var(--shadow-color);
    outline: 1px solid var(--main-bg-color);
    border-radius: .25rem;
}

.user-inputs select {
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: .75rem 1.5rem;
    box-shadow: 0 0 5px var(--shadow-color);
    border: 0;
    border-radius: .25rem;
    cursor: pointer;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 200px;
}
.user-inputs .search-box i {
    padding: 0 1rem;
}

.user-inputs .search-box input,
.user-inputs .search-box select {
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: .75rem;
}

.user-inputs .search-box input {
    width: 400px;
    border: 0;
    outline: 0;
}

.user-inputs .search-box select {
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: .75rem 1.5rem;
    box-shadow: 0 0 5px var(--shadow-color);
    border: 0;
    border-radius: .25rem;
    cursor: pointer;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 200px;
}

.country-list-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 4rem;
}

.country-list-container .country-item {
    cursor: pointer;
    background-color: var(--accent-color);
    color: var(--text-color);
    box-shadow: 0 0 5px var(--shadow-color);
    border: 0;
    border-radius: .35rem;
    overflow: hidden;
}

.country-list-container .country-item img {
    width: 100%;
    height: 180px;
    margin-bottom: 1rem;
}

.country-list-container .country-item .country-quick-info {
    padding: 1rem 1.5rem 2.5rem 1.5rem;
    text-align: left;
}

.country-list-container .country-item .country-quick-info h2 {
    margin-bottom: 1rem;
}

.country-list-container .country-item .country-quick-info p {
    margin-bottom: .5rem;
}

.country-detail-container {
    display: none;
}

.country-detail-container.show {
    display: block;
}

.country-detail-container .back-btn {
    cursor: pointer;
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: .7rem 2rem;
    margin-bottom: 4rem;
    border: 0;
    box-shadow: 0 0 5px var(--shadow-color);
    border-radius: .25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    width: fit-content;
}
.country-detail-container .back-btn i {
    display: inline-block;
}

.country-detail-container .country-information {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
}

.country-detail-container .country-information .country-flag img { 
    width: 100%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: .25rem;
}

.country-detail-container .country-information .country-details h1 {
    margin: 0 0 2rem 0;
    font-size: 2rem;
}

.country-detail-container .country-information .country-details ul {
    margin-bottom: 2.5rem;
    columns: 2;
    column-gap: 4rem;
}

.country-detail-container .country-information .country-details ul li {
    margin-bottom: .75rem;
    line-height: 1.5;
}

.country-detail-container .country-information .country-details .country-borders {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.country-detail-container .country-information .country-details .country-borders strong {
    margin-right: 1rem;
}

.country-detail-container .country-information .country-details .country-borders span {
    background-color: var(--accent-color);
    padding: .35rem 1.25rem;
    border-radius: .25rem;
    box-shadow: 0 0 5px var(--shadow-color);
    margin-bottom: 0.5rem;
    display: inline-block;
}


@media (max-width: 1024px) {
    .container {
        width: 85%;
    }
    .country-list-container {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
    .country-detail-container .country-information {
        gap: 4rem;
    }
}

@media (max-width: 768px) {
    .user-inputs {
        margin-bottom: 3rem;
        flex-direction: column;
        gap: 2rem;
    }
    .user-inputs .search-box {
        display: flex;
        align-items: center;
        width: 100%;
    }
    .user-inputs .search-box input {
        width: 100%;
    }

    .country-detail-container .country-information {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .country-detail-container .country-information .country-flag {
        max-width: 100%;
        margin: 0 auto;
    }
    
    .country-detail-container .country-information .country-details ul {
        columns: 1;
    }

    .country-detail-container .country-information .country-details .country-borders {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .country-detail-container .country-information .country-details .country-borders div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 540px) {
    .container {
        width: 88%;
    }
    header {
        font-size: .85rem;
    }
    .dark-mode-btn {
        font-size: 1rem;
    }
    .country-list-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .country-detail-container .back-btn {
        margin-bottom: 2.5rem;
        width: auto;
    }
    
    .country-detail-container .country-information .country-details h1 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
}