:root {
    --background-color: hsl(0, 0%, 98%);
    --text-color: hsl(200, 15%, 8%);
    --elements-color: hsl(0, 0%, 100%);
    --input-color: hsl(0, 0%, 52%);
}

.dark-mode {
    --background-color: hsl(207, 26%, 17%);
    --text-color: hsl(0, 0%, 100%);
    --elements-color: hsl(209, 23%, 22%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito Sans', sans-serif;
}

body {
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* HEADER */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.3rem clamp(1rem, 1vw + 4.5vw, 6rem);
    background: var(--elements-color);
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.1);
}

.header-title {
    font-size: medium;
    font-size: clamp(0.5rem, 2vw + 0.5rem, 1.9rem);
    font-weight: 900;
}

/* MODE-TOGGLE */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    font-weight: 600;
    font-size: clamp(0.5rem, 1vw + 0.5rem, 0.9rem);
    margin: 5px; /* Espaciado entre los botones */
    padding: 10px 15px; /* Espaciado interno de los botones */
    color: var(--text-color); /* Color del texto */
    border: 0.1em solid var(--elements-color);
    border-radius: 5px; /* Bordes redondeados */
    cursor: pointer; /* Cambia el cursor al pasar sobre el botón */
    transition: background-color 0.3s; /* Transición suave para el color de fondo */
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.3);
    transition: all 300ms cubic-bezier(.23, 1, 0.32, 1);
    user-select: none;
    touch-action: manipulation;
    will-change: transform;
}

.dark-mode-toggle:hover {
    background: var(--text-color);
    color: var(--background-color);
    transform: translateY(-2px);
    border-color: var(--text-color);
}

.dark-mode-toggle:active {
    box-shadow: none;
    transform: translateY(0);
}

/* MAIN PAGE CONTAINER */
.main-container {
    background: var(--background-color);
    margin-top: 2rem;
}

/* FILTERS CONTAINER */
.filters-container {
    display: flex;
    flex-direction: column;
    margin: 1.9rem clamp(1rem, 1vw + 4.5vw, 6rem);
    gap: 2.8rem;
}

.search-container {
    background: var(--elements-color);
    border-radius: 8px;
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    padding: 0.5rem 2.5rem;
}

.search-container ion-icon {
    color: var(--text-color);
    font-size: 1.3rem;
}

.search-country {
    border: none;
    outline: none;
    font-size: clamp(0.5rem, 1vw + 0.5rem, 0.9rem);
    color: var(--text-color);
    padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    margin: 0;
    background: transparent;
    width: 100%;
    font-weight: 600;
}

.search-country::placeholder {
    color: var(--text-color);
    font-size: clamp(0.5rem, 1vw + 0.5rem, 1rem);
}

.filter-country {
    padding: 1rem 1.5rem;
    color: var(--text-color);
    background: var(--elements-color);
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    max-width: 200px;
    width: 100%;
    padding-right: 2.5rem;
    font-weight: 600;
    font-size: clamp(0.5rem, 1vw + 0.5rem, 1rem);
}

.filter-country option {
    font-size: clamp(0.5rem, 1vw + 0.5rem, 1rem);
}

/* COUNTRY-CARDS CONTAINER */
#countries-container {
    display: grid;
    grid-template-columns: 75%;
    gap: clamp(2.5rem, 5vw + 2rem, 3rem);
    justify-content: center;
    padding: 3% 0;
    margin-bottom: 5%;
}

.country-card {
    display: flex;
    flex-direction: column;
    border-radius: 7px;
    overflow: hidden;
    background: var(--elements-color);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    height: 22rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.country-card:hover {
    transform: scale(1.03);
}

.country-flag {
    width: 100%;
    height: 11rem;
    object-fit: cover; 
}

.card-body {
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
}

.country-name {
    margin-bottom: clamp(1px, 2vw + 1px, 12px);;
    font-weight: 900;
    font-size: clamp(1.1rem, 2vw + 0.5rem, 1.4rem);
    line-height: 1.1;
}

.card-body span {
    font-weight: 700;
}

.card-body p {
    font-size: 1rem;
    line-height: 1.5;
}

/* PAGINATION */
.pagination {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    margin-bottom: 15%;
}

.pagination button  {
    appearance: none;
    background-color: var(--elements-color);
    border: 0.1em solid var(--elements-color);
    border-radius: 0.9375em;
    box-sizing: border-box;
    color: var(--text-color);
    cursor: pointer;
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    line-height: normal;
    margin: 0;
    outline: none;
    padding: 0.6rem 1rem;
    text-align: center;
    text-decoration: none;
    transition: all 300ms cubic-bezier(.23, 1, 0.32, 1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    will-change: transform;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.pagination button:disabled {
    pointer-events: none;
    border: 0.1em solid var(--elements-color);
    color: var(--input-color);
}

.pagination button:hover {
    color: var(--background-color);
    background-color: var(--text-color);
    box-shadow: rgba(0, 0, 0, 0.25) 0 8px 15px;
    transform: translateY(-2px);
    border-color: var(--text-color);
}

.pagination button:active {
    box-shadow: none;
    transform: translateY(0);
}

#page-info {
    color: var(--text-color);
    font-size: 16px;
    font-weight: 700;
}

/* MEDIA QUERIES */
@media (min-width: 600px){
    .search-container {
        width: 40%;
    }
    
    .filters-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;        
    }

    #countries-container {
        grid-template-columns: repeat(2, 260px);
    }
    .pagination {
        margin-bottom: 4%;
    }
}

@media (min-width: 900px){
    #countries-container {
    grid-template-columns: repeat(3, 260px);
    margin-bottom: 2%;
    }

    .country-card {
        height: 24rem;
    }

    .card-body p {
        line-height: 1.7;
    }

}

@media (min-width: 1200px){
    #countries-container {
    grid-template-columns: repeat(4, 260px);
    }

    .pagination {
        justify-content: center;
        gap: 4rem;
    }
}