/**
 * geothemes.css
 *
 * Styles for Ontario Adventure Mode UI components.
 * Follows Figma style guide with approved color palette.
 */

/* ========================================
   MODAL BASE STYLES
   ======================================== */

.geothemes-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .geothemes-modal {
    animation: none;
  }
}

.geothemes-modal-content {
  background: #e8e8e8;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .geothemes-modal-content {
    animation: none;
  }
}

.geothemes-modal h2 {
  margin: 0 0 16px 0;
  font-size: 20px;
  color: #333;
  text-align: center;
}

.geothemes-modal-close {
  display: block;
  margin: 16px auto 0;
  padding: 10px 24px;
  background: #666;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.geothemes-modal-close:hover {
  background: #555;
}

.geothemes-modal-close:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/* ========================================
   ADVENTURE SELECTOR
   ======================================== */

.adventure-theme-btn {
  display: block;
  width: 100%;
  padding: 16px;
  margin: 8px 0;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.adventure-theme-btn:hover {
  background: #229954;
}

.adventure-theme-btn:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/* ========================================
   SCOPE CHIP
   ======================================== */

.geothemes-scope-chip {
  display: inline-block;
  padding: 6px 12px;
  background: #9b59b6;
  color: white;
  border-radius: 16px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 12px;
  vertical-align: middle;
}

/* ========================================
   BONUS WORDS COUNTER (Ontario Adventure)
   ======================================== */

.bonus-words-counter {
  font-size: 0.85em;
  color: inherit;
  display: inline-block;
}

/* ========================================
   UNLOCK TOAST
   ======================================== */

.geothemes-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #27ae60;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .geothemes-toast {
    animation: none;
  }
}

.geothemes-toast-message {
  font-size: 14px;
  font-weight: 500;
}

.geothemes-toast-change {
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid white;
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}

.geothemes-toast-change:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ========================================
   CHOOSER MODAL
   ======================================== */

.geothemes-chooser-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.geothemes-chooser-option {
  display: block;
  width: 100%;
  padding: 12px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.geothemes-chooser-option:hover {
  background: #f8f8f8;
  border-color: #9b59b6;
}

.geothemes-chooser-option:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.chooser-entry-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 4px;
}

.chooser-pack-name {
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}

.chooser-rarity {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chooser-rarity::before {
  content: '★ ';
}

/* ========================================
   COLLECTIONS PANEL
   ======================================== */

.geothemes-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 400px;
  max-width: 90%;
  height: 100%;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .geothemes-panel {
    animation: none;
  }
}

.geothemes-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #9b59b6;
  color: white;
  border-bottom: 1px solid #8e44ad;
}

.geothemes-panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.geothemes-panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.geothemes-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.geothemes-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ========================================
   COLLECTION PACKS
   ======================================== */

.collection-pack {
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.collection-pack h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.pack-progress-ring {
  display: inline-block;
  padding: 8px 16px;
  background: #3498db;
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 12px;
}

.progress-count {
  display: inline;
}

/* ========================================
   COLLECTION ENTRIES
   ======================================== */

.collection-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collection-entry {
  padding: 10px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.entry-display {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.entry-actions {
  display: flex;
  gap: 8px;
}

.entry-link-btn,
.entry-map-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.entry-link-btn {
  background: #3498db;
  color: white;
}

.entry-link-btn:hover {
  background: #2980b9;
}

.entry-map-btn {
  background: #27ae60;
  color: white;
}

.entry-map-btn:hover {
  background: #229954;
}

.no-entries {
  font-size: 13px;
  color: #999;
  font-style: italic;
  margin: 8px 0;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

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

@keyframes slideDown {
  from {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ========================================
   ONTARIO PACK CARDS (Clickable)
   ======================================== */

.ontario-pack-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}

/* Semi-transparent overlay for text readability */
.ontario-pack-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2); /* 20% white overlay - lets images show through brightly */
  border-radius: 8px;
  z-index: 0;
}

/* Ensure content is above the overlay */
.ontario-pack-card > * {
  position: relative;
  z-index: 1;
}

.ontario-pack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ontario-pack-card:active {
  transform: translateY(0);
}

/* ========================================
   PACK DETAIL MODAL
   ======================================== */

.pack-detail-modal {
  max-width: 600px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

/* 80% opacity overlay for readability */
.pack-detail-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(232, 232, 232, 0.85); /* 85% opacity for better readability */
  border-radius: 12px;
  z-index: 0;
}

/* Ensure content is above the overlay */
.pack-detail-modal > * {
  position: relative;
  z-index: 1;
}

.pack-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  margin: 0;
}

.pack-detail-close:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #333;
}

.pack-detail-title {
  margin: 0 0 12px 0;
  font-size: 24px;
  color: rgb(100, 90, 230);
  text-align: center;
}

.pack-detail-progress {
  text-align: center;
  font-size: 16px;
  color: #666;
  margin-bottom: 20px;
  font-weight: 500;
}

.pack-detail-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.pack-detail-entry {
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.pack-detail-entry.entry-found {
  background: linear-gradient(135deg, rgb(100, 90, 230) 0%, rgb(85, 75, 215) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(100, 90, 230, 0.3);
}

.pack-detail-entry.entry-unfound {
  background: #f0f0f0;
  color: #999;
  border: 1px solid #e0e0e0;
}

.pack-detail-close-btn {
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  padding: 12px 24px;
  background: rgb(100, 90, 230);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.pack-detail-close-btn:hover {
  background: rgb(85, 75, 215);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 600px) {
  .geothemes-panel {
    width: 100%;
  }

  .geothemes-modal-content {
    width: 95%;
    padding: 16px;
  }

  .geothemes-toast {
    width: 90%;
    left: 5%;
    transform: none;
  }

  .pack-detail-entries {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  .pack-detail-entry {
    font-size: 13px;
    padding: 10px 12px;
  }
}

/* ========================================
   PACK DETAIL MAP TAB
   ======================================== */

.pack-detail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0;
}

.pack-detail-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
  margin-bottom: -2px; /* Overlap container border for clean visual */
}

.pack-detail-tab:hover {
  color: rgb(100, 90, 230);
}

.pack-detail-tab.active {
  color: rgb(100, 90, 230);
  border-bottom-color: rgb(100, 90, 230);
}

.pack-detail-content {
  display: none;
}

.pack-detail-content.active {
  display: block;
}

.pack-detail-map-container {
  width: 100%;
  height: 450px; /* Increased from 380px for better viewing */
  border-radius: 8px; /* 2/3 of modal radius (12px) for visual hierarchy */
  overflow: hidden;
  margin-bottom: 12px;
}

.pack-detail-map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #f5f5f5;
  border-radius: 8px;
  color: #666;
  font-size: 14px;
  gap: 12px;
}

.pack-detail-map-loading::after {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: rgb(100, 90, 230);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.pack-detail-map-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #666;
}

.legend-pin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-pin.grey {
  background: #9AA0A6;
}

.legend-pin.blue {
  background: #1A73E8;
}

.pack-detail-map-footnote {
  text-align: center;
  font-size: 12px;
  color: #999;
  font-style: italic;
  margin-bottom: 16px;
}

/* Responsive: Progressive enhancement for different screen sizes */
@media (max-width: 600px) {
  .pack-detail-map-container {
    height: 320px;
  }

  .pack-detail-tab {
    padding: 8px 16px;
  }

  .legend-pin {
    width: 16px;
    height: 16px;
    margin-right: 6px;
  }

  .pack-detail-map-legend {
    font-size: 14px;
  }

  .pack-detail-map-loading {
    font-size: 13px;
  }

  .pack-detail-map-loading::after {
    width: 32px;
    height: 32px;
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  .pack-detail-map-container {
    height: 400px;
  }

  .pack-detail-tab {
    font-size: 15px;
  }

  .pack-detail-map-legend {
    font-size: 14px;
  }
}
