/* Modern Eritrea Map Styles */

/* CSS Custom Properties for consistent theming */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #e74c3c;
  --accent-color: #3498db;
  --background-dark: #1a1a1a;
  --background-light: #f8f9fa;
  --text-primary: #ffffff;
  --text-secondary: #343a40;
  --border-radius: 8px;
  --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-elevated: 0 8px 30px rgba(0, 0, 0, 0.2);
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: all 0.2s ease-in-out;
}

/* Modern CSS Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base Styles */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-secondary);
  background: linear-gradient(135deg, var(--background-dark) 0%, #2c3e50 100%);
  min-height: 100vh;
}

/* Main Layout using CSS Grid */
.app-container {
  display: grid;
  grid-template-areas:
    "header header"
    "controls map"
    "info map";
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto auto 1fr;
  min-height: 100vh;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0;
  max-width: none;
}

/* Header Section */
.header {
  grid-area: header;
  background: var(--primary-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.header p {
  display: none;
}

.header-nav {
  display: flex;
  align-items: center;
}

.header-nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.9;
  transition: var(--transition-fast);
}

.header-nav a:hover {
  opacity: 1;
  color: var(--accent-color);
}

/* Controls Section */
.controls {
  grid-area: controls;
  background: var(--background-light);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* View Toggle Buttons */
.view-toggle {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.view-toggle button {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--accent-color);
  background: transparent;
  color: var(--accent-color);
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.85rem;
}

.view-toggle button.active,
.view-toggle button:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-subtle);
}

/* Search Input */
.search-container {
  position: relative;
}

#location-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

#location-search:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Map Container */
.map-section {
  grid-area: map;
  position: relative;
  background: url('../img/map.jpg') no-repeat top left;
  background-size: contain;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-elevated);
  min-height: 500px;
  overflow: hidden;
}

.map-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
}

/* Modern Markers */
.marker {
  position: absolute;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition-smooth);
  z-index: 10;
  background: var(--secondary-color);
  box-shadow: var(--shadow-subtle);
}

.zone-marker {
  width: 24px;
  height: 24px;
  background: linear-gradient(45deg, var(--secondary-color), #c0392b);
}

.city-marker {
  width: 16px;
  height: 16px;
  background: linear-gradient(45deg, var(--accent-color), #2980b9);
}

.marker:hover {
  transform: scale(1.3) translateY(-2px);
  box-shadow: var(--shadow-elevated);
  z-index: 20;
}

.marker.selected {
  transform: scale(1.4) translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 25;
}

.marker:focus {
  outline: 3px solid rgba(52, 152, 219, 0.5);
  outline-offset: 2px;
}

/* Info Section */
.info-section {
  grid-area: info;
  background: var(--background-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.location-info {
  padding: 0.75rem;
  transition: opacity 0.3s ease-in-out;
}

.location-details h2 {
  font-size: 1.3rem;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.english-name {
  font-size: 1rem;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.location-image {
  margin: 0.5rem 0;
}

.location-image img {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-smooth);
}

.location-image img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-elevated);
}

.location-image figcaption {
  margin-top: 0.5rem;
  font-style: italic;
  color: #666;
  font-size: 0.9rem;
}

/* Default Info Styling */
.default-info {
  text-align: center;
  padding: 1rem 0.5rem;
}

.default-info h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.instructions {
  margin-top: 1rem;
  text-align: left;
  background: #f1f3f4;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  font-size: 0.85rem;
}

.instructions p {
  margin: 0.25rem 0;
  padding: 0.25rem 0;
}

/* Buttons */
.view-cities-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 1rem;
  transition: var(--transition-fast);
}

.view-cities-btn:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: var(--shadow-subtle);
}

/* Navigation Bar - Now in header */

/* Responsive Design */
@media (max-width: 1024px) {
  .app-container {
    grid-template-areas:
      "header"
      "controls"
      "map"
      "info";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .view-toggle {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .search-container {
    flex: 1;
    min-width: 180px;
  }

  .map-section {
    min-height: 400px;
  }

  .map-container {
    min-height: 400px;
  }
}

@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }

  .app-container {
    padding: 0.1rem;
    gap: 0.1rem;
  }

  .header {
    padding: 0.5rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .header-nav a {
    font-size: 0.8rem;
  }

  .controls {
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.25rem;
  }

  .view-toggle {
    margin-bottom: 0.25rem;
    width: 100%;
  }

  .view-toggle button {
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
  }

  .map-section {
    min-height: 350px;
  }

  .map-container {
    min-height: 350px;
  }

  .marker {
    transform-origin: center;
  }

  .zone-marker {
    width: 18px;
    height: 18px;
  }

  .city-marker {
    width: 12px;
    height: 12px;
  }

  .location-info {
    padding: 0.5rem;
  }

  .location-details h2 {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1rem;
  }

  .header-nav a {
    font-size: 0.75rem;
  }

  .location-details h2 {
    font-size: 1rem;
  }

  .map-section {
    min-height: 300px;
  }

  .map-container {
    min-height: 300px;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000000;
    --secondary-color: #ff0000;
    --accent-color: #0000ff;
    --background-light: #ffffff;
    --text-secondary: #000000;
  }
}

/* Focus styles for better accessibility */
*:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Loading animation for images */
.location-image img {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.location-image img.loaded {
  opacity: 1;
}