/* ===================================
   Mini Geo Guesser - Main Styles
   =================================== */

/* CSS Variables for Theming */
:root {
  /* Light Theme Colors - Blue & Orange Complementary Pair */
  --bg-primary: #e8f1fb; /* Very light blue */
  --bg-secondary: #f0f7ff; /* Lighter blue tint */
  --bg-card: #ffffff; /* Pure white for cards */
  --text-primary: #0f2942; /* Deep blue-black */
  --text-secondary: #3d5a80; /* Medium blue-gray */
  --text-muted: #7a90ab; /* Light blue-gray */
  --border-color: #c5d9ed; /* Soft blue border */
  --shadow-sm: 0 1px 3px rgba(59, 130, 246, 0.1);
  --shadow-md: 0 4px 6px rgba(59, 130, 246, 0.15);
  --shadow-lg: 0 10px 25px rgba(59, 130, 246, 0.2);

  /* Brand Colors - Blue & Orange */
  --primary: #3b82f6; /* Vibrant blue */
  --primary-hover: #2563eb; /* Darker blue */
  --secondary: #fb923c; /* Warm orange */
  --accent: #f97316; /* Bold orange */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Transitions */
  --transition: all 0.3s ease;
}

/* Dark Theme - Darker Blue & Orange */
[data-theme="dark"] {
  --bg-primary: #0a1628; /* Very dark blue */
  --bg-secondary: #132540; /* Dark blue */
  --bg-card: #1a3554; /* Medium dark blue */
  --text-primary: #e8f1fb; /* Light blue-white */
  --text-secondary: #b8d4f1; /* Soft blue */
  --text-muted: #7a90ab; /* Blue-gray */
  --border-color: #2d4a6b; /* Blue border */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.8);

  /* Adjusted for dark mode */
  --primary: #60a5fa; /* Lighter blue for dark bg */
  --primary-hover: #3b82f6;
  --secondary: #fb923c; /* Keep orange vibrant */
  --accent: #fbbf24; /* Lighter orange-yellow */
}

/* ===================================
   Base Styles
   =================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================================
   Header
   =================================== */

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 2px solid var(--primary);
}

.score-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.score-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.theme-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  border-color: var(--primary);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Theme icon visibility */
.theme-icon {
  display: inline-block;
  transition: var(--transition);
}

[data-theme="dark"] .theme-icon.light {
  display: none;
}

[data-theme="light"] .theme-icon.dark {
  display: none;
}

[data-theme="dark"] .theme-icon.dark {
  display: inline-block !important;
  color: #fbbf24 !important; /* Bright yellow for moon emoji in dark mode */
  font-size: 2rem !important;
  text-align: center;
  vertical-align: middle;
  position: relative;
  z-index: 2;
}

[data-theme="light"] .theme-icon.light {
  display: inline-block;
}

[data-theme="dark"] .theme-icon.light {
  display: none;
}

[data-theme="light"] .theme-icon.dark {
  display: none;
}

/* ===================================
   Main Container
   =================================== */

.game-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

/* Screen Management */
.screen {
  animation: fadeIn 0.4s ease;
}

.screen.hidden {
  display: none;
}

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

/* ===================================
   Welcome Screen
   =================================== */

.welcome-screen {
  max-width: 600px;
  margin: 0 auto;
}

.welcome-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.welcome-content h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.welcome-content > p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.game-rules {
  text-align: left;
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.game-rules h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.game-rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-rules li {
  color: var(--text-secondary);
  padding-left: 0.5rem;
}

.difficulty-select {
  margin-bottom: 2rem;
}

.difficulty-select h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.btn-difficulty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.btn-difficulty:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-difficulty.active {
  border-color: var(--secondary);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.diff-icon {
  font-size: 2rem;
}

.stats-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

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

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===================================
   Buttons
   =================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================================
   Game Screen
   =================================== */

.game-screen {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  height: calc(100vh - 200px);
}

.hint-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.round-indicator {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.hint-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-primary);
}

.hint-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hint-text h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.hints-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hint-item {
  padding: 0.75rem;
  background: var(--bg-primary);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hint-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

/* Map Container */
.map-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 500px;
  height: 100%;
}

.map-instructions {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  font-weight: 600;
  color: var(--text-primary);
  border: 2px solid var(--primary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

#map {
  width: 100%;
  height: 100%;
  min-height: 500px;
  z-index: 1;
  background: var(--bg-primary);
}

/* ===================================
   Result Screen
   =================================== */

.result-screen {
  max-width: 600px;
  margin: 0 auto;
}

.result-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.result-content h2 {
  font-size: 1.75rem;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

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

.result-stat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.result-stat.highlight {
  border: 2px solid var(--secondary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(251, 146, 60, 0.3);
}

.result-stat.highlight .result-label,
.result-stat.highlight .result-value {
  color: white;
}

.result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.location-reveal {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.actual-location {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.actual-location strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.5rem;
}

/* ===================================
   Final Screen
   =================================== */

.final-screen {
  max-width: 700px;
  margin: 0 auto;
}

.final-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.trophy-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: trophy 1s ease;
}

@keyframes trophy {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.2) rotate(-10deg);
  }
  75% {
    transform: scale(1.2) rotate(10deg);
  }
}

.final-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.final-score {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(251, 146, 60, 0.4);
}

.final-score-label {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.final-score-value {
  font-size: 3.5rem;
  font-weight: 700;
  color: white;
}

.performance-message {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-weight: 600;
}

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

.final-stat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.final-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.final-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.final-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* ===================================
   Footer
   =================================== */

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 1024px) {
  .game-screen {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .hint-card {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .header-controls {
    gap: 0.75rem;
  }

  .score-display {
    padding: 0.375rem 0.75rem;
  }

  .score-label {
    font-size: 0.75rem;
  }

  .score-value {
    font-size: 1rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .game-container {
    padding: 1rem;
  }

  .welcome-content {
    padding: 2rem 1.5rem;
  }

  .welcome-icon {
    font-size: 3rem;
  }

  .welcome-content h2 {
    font-size: 1.5rem;
  }

  .difficulty-buttons {
    grid-template-columns: 1fr;
  }

  .result-stats,
  .final-stats {
    grid-template-columns: 1fr;
  }

  .final-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-preview {
    grid-template-columns: 1fr;
  }
}
