@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap");

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

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #e2e8f0;
  min-height: 100vh;
}

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

header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
}

h1 {
  font-size: 3.5rem;
  font-weight: 600;
}

h1 span {
  color: #60a5fa;
}

header p {
  font-size: 1.3rem;
  color: #94a3b8;
  margin-top: 10px;
}

.filter-container {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 150, 255, 0.2);
}

.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto 20px;
}

.search-box i {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1.2rem;
}

#inputSearch {
  width: 100%;
  padding: 16px 20px 16px 50px;
  font-size: 1.1rem;
  border-radius: 50px;
  border: none;
  background: rgba(30, 41, 59, 0.8);
  color: white;
  outline: none;
  transition: all 0.3s ease;
}

#inputSearch:focus {
  background: rgba(51, 65, 85, 0.9);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.3);
}

#continentFilter {
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  background: rgba(30, 41, 59, 0.8);
  color: white;
  font-size: 1rem;
  margin: 15px auto;
  display: block;
  min-width: 250px;
}

.range-container {
  text-align: center;
  margin: 20px 0;
}

.range-container label {
  display: block;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: #cbd5e1;
}

#inputRange {
  width: 80%;
  max-width: 500px;
  height: 8px;
  border-radius: 50px;
  background: #334155;
  outline: none;
  -webkit-appearance: none;
}

#inputRange::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: #60a5fa;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(96, 165, 250, 0.4);
}

#rangeValue {
  display: inline-block;
  width: 60px;
  text-align: center;
  font-weight: 600;
  color: #60a5fa;
  font-size: 1.3rem;
}

.sort-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.btnSort {
  background: rgba(51, 65, 85, 0.6);
  color: #e2e8f0;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.btnSort:hover {
  background: rgba(96, 165, 250, 0.2);
  transform: translateY(-3px);
}

.btnSort.active {
  background: #60a5fa;
  color: white;
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

.countries-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.card {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: all 0.4s ease;
  border: 1px solid rgba(100, 150, 255, 0.1);
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-bottom: 3px solid #60a5fa;
}

.card h2 {
  font-size: 1.4rem;
  margin: 15px 10px 8px;
  color: #e0f2fe;
}

.card h4 {
  color: #94a3b8;
  font-weight: 400;
  margin-bottom: 10px;
}

.card p {
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 15px;
}

.loader {
  text-align: center;
  padding: 100px 0;
  color: #60a5fa;
  font-size: 1.5rem;
}

.loader i {
  font-size: 3rem;
  margin-bottom: 20px;
}

footer {
  text-align: center;
  padding: 30px 0;
  color: #64748b;
  font-size: 0.9rem;
}

footer a {
  color: #60a5fa;
  text-decoration: none;
}

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

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2.8rem;
  }
  .sort-buttons {
    flex-direction: column;
    align-items: center;
  }
  .btnSort {
    width: 80%;
    max-width: 300px;
  }
  .countries-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .countries-container {
    grid-template-columns: 1fr;
  }
  header p {
    font-size: 1.1rem;
  }
}
/* Thème clair (par défaut sombre, clair en .light-theme) */
body.light-theme {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  color: #1e293b;
}

body.light-theme .container,
body.light-theme .filter-container,
body.light-theme .card {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(100, 150, 255, 0.3);
}

body.light-theme .card h2 {
  color: #0c4a6e;
}
body.light-theme .btnSort {
  background: rgba(226, 232, 240, 0.8);
  color: #1e293b;
}

/* Header actions */
.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

#theme-toggle,
#favorites-btn {
  background: rgba(51, 65, 85, 0.6);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
}

#theme-toggle:hover,
#favorites-btn:hover {
  background: #60a5fa;
  transform: scale(1.1);
}

#favorites-count {
  font-size: 0.9rem;
  background: #ef4444;
  padding: 2px 8px;
  border-radius: 50%;
}

/* Animation cartes */
.card {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Favori cœur */
.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.favorite-btn.favorited {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(15px);
  padding: 30px;
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalFade 0.4s ease;
}

@keyframes modalFade {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2rem;
  cursor: pointer;
  color: #94a3b8;
}

#modal-body img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 20px;
}

#modal-body h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: #60a5fa;
}

#modal-body p {
  margin: 15px 0;
  font-size: 1.1rem;
}
