/* ---------- CONSISTENT PAGE STYLES ---------- */
/* This file provides consistent styling for all secondary pages */

/* Page Container - consistent with main menu */
.page-container {
  width: 100vw; 
  height: 100vh;
  background: linear-gradient(180deg, #5d94f1 0%, #4a7bc8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page-stage {
  position: absolute;
  width: 100vw;
  height: 100vh;
  transition: opacity .6s ease;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Background consistent with main menu */
.page-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: url('image/background.png') center / cover;
  opacity: 0.3;
  filter: blur(2px);
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  z-index: 1;
  transition: opacity 0.6s ease-in-out;
  pointer-events: none; /* Prevent interaction issues during transitions */
}

/* Page Content */
.page-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 40px;
  box-sizing: border-box;
  text-align: center;
}

/* Page Headers */
.page-title {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(20px, 4vw, 48px);
  letter-spacing: 2px;
  color: #fff;
  margin: 0 0 40px 0;
  text-shadow:
    0 4px 0 #2b4a80, 4px 0 0 #2b4a80, -4px 0 0 #2b4a80, 0 -4px 0 #2b4a80;
  image-rendering: pixelated;
  text-rendering: geometricPrecision;
  line-height: 1.2;
}

/* Content Text */
.page-description {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(10px, 2vw, 16px);
  color: #fff;
  margin: 0 0 40px 0;
  line-height: 1.6;
  text-shadow:
    0 2px 0 #2b4a80, 2px 0 0 #2b4a80, -2px 0 0 #2b4a80, 0 -2px 0 #2b4a80;
  image-rendering: pixelated;
  text-rendering: geometricPrecision;
  max-width: 600px;
}

/* Settings List */
.settings-list {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(8px, 1.5vw, 14px);
  color: #fff;
  margin: 0 0 40px 0;
  line-height: 2;
  text-shadow:
    0 2px 0 #2b4a80, 2px 0 0 #2b4a80, -2px 0 0 #2b4a80, 0 -2px 0 #2b4a80;
  image-rendering: pixelated;
  text-rendering: geometricPrecision;
}

.settings-list p {
  margin: 10px 0;
}

/* Navigation Buttons */
.page-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 400px;
  align-items: center;
}

.page-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid #2b4a80;
  border-radius: 0;
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(10px, 2vw, 16px);
  color: #2b4a80;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  
  /* Pixel-perfect rendering */
  image-rendering: pixelated;
  text-rendering: geometricPrecision;
  
  /* Remove default button styles */
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  min-width: 200px;
}

.page-button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #2b4a80;
}

.page-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.page-button:focus {
  background: rgba(255, 255, 255, 1);
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Special button styling */
.page-button.primary {
  background: rgba(106, 150, 40, 0.9);
  color: #fff;
  border-color: #4a6b1a;
}

.page-button.primary:hover,
.page-button.primary:focus {
  background: rgba(106, 150, 40, 1);
  box-shadow: 0 4px 0 #4a6b1a;
}

/* Back button positioning */
.back-button-container {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

/* Content sections for organized layouts */
.content-section {
  width: 100%;
  max-width: 800px;
  margin-bottom: 30px;
}

/* Progress indicators, stats, etc. */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin: 20px 0;
  width: 100%;
  max-width: 600px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 15px;
  text-align: center;
}

.stat-label {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(8px, 1.2vw, 10px);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 5px;
}

.stat-value {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(12px, 2vw, 16px);
  color: #fff;
  text-shadow: 0 2px 0 #2b4a80;
}

/* Animations */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-content {
  animation: page-fade-in 0.8s ease-out;
}

.page-button {
  animation: page-fade-in 0.6s ease-out;
}

.page-button:nth-child(1) { animation-delay: 0.1s; }
.page-button:nth-child(2) { animation-delay: 0.2s; }
.page-button:nth-child(3) { animation-delay: 0.3s; }

/* Responsive adjustments */
@media (max-height: 600px) {
  .page-content {
    padding: 20px;
  }
  
  .page-title {
    margin-bottom: 20px;
  }
  
  .page-description {
    margin-bottom: 20px;
  }
  
  .page-nav {
    gap: 10px;
  }
  
  .page-button {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .page-nav {
    max-width: 300px;
  }
  
  .page-button {
    min-width: 180px;
  }
}

/* Icon spacing for buttons with icons */
.button-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

/* Specialized content layouts */
.forest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin: 20px 0;
  max-width: 500px;
}

.forest-item {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.forest-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.treedex-entries {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 600px;
  width: 100%;
}

.treedex-entry {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 15px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 15px;
}

.entry-icon {
  font-size: clamp(16px, 3vw, 24px);
}

.entry-info {
  flex: 1;
}

.entry-name {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(8px, 1.5vw, 12px);
  color: #fff;
  margin-bottom: 5px;
}

.entry-description {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(6px, 1.2vw, 10px);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

/* ---------- LOADING POPUP STYLES ---------- */
.loading-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.loading-popup.show {
  opacity: 1;
}

.loading-content {
  text-align: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.loading-message {
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(20px, 4vw, 36px);
  letter-spacing: 2px;
  text-shadow:
    0 4px 0 #2b4a80, 4px 0 0 #2b4a80, -4px 0 0 #2b4a80, 0 -4px 0 #2b4a80;
  image-rendering: pixelated;
  text-rendering: geometricPrecision;
  animation: pulse-glow 2s ease-in-out infinite;
}

.loading-spinner {
  display: flex;
  gap: 8px;
  align-items: center;
}

.spinner-leaf {
  width: 12px;
  height: 12px;
  background: #6a9628;
  border-radius: 50% 0;
  transform: rotate(-45deg);
  animation: leaf-bounce 1.2s ease-in-out infinite;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.spinner-leaf:nth-child(1) {
  animation-delay: 0s;
}

.spinner-leaf:nth-child(2) {
  animation-delay: 0.4s;
}

.spinner-leaf:nth-child(3) {
  animation-delay: 0.8s;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    text-shadow:
      0 4px 0 #2b4a80, 4px 0 0 #2b4a80, -4px 0 0 #2b4a80, 0 -4px 0 #2b4a80;
  }
  50% {
    transform: scale(1.05);
    text-shadow:
      0 4px 0 #2b4a80, 4px 0 0 #2b4a80, -4px 0 0 #2b4a80, 0 -4px 0 #2b4a80,
      0 0 20px rgba(255, 255, 255, 0.5);
  }
}

@keyframes leaf-bounce {
  0%, 80%, 100% {
    transform: rotate(-45deg) translateY(0);
    opacity: 0.7;
  }
  40% {
    transform: rotate(-45deg) translateY(-15px);
    opacity: 1;
  }
}