/* Theme Variables (Makes these colors universal so i can recall it for other styles */

/* Light-mode */
:root {
  --bg-color: hsl(0, 0%, 98%);
  --element-color: hsl(0, 0%, 100%);
  --text-color: hsl(200, 15%, 8%);
  --input-color: hsl(0, 0%, 52%);
  --shadow: 0 2px 4px rgba(0,0,0,0.06);
}
/* dark-mode */
body.dark-mode {
  --bg-color: hsl(207, 26%, 17%);
  --element-color: hsl(209, 23%, 22%);
  --text-color: hsl(0, 0%, 100%);
  --input-color: hsl(0, 0%, 100%);
}

 /* /Global Styles */ 

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

body {
    font-family: 'Nunito Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s; /* Smooth theme transition */
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Headers */

.header {
    background-color: var(--element-color);
    box-shadow: var(--shadow);
    padding: 24px 0;
    margin-bottom: 40px;
}

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

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* used for seach and filter */

.controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
}

.search-icon {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--input-color);
}

#search-input {
    width: 100%;
    padding: 18px 20px 18px 70px;
    border: none;
    border-radius: 5px;
    background-color: var(--element-color);
    color: var(--text-color);
    box-shadow: var(--shadow);
    font-family: inherit;
}

#search-input::placeholder {
    color: var(--input-color);
}

.filter-select {
    padding: 18px 20px;
    width: 200px;
    border: none;
    border-radius: 5px;
    background-color: var(--element-color);
    color: var(--text-color);
    box-shadow: var(--shadow);
    font-family: inherit;
    cursor: pointer;
}

/* grid for the different countries*/

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 60px;
    padding-bottom: 40px;
}

.country-card {
    background-color: var(--element-color);
    border-radius: 5px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.country-flag {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.card-body {
    padding: 24px;
}

.country-name {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
}

.card-info p {
    margin-bottom: 8px;
    font-weight: 600;
}

.card-info span {
    font-weight: 300;
}

/* Detail page */

.back-btn {
    background-color: var(--element-color);
    color: var(--text-color);
    border: none;
    padding: 10px 30px;
    box-shadow: 0 0 7px rgba(0,0,0,0.2);
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 60px;
    margin-top: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.detail-content {
    display: flex;
    flex-wrap: wrap;
    gap: 80px;
    align-items: center;
    padding-bottom: 60px;
}

.detail-flag {
    flex: 1;
    min-width: 300px;
    max-width: 560px;
}

.detail-flag img {
    width: 100%;
    height: auto;
    display: block;
}

.detail-info {
    flex: 1;
    min-width: 300px;
    color: var(--text-color);
}

.detail-name {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 30px;
}

.info-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 40px;
}

.info-col p {
    margin-bottom: 10px;
    font-weight: 600;
}

.info-col span {
    font-weight: 300;
}

.border-countries {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.border-countries strong {
    white-space: nowrap;
    margin-right: 10px;
}

.border-btn {
    background-color: var(--element-color);
    color: var(--text-color);
    padding: 5px 15px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
    font-size: 12px;
    border: none;
    cursor: pointer;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    
    .detail-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 40px;
    }
}