body {
  background: url("img/bg.png") no-repeat center center fixed;
  background-size: cover;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  margin: 0;
  padding: 0;
  text-align: center;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

header {
  margin-bottom: 20px;
}

.header .title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1a237e;
  margin: 4px 0 6px;
}
 
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

.searchbar {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 6px auto 6px;
  max-width: 520px;
}

.searchbar input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid #cfd8dc;
  border-radius: 28px;
  outline: none;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(28, 42, 90, 0.06);
  transition: box-shadow 240ms ease, transform 240ms ease;
  font-size: 0.95rem;
}
.searchbar input:focus {
  box-shadow: 0 8px 24px rgba(28, 42, 90, 0.12);
  transform: translateY(-1px);
}
.searchbar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #5c6bc0;
  font-size: 1rem;
}

.btn {
  padding: 10px 15px;
  margin-left: 5px;
  border: none;
  border-radius: 5px;
  background: white;
  color: darkblue;
  cursor: pointer;
}

#status {
  min-height: 20px;
  color: #0a0a0a;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

#status[data-type="loading"] {
  color: #0a4;
}
#status[data-type="error"] {
  color: #b00;
}
#status[data-type="success"] {
  color: #084;
}

#countries {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 6px 0 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.country-card {
  background: #ffffff;
  color: #1a237e;
  border-radius: 12px;
  padding: 10px 10px 8px;
  width: auto;
  text-align: center;
  transition: transform 240ms ease, box-shadow 240ms ease, filter 240ms ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 35, 126, 0.12);
}

.country-card img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: rgba(25, 25, 25, 0.02);
  border-radius: 10px;
}

h3 {
  font-size: 0.95rem;
  margin: 8px 0 2px;
  font-weight: 700;
  color: #0d1b66;
}

p {
  font-size: 0.78rem;
  margin: 2px 0 0;
  color: #5f6e9a;
}
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8eaf6;
  color: #1a237e;
  font-size: 0.72rem;
  margin-right: 6px;
}

.country-card:hover,
.country-card:focus {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(26, 35, 126, 0.18);
  outline: none;
}

#closecard {
  background: green;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.pagination {
  margin: 14px 0 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.pagination button {
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: #e8eaf6;
  color: #1a237e;
  cursor: pointer;
  transition: transform 240ms ease, background 240ms ease, box-shadow 240ms ease, opacity 240ms ease;
  min-width: 38px;
}
.pagination button:hover:not(:disabled) {
  transform: translateY(-1px);
}
.pagination button.active {
  background: #3949ab;
  color: #fff;
  box-shadow: 0 4px 12px rgba(57, 73, 171, 0.35);
}
.pagination button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

#countries[data-loading="true"] {
  position: relative;
}
#countries[data-loading="true"]::before {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 8px;
}

@media (min-width: 480px) {
  #countries {
    grid-template-columns: repeat(3, 1fr);
  }
  .country-card {
    width: auto;
  }
}
@media (min-width: 768px) {
  #countries {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 1024px) {
  #countries {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (min-width: 1280px) {
  #countries {
    grid-template-columns: repeat(6, 1fr);
  }
}

.detail .country-detail {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}
.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.detail .flag img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
}
.detail .info {
  text-align: left;
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 12px 16px;
}
.detail .info h2 {
  margin-top: 0;
  color: darkblue;
}
@media (min-width: 768px) {
  .detail-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.skeleton-card {
  border-radius: 12px;
  height: 150px;
  background: linear-gradient(90deg, rgba(255,255,255,0.35) 25%, rgba(255,255,255,0.65) 40%, rgba(255,255,255,0.35) 55%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.12);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty {
  color: #1a237e;
  background: #e8eaf6;
  border-radius: 12px;
  padding: 16px;
  margin: 10px auto;
  max-width: 480px;
}

.fade-in {
  animation: fadeIn 260ms ease;
}
@keyframes fadeIn {
  from { opacity: 0.15; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}