:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #64748b;
  --background-light: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --transition-base: all 0.2s ease-in-out;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Lora', 'Georgia', 'Times New Roman', 'Palatino', 'Liberation Serif', serif;
  --gradient-score-6: #2563eb;
  --gradient-score-5: #3b82f6;
  --gradient-score-4: #60a5fa;
  --gradient-score-3: #93c5fd;
  --gradient-score-2: #bfdbfe;
  --gradient-score-1: #dbeafe;
  --gradient-score-0: #f1f5f9;
}

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

body {
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  position: relative;
  color: var(--text-primary);
  background: var(--background-light);
}

/* Map Container */
#map-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#map {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0f2fe 0%, #9ac6dd 100%);
  cursor: pointer;
  display: flex;
}

#map-loading {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

/* Left Panel */
#left-pane {
  width: 380px;
  height: 100%;
  background: var(--surface-color);
  backdrop-filter: blur(10px);
  padding: 24px;
  padding-bottom: 120px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid var(--border-color);
}

.title {
  font-family: var(--font-serif);
  margin: 0 0 24px 0;
  text-align: center;
  color: var(--primary-color);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.05em;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Search Bar */
#search-container {
  margin-bottom: 24px;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  box-sizing: border-box;
  outline: none;
  transition: var(--transition-base);
  background: var(--surface-color);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}

#search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

#search-results {
  position: absolute;
  width: calc(100% - 0px);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  box-shadow: var(--shadow-md);
  margin-top: -5px;
}

.search-result-item {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-base);
  font-size: 14px;
  color: var(--text-primary);
}

.search-result-item:hover {
  background-color: var(--background-light);
  padding-left: 24px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item.highlighted {
  background-color: #eff6ff;
  border-left: 3px solid var(--primary-color);
}

#country-info {
  background: var(--background-light);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  flex: 1 1 0;
  min-height: 430px;
  max-height: 430px;
  overflow-y: auto;           /* scroll if content overflows */
}

.country-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.country-info-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition-base);
  font-weight: 600;
}

#close-button {
  font-size: 24px;
  line-height: 1;
}

.button:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.property-row {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.property-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.property-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
}

.property-total {
  margin: 12px 0 0 0;
  color: var(--primary-color);
  font-size: 18px;
  font-weight: 700;
  padding-top: 12px;
  border-top: 2px solid var(--border-color);
  text-align: right;
}

#faq-section {
  background: var(--background-light);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  flex: 1 1 0;
  min-height: 275px;
  max-height: 275px;
  overflow-y: auto;
}

.faq-content {
  padding: 16px 4px 8px 4px;
  text-align: left;
}

#faq-section .faq-content {
  text-align: left;
}

.faq-content h4 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--primary-color);
  border-left: 3px solid var(--primary-color);
  padding-left: 12px;
}

.faq-content p {
  font-size: 14px;
  margin-bottom: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: justify;
}

.faq-content ul {
  margin-left: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  list-style: none;
}

.faq-content li {
  margin-bottom: 8px;
  position: relative;
  padding-left: 20px;
  text-align: justify;
}

.faq-content li::before {
  content: "•";
  color: var(--primary-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Tourism Section */
#tourism-section {
  background: var(--background-light);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  flex: 0 0 auto;         /* Only take as much space as needed */
}

.tourism-title {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: -0.025em;
}

#random-countries {
    background: var(--background-light);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    flex: 0 0 auto;
}

.random-title {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: -0.025em;
}

.random-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-base);
}

.random-item:hover {
    background-color: var(--background-light);
    padding-left: 8px;
}

.random-item:last-child {
    border-bottom: none;
}

.random-item .flag {
    font-size: 18px;
    margin-right: 8px;
}

.random-item .name {
    font-weight: 500;
    flex: 1;
}

.random-item .score {
    font-weight: 600;
    color: var(--primary-color);
}

.placeholder-text {
  color: var(--text-secondary);
  font-style: normal;
  text-align: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 0;
}

/* Toggle Button */
#pane-toggle {
  position: absolute;
  top: 24px;
  left: 380px;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: var(--surface-color);
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  color: var(--primary-color);
}

#pane-toggle:hover {
  background: var(--background-light);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%) scale(1.1);
}

.toggle-icon {
  font-size: 20px;
  font-weight: 300;
  transition: transform 0.3s ease;
  line-height: 1;
}

/* Pane hidden states */
.pane-hidden #left-pane {
  transform: translateX(-100%);
}

.pane-hidden #pane-toggle {
  left: 24px;
  transform: none;
}

.pane-hidden #pane-toggle:hover {
  transform: scale(1.1);
}

.pane-hidden .toggle-icon {
  transform: rotate(180deg);
}

/* Legend */
.legend {
  line-height: 18px;
  color: var(--text-primary);
  background: var(--surface-color);
  padding: 5px 5px;
  border-radius: 12px;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 500;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.legend i {
  width: 18px;
  height: 18px;
  float: left;
  margin-right: 8px;
  border-radius: 4px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--background-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  #left-pane {
    width: 100%;
    max-width: 380px;
  }

  #pane-toggle {
    left: 380px;
  }

  .pane-hidden #pane-toggle {
    left: 24px;
  }
}

/* Animation for score emojis */
.property-value {
  display: inline-block;
  transition: transform 0.2s ease;
}

.property-row:hover .property-value {
  transform: scale(1.1);
}

/* Leaflet zoom control customization */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface-color) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  transition: var(--transition-base) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--background-light) !important;
  color: var(--primary-color) !important;
}

.criteria-toggle {
  margin-right: 6px;
  vertical-align: middle;
}

footer {
  text-align: center;
  margin: 10px;
}

.leaflet-control-zoom {
  margin-bottom: 50px;
}
