:root {
  --primary: #6366f1;
  --secondary: #a855f7;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --card-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #22d3ee;
  --success: #10b981;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

#background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.15;
  background-size: cover;
  background-position: center;
  transition:
    background-image 0.8s ease-in-out,
    opacity 0.5s;
  filter: blur(10px);
}

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

/* Glassmorphism Classes */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
}

/* Header/Search section */
header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.8s ease-out;
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.search-container {
  max-width: 600px;
  margin: 2rem auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1.2rem 1.5rem;
  padding-right: 4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  color: white;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  outline: none;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-search {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  padding: 0 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 0.2s,
    background 0.3s;
}

.btn-search:hover {
  background: var(--secondary);
  transform: scale(1.05);
}

.quick-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
}

.region-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.chip {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.chip:hover {
  color: white;
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
}

/* Enhanced Info Grid */
.badge-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-un {
  background: #3b82f6;
  color: white;
}
.badge-car {
  background: #f59e0b;
  color: white;
}
.badge-status {
  background: #10b981;
  color: white;
}

.area-stats {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1.5rem;
}

/* Country Details */
#country-details {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease-out;
}

#country-details.visible {
  opacity: 1;
  transform: translateY(0);
}

.main-card {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2.5rem;
  padding: 2.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .main-card {
    grid-template-columns: 1fr;
  }
}

.flag-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 1rem;
}

.flag-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.info-section h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.coat-of-arms {
  height: 48px;
  object-fit: contain;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}

/* Neighbors Section */
#neighbor-section {
  margin-top: 3rem;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#neighbor-section.visible {
  opacity: 1;
}

.section-title {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 4px solid var(--primary);
}

.neighbors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.neighbor-card {
  cursor: pointer;
  padding: 0.5rem;
  text-align: center;
  transition:
    transform 0.3s,
    background 0.3s;
}

.neighbor-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.1);
}

.neighbor-flag {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.neighbor-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading Spinner */
.loader {
  display: none;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.show-loader {
  display: block;
}
