/* Minecraft Font */
@font-face {
  font-family: "Minecraftia";
  src: url("/static/fonts/Minecraftia.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #3b6b3b
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%233a5c3a' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
  font-family: "Minecraftia", sans-serif;
  color: #fff;
  line-height: 1.6;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background-color: #5b5b5b;
  border-bottom: 4px solid #8b8b8b;
  padding: 1rem;
  position: relative;
  min-height: 215px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
  position: relative;
  gap: 2rem;
}

.header-img {
  height: 120px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 #000);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.left-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-right: auto;
}

.left-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.server-info {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  padding: 0.5rem 1rem;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  color: #aaffaa;
  font-size: 0.9rem;
  max-width: 400px;
}

.copy-wrapper {
  cursor: pointer;
  color: #55ff55;
  text-decoration: underline;
  position: relative;
  display: inline-block;
}

.copy-bubble {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #aaffaa;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.copy-bubble.show {
  opacity: 1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

#music-btn {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  color: white;
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Minecraftia", sans-serif;
}

/* Info Button */
#info-btn {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Minecraftia", sans-serif;
  flex-shrink: 0;
  padding: 0;
}

#info-btn:hover {
  background-color: #5a5a5a;
}

.info-icon {
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 #000);
}

#info-btn:hover .info-icon {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

#wiki-btn {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Minecraftia", sans-serif;
  padding: 0;
  text-decoration: none;
}

#wiki-btn:hover {
  background-color: #5a5a5a;
}

.wiki-icon {
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 #000);
  transition: transform 0.2s ease;
}

#wiki-btn:hover .wiki-icon {
  transform: scale(1.1);
}

#stats-button-wrapper,
#map-button-wrapper {
  display: flex;
  align-items: center;
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  padding: 0.5rem;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  text-decoration: none;
  color: #55ff55;
  font-family: "Minecraftia", sans-serif;
}

.minecraft-sign-text {
  font-weight: bold;
  text-align: center;
  margin-right: 0.5rem;
  font-family: "Minecraftia", monospace;
  background: url('/static/images/Minecraft_Sign.webp') no-repeat center center;
  background-position: center 6px;
  background-size: contain;
  padding: 6px 12px;
  color: #55ff55;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  text-shadow: 2px 2px 0 #0008;
  min-width: 100px;
}

.minecraft-arrow {
  height: 40px;
  width: 40px;
  image-rendering: pixelated;
  margin-right: 0.5rem;
  transform: rotate(45deg);
  transform-origin: center center;
}

#map-button-img img {
  height: 40px;
  width: 40px;
  cursor: pointer;
  image-rendering: pixelated;
  transition: transform 0.25s ease; 
}

#map-button-img:hover img,
#map-button-img:focus img {
  transform: scale(1.3);
}

/* Stats Button */
#stats-button-img img {
  height: 40px;
  width: 40px;
  cursor: pointer;
  image-rendering: pixelated;
  transition: transform 0.25s ease; 
}

#stats-button-img:hover img,
#stats-button-img:focus img {
  transform: scale(1.3);
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Main Content */
main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

section {
  margin-bottom: 2rem;
}

h2 {
  color: #ffff55;
  text-shadow: 2px 2px #000;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #8b8b8b;
  padding-bottom: 0.5rem;
  font-family: "Minecraftia", sans-serif;
}

/* Downloads Section */
.category-group {
  margin-bottom: 2rem;
}

.category-group h3 {
  color: #ffff55;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-family: "Minecraftia", sans-serif;
}

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start; /* Changed to start to prevent row expansion */
}

.file-card {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  padding: 1rem;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  display: flex;
  flex-direction: column;
  font-family: "Minecraftia", sans-serif;
  height: auto; /* Ensure height is auto for expansion */
  min-height: fit-content; /* Minimum height to fit content */
}

.file-type {
  color: #55ff55;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  font-family: "Minecraftia", sans-serif;
}

.file-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.toggle-btn {
  background: none;
  border: none;
  color: #aaffaa;
  font-size: 1rem;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: transform 0.3s ease;
  font-family: "Minecraftia", sans-serif;
}

.toggle-btn.rotated {
  transform: rotate(90deg);
}

.file-header h4 {
  color: #fff;
  margin: 0;
  font-family: "Minecraftia", sans-serif;
}

.file-desc {
  max-height: 0;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  overflow: hidden;
  transition: all 0.2s ease;
  margin-bottom: 0;
}

.file-desc.open {
  max-height: 1000px;
  opacity: 1;
  transform: scaleY(1);
  margin-bottom: 1rem;
}

.file-desc p {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 0.5rem;
  border-left: 4px solid #88ff88;
  margin: 0;
  font-family: "Minecraftia", sans-serif;
}

.file-card a {
  display: flex;
  align-items: center;
  color: #55ff55;
  text-decoration: none;
  margin-top: auto;
  padding: 0.5rem;
  background-color: #3a5c3a;
  border: 2px solid #5b7d5b;
  text-align: center;
  justify-content: center;
  box-shadow: inset 1px 1px 0 #5b7d5b, inset -1px -1px 0 #2b4a2b;
  font-family: "Minecraftia", sans-serif;
}

.file-card a img {
  margin-right: 0.5rem;
  transform: rotate(135deg);
}

/* Suggestion Box */
.suggestion-box {
  background-color: #4a4a4a;
  border: 3px solid #8b8b8b;
  padding: 1.5rem;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  max-width: 600px;
  font-family: "Minecraftia", sans-serif;
}

#suggestion-form {
  display: flex;
  flex-direction: column;
}

#suggestion-form input,
#suggestion-form textarea {
  background-color: #3a3a3a;
  border: 2px solid #8b8b8b;
  color: white;
  padding: 0.5rem;
  margin-bottom: 1rem;
  font-family: "Minecraftia", sans-serif;
  box-shadow: inset 1px 1px 0 #5b5b5b, inset -1px -1px 0 #2b2b2b;
}

#suggestion-form input::placeholder,
#suggestion-form textarea::placeholder {
  color: #aaa;
  font-family: "Minecraftia", sans-serif;
}

.submit-wrapper {
  position: relative;
  display: inline-block;
  align-self: flex-start;
}

#suggestion-form button {
  background-color: #3a5c3a;
  border: 2px solid #5b7d5b;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: "Minecraftia", sans-serif;
  box-shadow: inset 1px 1px 0 #5b7d5b, inset -1px -1px 0 #2b4a2b;
}

.submit-bubble {
  position: absolute;
  top: 50%;
  left: 105%;
  transform: translateY(-50%);
  background: #000;
  color: #aaffaa;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  font-family: "Minecraftia", sans-serif;
}

.submit-bubble.show {
  opacity: 1;
}

#server-status::before {
    content: "● ";
    font-size: 1.2em;
}

.server-online::before {
    color: #55ff55;
    text-shadow: 0 0 5px #55ff55;
}

.server-offline::before {
    color: #ff5555;
    text-shadow: 0 0 5px #ff5555;
}

.server-checking::before {
    color: #ffff55;
    text-shadow: 0 0 5px #ffff55;
    animation: pulse 1.5s infinite;
}

.player-count {
    color: #55ffff;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Popup Modal Styles */
.popup-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.popup-modal.active {
    display: flex;
}

.popup-content {
  background-color: #4a4a4a;
  border: 4px solid #8b8b8b;
  padding: 2rem;
  max-width: 1250px;
  width: 90%;
  max-height: 100vh;
  overflow-y: auto;
  box-shadow: inset 2px 2px 0 #6b6b6b, inset -2px -2px 0 #2b2b2b;
  font-family: "Minecraftia", sans-serif;
}

.popup-header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #8b8b8b;
  padding-bottom: 1rem;
}

.popup-header h2 {
  color: #ffff55;
  text-shadow: 2px 2px #000;
  margin: 0;
  font-size: 1.5rem;
  border: none;
  padding: 0;
}

.popup-body {
  color: #fff;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.popup-body h3 {
  color: #ffff55;
  margin: 1rem 0 0.5rem 0;
  font-size: 1.2rem;
}

.popup-body ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.popup-body li {
  margin-bottom: 0.25rem;
}

.popup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid #8b8b8b;
  padding-top: 1rem;
}

.dont-show-again {
  display: flex;
  align-items: center;
  color: #aaffaa;
  cursor: pointer;
  font-size: 0.9rem;
}

.dont-show-again input {
  margin-right: 0.5rem;
  cursor: pointer;
}

.popup-close-btn {
  background-color: #3a5c3a;
  border: 2px solid #5b7d5b;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: "Minecraftia", sans-serif;
  box-shadow: inset 1px 1px 0 #5b7d5b, inset -1px -1px 0 #2b4a2b;
}

.popup-close-btn:hover {
  background-color: #4a6c4a;
}

/* Footer */
footer {
  background-color: #5b5b5b;
  border-top: 4px solid #8b8b8b;
  padding: 1.5rem;
  text-align: center;
  color: #aaa;
  box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
  font-family: "Minecraftia", sans-serif;
}

footer img {
  height: 77px;
  image-rendering: pixelated;
}

footer p {
  margin: 0.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }

  header {
    min-height: auto;
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
  }

  .left-section {
    flex-direction: column;
    align-items: center;
    margin-right: 0;
    width: 100%;
  }

  .left-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;
  }
  
  .header-img {
    position: static;
    transform: none;
    height: 85px;
    margin: 0 auto 1rem;
    order: -1;
  }
  
  .server-info {
    max-width: 100%;
    font-size: 0.85rem;
    margin: 0 auto;
  }
  
  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
  }

  #music-btn,
  #info-btn,
  #wiki-btn {
    width: 45px;
    height: 45px;
  }

  main {
    padding: 1rem;
  }

  .file-lists {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .file-card {
    padding: 0.75rem;
  }

  h2 {
    font-size: 1.3 rem;
  }

  .category-group h3 {
    font-size: 1.1rem;
  }

  .suggestion-box {
    padding: 1rem;
  }

  footer {
    padding: 1rem;
  }

  footer img {
    height: 60px;
  }
}

/* Popup Mobile Fix - Remove black margins */
/* Popup Mobile Fix - Clean Version */
@media (max-width: 768px) {
    /* Target only when modal is active on mobile */
    .popup-modal.active {
        padding: 0;
        margin: 0;
        align-items: stretch;
        justify-content: stretch;
    }
    
    /* Higher specificity for popup content on active mobile modal */
    .popup-modal.active .popup-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        padding: 1rem;
        border: none;
        border-radius: 0;
        flex: 1;
        box-sizing: border-box;
        overflow-y: auto;
    }
    
    /* Ensure modal covers entire screen with more specific selector */
    body .popup-modal.active {
        width: 100vw;
        height: 100vh;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    /* Target footer specifically within mobile popup */
    .popup-modal.active .popup-content .popup-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        margin-top: auto;
    }
    
    /* Target close button specifically */
    .popup-modal.active .popup-content .popup-footer .popup-close-btn {
        width: 100%;
    }
}

/* Fix horizontal scroll on mobile */
@media (max-width: 768px) {
    /* Constrain the main content area */
    main {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Ensure all direct children don't overflow */
    main > * {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Fix file cards grid */
    .file-list {
        grid-template-columns: 1fr;
        width: 100%;
    }
    
    /* Ensure header content stays within bounds */
    .header-content {
        width: 100%;
        flex-wrap: wrap;
    }
}

.no-files,
.error-message {
  text-align: center;
  color: #ff5555;
  padding: 2rem;
  font-family: "Minecraftia", sans-serif;
}