/* style.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  border-bottom: 4px solid #5a67d8;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Search section */
.search-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#searchInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

#searchInput:focus {
  outline: none;
  border-color: #667eea;
}

#searchButton {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

#searchButton:hover {
  background: #5a67d8;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-btn {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
}

.quick-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* API Key section */
.api-key-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

.api-key-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

#apiKeyInput {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

#apiKeyInput:focus {
  outline: none;
  border-color: #667eea;
}

.note {
  display: block;
  margin-top: 0.5rem;
  color: #666;
  font-size: 0.85rem;
}

/* Loading */
#loading {
  text-align: center;
  padding: 2rem;
  font-size: 1.1rem;
  color: #555;
}

#loading p::before {
  content: "⏳ ";
}

/* Error message */
#error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #9b2c2c;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  margin: 1rem 0;
}

/* Country card */
#countryCard {
  animation: fadeIn 0.4s ease;
}

.card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  max-width: 700px;
  margin: 0 auto;
}

.flag {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-bottom: 2px solid #f0f0f0;
}

.country-info {
  padding: 2rem;
}

.country-info h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: #2d3748;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-item {
  background: #f7fafc;
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.label {
  font-weight: 600;
  color: #718096;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 600px) {
  header h1 {
    font-size: 2rem;
  }

  .search-box {
    flex-direction: column;
  }

  .card {
    flex-direction: column;
  }

  .flag {
    height: 200px;
  }

  .country-info {
    padding: 1.5rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}