/* --- 1. Reset & Global --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fdfdfd;
}

main { padding: 0; min-height: 80vh; }
a { text-decoration: none; color: inherit; }

/* --- 2. Header & Nav --- */
header {
    background: #fff;
    border-bottom: 2px solid #2a5d34;
    padding: 20px 5%;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

header h1 a { color: #2a5d34; font-weight: 800; font-size: 2rem; }

.header-actions { display: flex; align-items: center; gap: 20px; }

.search-form { display: flex; }
.search-form input {
    padding: 10px 15px;
    border: 2px solid #2a5d34;
    border-radius: 20px 0 0 20px;
    width: 250px;
    outline: none;
}
.search-form button {
    padding: 10px 15px;
    background: #2a5d34;
    color: #fff;
    border: 2px solid #2a5d34;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
}

.admin-auth { display: flex; gap: 10px; align-items: center; }
.admin-link {
    font-size: 0.85rem;
    font-weight: bold;
    color: #2a5d34;
    border: 1px solid #2a5d34;
    padding: 5px 12px;
    border-radius: 4px;
}
.logout-text { color: #d9534f; font-weight: bold; font-size: 0.85rem; }

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}
nav ul li a { color: #2a5d34; font-weight: bold; font-size: 0.95rem; }
nav ul li a:hover { text-decoration: underline; }

/* --- 3. Home Page Styles --- */
.fun-fact-hero {
    background: #f0f8ff;
    border-bottom: 1px solid #d0e4f5;
    padding: 30px 20px;
    text-align: center;
}
.fact-container h2 { color: #0056b3; margin-bottom: 10px; }
.fact-text { font-size: 1.2rem; font-style: italic; max-width: 800px; margin: 0 auto; }

.mission-statement {
    padding: 80px 20px;
    text-align: center;
    background: #fff;
}
.mission-content h1 {
    font-size: 3rem;
    color: #2a5d34;
    margin-bottom: 20px;
}
.mission-lead { font-size: 1.5rem; color: #555; margin-bottom: 20px; }
.mission-stats { font-size: 1.1rem; color: #777; }
.mission-stats strong { color: #2a5d34; border-bottom: 2px solid #ffc107; }

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #2a5d34, transparent);
    width: 60%;
    margin: 0 auto;
}

.featured-section { padding: 60px 5%; text-align: center; }
.category-header h2 { font-size: 2.2rem; color: #2a5d34; margin-bottom: 10px; }
.category-header p { margin-bottom: 40px; color: #666; }

/* --- 4. Grid & Cards --- */
.critter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}
.critter-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
}
.critter-card:hover { transform: translateY(-8px); box-shadow: 0 12px 20px rgba(0,0,0,0.1); }
.critter-card img { width: 100%; height: 220px; object-fit: cover; }
.card-info { padding: 20px; }
.card-info h3 { color: #2a5d34; margin-bottom: 10px; }
.category-badge {
    background: #2a5d34;
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* --- 5. Species Details --- */
.species-container { max-width: 1000px; margin: 40px auto; padding: 0 20px; }
.latin-name { font-style: italic; color: #888; font-size: 1.5rem; }
.species-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 30px 0; }
.photo-frame img { width: 100%; height: 450px; object-fit: cover; border-radius: 15px; }

.species-content { display: flex; gap: 40px; }
.details { flex: 2; }
.fun-fact-sidebar {
    flex: 1;
    background: #fff8e1;
    padding: 25px;
    border-radius: 12px;
    border-left: 6px solid #ffc107;
}

/* --- 6. Responsive --- */
@media (max-width: 850px) {
    .header-top { flex-direction: column; }
    .header-actions { flex-direction: column; width: 100%; }
    .search-form input { width: 100%; }
    .mission-content h1 { font-size: 2.2rem; }
    .species-gallery, .species-content { grid-template-columns: 1fr; flex-direction: column; }
    .photo-frame img { height: 300px; }
}

.site-footer {
    width: 100%;             /* Ensures it spans the full width */
    background-color: #f4f4f4;
    border-top: 2px solid #2a5d34;
    padding: 40px 20px;
    margin-top: 50px;
    text-align: center;      /* THE CRITICAL LINE FOR CENTERING */
}

.footer-content {
    max-width: 1200px;       /* Keeps content from stretching too far */
    margin: 0 auto;          /* Centers the container itself */
}

.footer-content p {
    margin: 10px 0;          /* Adds breathing room between lines */
    display: block;          /* Ensures each paragraph starts on a new line */
}

.footer-content a {
    color: #2a5d34;
    text-decoration: none;
    font-weight: bold;
}

.footer-content a:hover {
    text-decoration: underline;
}

#backToTop {
  display: none; /* Hidden by default */
  position: fixed; /* Fixed/sticky position */
  bottom: 20px; /* Place the button at the bottom of the page */
  right: 30px; /* Place the button 30px from the right */
  z-index: 99; /* Make sure it does not overlap */
  border: none; /* Remove borders */
  outline: none; /* Remove outline */
  background-color: #2e4d32; /* Match your forest theme green */
  color: white; /* Text color */
  cursor: pointer; /* Add a mouse pointer on hover */
  padding: 15px; /* Some padding */
  border-radius: 50px; /* Rounded corners */
  font-size: 16px; /* Increase font size */
  font-weight: bold;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.3);
  transition: background-color 0.3s, transform 0.2s;
}

#backToTop:hover {
  background-color: #1e3321; /* Add a dark-grey background on hover */
  transform: scale(1.1); /* Slight pop effect */
}

.nav-games {
    background: #fdfaf6;
    border-radius: 8px;
    padding: 5px 10px;
    margin-bottom: 10px;
    border: 1px solid #e7e5e4;
}