/* Map Browser Modal Styles */
:root {
  --primary-bg: #0b1020;        /* Dark blue background */
  --secondary-bg: #0f1419;      /* Darker background */
  --accent-gold: #ffd700;       /* Gold accent to match Map button */
  --accent-gold-hover: #ffed4e; /* Lighter gold */
  --accent-red: #ff6b6b;        /* Red accent */
  --accent-red-hover: #ff5252;  /* Darker red */
  --text-primary: #ffffff;      /* White text */
  --text-secondary: #b0bec5;    /* Light gray text */
  --text-muted: #64748b;        /* Muted gray */
  --border-radius: 8px;
  --border-width: 2px;
  --shadow-lg: 0 20px 40px rgba(255, 215, 0, 0.3), 0 0 30px rgba(255, 215, 0, 0.1);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.4s ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Luckiest Guy', cursive;
  background: var(--secondary-bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none; /* Hidden by default - only show when Map button clicked */
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Container - 20% smaller */
.modal-container {
  position: relative;
  width: 100%;
  max-width: 1120px; /* Reduced from 1400px (20% smaller) */
  max-height: 72vh; /* Reduced from 90vh (20% smaller) */
  background: linear-gradient(135deg, var(--primary-bg), var(--secondary-bg));
  border: var(--border-width) solid var(--accent-gold);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Browse Mode */
.browse-mode {
  display: block;
}

.browse-mode.hidden {
  display: none;
}

/* Detail Mode */
.detail-mode {
  display: block;
  animation: fadeInScale 0.3s ease;
}

.detail-mode.hidden {
  display: none;
}

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

/* Modal Header */
.modal-header {
  padding: 1.5rem; /* Reduced from 2rem */
  border-bottom: var(--border-width) solid var(--accent-gold);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
}

.modal-title {
  color: var(--accent-gold);
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.8rem; /* Reduced from 2rem */
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem; /* Reduced from 1.5rem */
  display: flex;
  align-items: center;
  gap: 0.8rem; /* Reduced from 1rem */
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.modal-title i {
  font-size: 1.3rem; /* Reduced from 1.5rem */
  filter: drop-shadow(0 0 10px var(--accent-gold));
}

/* Search Container */
.search-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: var(--border-width) solid var(--accent-gold);
  color: var(--text-primary);
  padding: 0.8rem 1.2rem; /* Reduced from 1rem 1.5rem */
  padding-right: 3.2rem; /* Reduced from 4rem */
  font-size: 1rem; /* Reduced from 1.1rem */
  font-family: 'Luckiest Guy', cursive;
  border-radius: var(--border-radius);
  outline: none;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-family: 'Luckiest Guy', cursive;
}

.search-input:focus {
  border-color: var(--accent-gold-hover);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  transform: translateY(-1px);
}

.search-button {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  border: none;
  color: #000;
  padding: 0 1.2rem; /* Reduced from 1.5rem */
  border-left: var(--border-width) solid var(--accent-gold-hover);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem; /* Reduced from 1.1rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
}

.search-button:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
  transform: scale(1.05);
}

/* Scroll Container */
.scroll-container {
  position: relative;
  padding: 1.5rem; /* Reduced from 2rem */
  padding-left: 4rem; /* Reduced from 5rem */
  padding-right: 4rem; /* Reduced from 5rem */
}

/* Scroll Buttons */
.scroll-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  color: #000;
  border: var(--border-width) solid var(--accent-gold-hover);
  padding: 0.8rem; /* Reduced from 1rem */
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
  font-size: 1rem; /* Reduced from 1.2rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
}

.scroll-button:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 12px 35px rgba(255, 215, 0, 0.6);
}

.scroll-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: translateY(-50%) scale(1);
}

.scroll-left {
  left: 1.2rem; /* Reduced from 1.5rem */
}

.scroll-right {
  right: 1.2rem; /* Reduced from 1.5rem */
}

/* Maps Container */
.maps-container {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding-bottom: 0.8rem; /* Reduced from 1rem */
}

.maps-container::-webkit-scrollbar {
  display: none;
}

.maps-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Maps Grid */
.maps-grid {
  display: flex;
  gap: 1.2rem; /* Reduced from 1.5rem */
  min-width: fit-content;
}

/* map-card styles removed here to avoid conflicting definitions with global `index.css`.
   A single clear `.map-card` rule is defined in `src/client/styles/index.css`.
*/

/* Map Canvas Container - 20% smaller */
.map-canvas-container {
  position: relative;
  width: 100%;
  height: 9.6rem; /* Reduced from 12rem (20% smaller) */
  overflow: hidden;
  background: linear-gradient(135deg, #0b1020, #1a1a2e);
  border-bottom: var(--border-width) solid var(--accent-gold);
}

.map-canvas {
  width: 100%;
  height: 100%;
  transition: transform var(--transition-normal);
}

.map-card:hover .map-canvas {
  transform: scale(1.1);
}

/* Map Loading Overlay */
.map-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
  font-size: 0.8rem; /* Reduced from 0.9rem */
  font-family: 'Luckiest Guy', cursive;
  z-index: 2;
}

.map-loading::after {
  content: '';
  width: 16px; /* Reduced from 20px */
  height: 16px; /* Reduced from 20px */
  border: 2px solid var(--accent-gold);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.4rem; /* Reduced from 0.5rem */
}

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

/* Map Info */
.map-info {
  padding: 0.8rem; /* Reduced from 1rem */
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.map-name {
  color: var(--accent-gold);
  font-size: 0.9rem; /* Reduced from 1rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  margin-bottom: 0.4rem; /* Reduced from 0.5rem */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.map-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem; /* Reduced from 0.75rem */
  font-size: 0.75rem; /* Reduced from 0.85rem */
  font-family: 'Luckiest Guy', cursive;
  flex-wrap: wrap;
}

.map-creator,
.map-ranking {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-creator {
  color: var(--text-secondary);
}

.map-ranking {
  color: var(--accent-gold);
  font-weight: 400;
}

.separator {
  color: var(--accent-gold);
  font-weight: 400;
}

/* Detail Mode Styles - 20% smaller */
.detail-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem; /* Reduced from 2rem */
  padding: 1.6rem; /* Reduced from 2rem */
  height: calc(72vh - 8rem); /* Adjusted for smaller modal */
}

/* Back Button */
.back-button {
  margin: 1.6rem; /* Reduced from 2rem */
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem; /* Reduced from 0.75rem */
  background: none;
  border: none;
  color: var(--accent-gold);
  font-size: 1rem; /* Reduced from 1.1rem */
  font-family: 'Luckiest Guy', cursive;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0.4rem; /* Reduced from 0.5rem */
  border-radius: var(--border-radius);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.back-button:hover {
  color: var(--accent-gold-hover);
  background: rgba(255, 215, 0, 0.1);
  transform: translateX(-4px); /* Reduced from -5px */
}

/* Detail Canvas */
.detail-canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b1020, #1a1a2e);
  border: var(--border-width) solid var(--accent-gold);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.detail-canvas {
  width: 100%;
  height: 100%;
  max-height: 320px; /* Reduced from 400px */
}

/* Detail Info */
.detail-info {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(15, 20, 25, 0.9));
  border: var(--border-width) solid var(--accent-gold);
  border-radius: var(--border-radius);
  padding: 1.6rem; /* Reduced from 2rem */
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
}

.detail-title {
  color: var(--accent-gold);
  font-size: 1.5rem; /* Reduced from 1.8rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.2rem; /* Reduced from 1.5rem */
  padding-bottom: 0.8rem; /* Reduced from 1rem */
  border-bottom: var(--border-width) solid var(--accent-gold-hover);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Detail Stats */
.detail-stats {
  margin-bottom: 1.6rem; /* Reduced from 2rem */
  padding-bottom: 1.2rem; /* Reduced from 1.5rem */
  border-bottom: var(--border-width) solid var(--accent-gold);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.8rem; /* Reduced from 1rem */
  margin-bottom: 0.8rem; /* Reduced from 1rem */
  padding: 0.4rem; /* Reduced from 0.5rem */
  background: rgba(255, 215, 0, 0.05);
  border-radius: var(--border-radius);
}

.stat-item:last-child {
  margin-bottom: 0;
}

.stat-item i {
  color: var(--accent-gold);
  font-size: 1.2rem; /* Reduced from 1.4rem */
  filter: drop-shadow(0 0 5px var(--accent-gold));
}

.stat-label {
  color: var(--text-muted);
  min-width: 4rem; /* Reduced from 5rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  font-size: 0.9rem;
}

.stat-item span:not(.stat-label) {
  color: var(--text-primary);
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
}

/* Detail Description */
.detail-description {
  margin-bottom: 1.6rem; /* Reduced from 2rem */
  flex-grow: 1;
}

.detail-description h3 {
  color: var(--text-secondary);
  font-size: 0.9rem; /* Reduced from 1rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem; /* Reduced from 1rem */
}

.detail-description p {
  color: var(--text-secondary);
  line-height: 1.6; /* Reduced from 1.8 */
  font-size: 0.9rem; /* Reduced from 1rem */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Use regular font for description */
}

/* Play Button */
.play-button {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  color: #000;
  border: var(--border-width) solid var(--accent-gold-hover);
  border-radius: var(--border-radius);
  padding: 0.8rem 1.2rem; /* Reduced from 1rem 1.5rem */
  font-size: 1rem; /* Reduced from 1.1rem */
  font-family: 'Luckiest Guy', cursive;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem; /* Reduced from 0.75rem */
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4); /* Reduced shadow */
}

.play-button:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(255, 215, 0, 0.6); /* Reduced shadow */
}

/* Close Button */
.close-button {
  position: absolute;
  top: 1.2rem; /* Reduced from 1.5rem */
  right: 1.2rem; /* Reduced from 1.5rem */
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-hover));
  color: white;
  border: none;
  width: 2.4rem; /* Reduced from 3rem */
  height: 2.4rem; /* Reduced from 3rem */
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  font-size: 1rem; /* Reduced from 1.2rem */
  font-family: 'Luckiest Guy', cursive;
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); /* Reduced shadow */
}

.close-button:hover {
  background: linear-gradient(135deg, var(--accent-red-hover), var(--accent-red));
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 10px 28px rgba(255, 107, 107, 0.6); /* Reduced shadow */
}

/* No Results State */
.no-results {
  text-align: center;
  padding: 3.2rem 1.6rem; /* Reduced from 4rem 2rem */
  color: var(--text-muted);
}

.no-results i {
  font-size: 3.2rem; /* Reduced from 4rem */
  margin-bottom: 1.2rem; /* Reduced from 1.5rem */
  color: var(--accent-gold);
  filter: drop-shadow(0 0 20px var(--accent-gold));
}

.no-results h3 {
  margin-bottom: 0.8rem; /* Reduced from 1rem */
  color: var(--text-primary);
  font-size: 1.2rem; /* Reduced from 1.5rem */
  font-family: 'Luckiest Guy', cursive;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.no-results p {
  font-size: 1rem; /* Reduced from 1.1rem */
  font-family: 'Luckiest Guy', cursive;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.8rem; /* Reduced from 1rem */
  }
  
  .detail-content {
    grid-template-columns: 1fr;
    gap: 1.2rem; /* Reduced from 1.5rem */
    height: auto;
  }
  
  .scroll-container {
    padding-left: 3.2rem; /* Reduced from 4rem */
    padding-right: 3.2rem; /* Reduced from 4rem */
  }
  
  .scroll-button {
    padding: 0.6rem; /* Reduced from 0.75rem */
  }
  
  .map-card {
    width: 14.4rem; /* Reduced from 18rem */
  }
  
  .modal-header {
    padding: 1.2rem; /* Reduced from 1.5rem */
  }
  
  .modal-title {
    font-size: 1.2rem; /* Reduced from 1.5rem */
  }
}

@media (max-width: 480px) {
  .map-card {
    width: 12.8rem; /* Reduced from 16rem */
  }
  
  .scroll-container {
    padding-left: 2.4rem; /* Reduced from 3rem */
    padding-right: 2.4rem; /* Reduced from 3rem */
  }
  
  .modal-header {
    padding: 0.8rem; /* Reduced from 1rem */
  }
  
  .modal-title {
    font-size: 1rem; /* Reduced from 1.2rem */
  }
}
