/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #1a1a1a;
  color: #e0e0e0;
  font-family: 'Fredoka One', 'Arial Black', 'Trebuchet MS', sans-serif;
  line-height: 1.7;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  font-size: 18px;
  letter-spacing: 0.5px;
  font-display: swap;
  visibility: hidden;
}

body.fonts-loaded,
body:not(.fonts-loading) {
  visibility: visible;
}

/* Wiki Header */
.wiki-header {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 0;
  border-bottom: 3px solid #3498db;
}

.wiki-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.wiki-logo h1 {
  font-size: 2.2rem;
  color: #ecf0f1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
  letter-spacing: 1px;
}

.wiki-navigation {
  display: flex;
  gap: 1.5rem;
}

.wiki-navigation a {
  color: #ecf0f1;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.wiki-navigation a:hover {
  background-color: #34495e;
}

/* Dropdown Navigation */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  padding: 0.5rem 1rem !important;
  background: #ff6b6b !important;
  color: white !important;
  text-decoration: none !important;
  border-radius: 8px !important;
  font-weight: normal !important;
  transition: background-color 0.3s ease !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-block !important;
}

.dropdown-toggle:hover {
  background-color: #e55555 !important;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #2c3e50;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  border-radius: 6px;
  z-index: 1000;
  margin-top: 5px;
  border: 1px solid #34495e;
}

.dropdown-menu a {
  display: block !important;
  padding: 12px 16px !important;
  color: white !important;
  text-decoration: none !important;
  font-weight: normal !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  transition: background-color 0.3s ease !important;
}

.dropdown-menu a:first-child {
  border-radius: 6px 6px 0 0 !important;
}

.dropdown-menu a:last-child {
  border-radius: 0 0 6px 6px !important;
}

.dropdown-menu a:hover {
  background-color: #34495e !important;
  transform: none !important;
  box-shadow: none !important;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* Main Container */
.wiki-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  padding: 2rem;
}

/* Sidebar */
.wiki-sidebar {
  background-color: #2d2d2d;
  border: 1px solid #404040;
  border-radius: 8px;
  padding: 1.5rem;
  height: fit-content;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.wiki-sidebar h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.5rem;
}

.search-section, .filter-section, .wiki-stats {
  margin-bottom: 2rem;
}

#search,
#wlRate {
  width: 100%;
  padding: 1.2rem;
  border: 2px solid #404040;
  border-radius: 8px;
  font-size: 18px;
  background-color: #404040;
  color: #e0e0e0;
  font-family: 'Fredoka One', 'Arial Black', 'Trebuchet MS', sans-serif;
}

input[id^="fish"] {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #404040;
  border-radius: 8px;
  font-size: 16px;
  background-color: #404040;
  color: #e0e0e0;
  font-family: 'Fredoka One', cursive;
  box-sizing: border-box;
}

.category-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.4rem;
}

.category-filters label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  background-color: #3a3a3a;
  border: 1px solid #555;
  border-radius: 20px;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 32px;
  box-sizing: border-box;
}

.category-filters label:hover {
  background-color: #4a4a4a;
  border-color: #3498db;
  transform: translateY(-1px);
}

.category-filters input[type="checkbox"] {
  margin: 0;
  transform: scale(1.2);
  cursor: pointer;
  accent-color: #3498db;
}

.category-filters label:has(input:checked) {
  background-color: #3498db;
  border-color: #2980b9;
  color: white;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

@media (max-width: 768px) {
  .category-filters {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.3rem;
  }
  
  .category-filters label {
    padding: 0.3rem 0.4rem;
    font-size: 0.75rem;
    min-height: 28px;
  }
  
  .category-filters input[type="checkbox"] {
    transform: scale(1);
  }
}

.wiki-stats p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Main Content */
.wiki-content {
  background-color: #2d2d2d;
  border: 1px solid #404040;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.wiki-article {
  padding: 2rem;
}

.article-header {
  border-bottom: 3px solid #3498db;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.article-header h1 {
  color: #2c3e50;
  font-size: 2.7rem;
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

.article-subtitle {
  color: #7f8c8d;
  font-size: 1.1rem;
}

.table-of-contents {
  background-color: #404040;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.table-of-contents h2 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 1rem;
}

.table-of-contents a {
  color: #3498db;
  text-decoration: none;
}

.table-of-contents a:hover {
  text-decoration: underline;
}

/* Database Container Scrollbars */
#itemsContainer,
#blocksContainer,
#guidesContainer {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom scrollbar styling */
#itemsContainer::-webkit-scrollbar,
#blocksContainer::-webkit-scrollbar,
#guidesContainer::-webkit-scrollbar {
  width: 8px;
}

#itemsContainer::-webkit-scrollbar-track,
#blocksContainer::-webkit-scrollbar-track,
#guidesContainer::-webkit-scrollbar-track {
  background: #2d2d2d;
  border-radius: 4px;
}

#itemsContainer::-webkit-scrollbar-thumb,
#blocksContainer::-webkit-scrollbar-thumb,
#guidesContainer::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#itemsContainer::-webkit-scrollbar-thumb:hover,
#blocksContainer::-webkit-scrollbar-thumb:hover,
#guidesContainer::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Support Us Button */
.support-us-button {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(45deg, #e74c3c, #c0392b);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
}

.support-us-button:hover {
  background: linear-gradient(45deg, #c0392b, #a93226);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* Multi-tag support */
.item-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.category-tag {
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: normal;
}

/* Item Display */
.item {
  background-color: #404040;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  transition: all 0.3s ease;
}

.item:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  border-color: #3498db;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 1rem;
  background-color: #404040;
  border-radius: 8px 8px 0 0;
  transition: background-color 0.2s ease;
  position: relative;
}

.item-header:hover {
  background-color: #4a4a4a;
}

.item-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: #e0e0e0;
  flex: 1;
}

.item-tags {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.arrow {
  font-size: 1.5rem;
  color: #3498db;
  font-weight: bold;
  transition: transform 0.2s ease;
  margin-left: 0.5rem;
}

/* Item Categories */
.category-tag.Quest,
.category-tag[data-category="Quest"] {
  background-color: #f1c40f;
  color: #2c3e50;
}

.category-tag.Misc,
.category-tag[data-category="Misc"] {
  background-color: #7f8c8d;
}

.category-tag.Wings,
.category-tag[data-category="Wings"] {
  background-color: #e74c3c;
}

.category-tag.Weapon,
.category-tag[data-category="Weapon"] {
  background-color: #8e44ad;
}

.category-tag.Accessory,
.category-tag[data-category="Accessory"] {
  background-color: #e91e63;
}

.category-tag.Shirts,
.category-tag[data-category="Shirts"] {
  background-color: #16a085;
}

.category-tag.Pants,
.category-tag[data-category="Pants"] {
  background-color: #2980b9;
}

.category-tag.Shoes,
.category-tag[data-category="Shoes"] {
  background-color: #9b59b6;
}

/* Shirts, pants, shoes, hats, and hair same size as wings */
.item[data-category="Shirts"] .item-image-container img,
.item[data-category="Pants"] .item-image-container img,
.item[data-category="Shoes"] .item-image-container img,
.item[data-category="Hats"] .item-image-container img,
.item[data-category="Hair"] .item-image-container img {
  width: 95px;
  height: 95px;
}

/* Fix World Lock and Gold Lock sizes */
.item-image-container img[alt="World Lock"],
.item-image-container img[alt="Gold Lock"] {
  width: 95px !important;
  height: 95px !important;
}

.category-tag.Hair,
.category-tag[data-category="Hair"] {
  background-color: #27ae60;
}

.category-tag.Hats,
.category-tag[data-category="Hats"] {
  background-color: #d35400;
}

.category-tag.Face.Gear,
.category-tag[data-category="Face Gear"] {
  background-color: #1abc9c !important;
}

.category-tag.Essentials,
.category-tag[data-category="Essentials"] {
  background-color: #8b4513;
}

.category-tag.Props,
.category-tag[data-category="Props"] {
  background-color: #f39c12;
}

.category-tag.Back.Items,
.category-tag[data-category="Back Items"] {
  background-color: #e67e22;
}

.category-tag.Back.Items,
.category-tag[data-category="Back Items"] {
  background-color: #e67e22 !important;
}

.category-tag.Other,
.category-tag[data-category="Other"] {
  background-color: #34495e;
}

/* Block Categories */
.category-tag.Natural,
.category-tag[data-category="Natural"] {
  background-color: #4a5c3a;
  color: white;
}

.category-tag.Crafted,
.category-tag[data-category="Crafted"] {
  background-color: #ff6b35;
  color: white;
}

.category-tag.Decorative,
.category-tag[data-category="Decorative"] {
  background-color: #663399;
  color: white;
}

.category-tag.Functional,
.category-tag[data-category="Functional"] {
  background-color: #8b0000;
  color: white;
}

.category-tag.Shop,
.category-tag[data-category="Shop"] {
  background-color: #f4d03f;
  color: #2c3e50;
}

.category-tag.Props,
.category-tag[data-category="Props"] {
  background-color: #f39c12;
  color: white;
}

/* Staff Role Categories */
.category-tag.Sycotik.Studios {
  background-color: #2c3e50;
}

.category-tag.Game.Staff {
  background-color: #1e3a8a;
}

.category-tag.Discord.Staff {
  background-color: #059669;
}

.category-tag.Artist {
  background-color: #f59e0b;
}

.category-tag.Owner {
  background-color: #dc2626;
}

.category-tag.Admin {
  background-color: #7c3aed;
}

.category-tag.Moderator {
  background-color: #0ea5e9;
}

.category-tag.Helper {
  background-color: #10b981;
}

/* Guide Categories */
.category-tag.Beginner {
  background-color: #22c55e;
}

.category-tag.Building {
  background-color: #ea580c;
}

.category-tag.Crafting {
  background-color: #f59e0b;
}

.category-tag.Economy {
  background-color: #06b6d4;
}

.category-tag.Advanced {
  background-color: #991b1b;
}

/* Legacy categories */
.category-tag.Block {
  background-color: #8b4513;
}

.category-tag.Item {
  background-color: #27ae60;
}

.category-tag.Background {
  background-color: #9b59b6;
}

.dropdown-content {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #555;
}

/* Dropdown functionality */
.item.active .dropdown-content {
  display: block;
}



/* Changelog Section */
.changelog-section {
  background-color: #333;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.changelog-section h3 {
  color: #e74c3c;
  margin-bottom: 0.8rem;
  font-size: 1rem;
  border-bottom: 1px solid #555;
  padding-bottom: 0.5rem;
}

.changelog-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  background-color: #404040;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.changelog-toggle:hover {
  background-color: #4a4a4a;
}

.changelog-toggle span:first-child {
  color: #e0e0e0;
  font-size: 0.85rem;
}

.changelog-arrow {
  color: #e74c3c;
  font-weight: bold;
  font-size: 1.2rem;
}

.changelog-content {
  display: none;
  margin-top: 0.8rem;
}

.changelog-entry {
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #444;
}

.changelog-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.changelog-date {
  color: #f39c12;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 1.2rem;
}

.changelog-entry li {
  color: #e0e0e0;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  line-height: 1.4;
}

/* Image container styles */
.item-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  padding: 0.1rem;
  background-color: #555;
  border: 1px solid #666;
  border-radius: 6px;
  width: 120px;
  height: 120px;
}

.item-image-container img {
  width: 380px;
  height: 380px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 4px;
}

/* Smaller images for essentials and backgrounds */
.item[data-category="Essentials"] .item-image-container img,
.item[data-category="Background"] .item-image-container img,
.item[data-category="Natural"] .item-image-container img,
.item[data-category="Crafted"] .item-image-container img,
.item[data-category="Decorative"] .item-image-container img,
.item[data-category="Functional"] .item-image-container img,
.item[data-category="Misc"] .item-image-container img,
.item[data-category="Props"] .item-image-container img {
  width: 95px;
  height: 95px;
}

/* Wings, back gear, weapon, and quest items size */
.item[data-category="Wings"] .item-image-container img,
.item[data-category="Back Items"] .item-image-container img,
.item[data-category="Weapon"] .item-image-container img,
.item[data-category*="Quest"] .item-image-container img,
.item[data-category*="Accessory"] .item-image-container img {
  width: 95px;
  height: 95px;
}

/* Material items size */
.item[data-category="Material"] .item-image-container img {
  width: 90px;
  height: 90px;
}

/* Fish calculator specific image styles */
.fish-item .item-image-container img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 4px;
}

/* Small icon images in calculator inputs */
.fish-item .item-image-container img[alt="World Lock"],
input + div img[alt="World Lock"] {
  width: 24px !important;
  height: 24px !important;
}

.no-image {
  color: #7f8c8d;
  font-size: 0.8rem;
  text-align: center;
  font-style: italic;
}

/* Navigation arrows */
.wiki-navigation-arrows {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding: 1rem;
  background-color: #404040;
  border-radius: 8px;
  border: 1px solid #555;
  gap: 1rem;
}

.nav-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-arrow:hover {
  background: linear-gradient(45deg, #2980b9, #21618c);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.nav-arrow.disabled {
  background: #7f8c8d;
  color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
}

.nav-arrow.disabled:hover {
  background: #7f8c8d;
  transform: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.arrow-icon {
  font-size: 1.2rem;
}

/* Footer */
.wiki-footer {
  background-color: #2c3e50;
  color: #ecf0f1;
  text-align: center;
  padding: 2rem;
  margin-top: 2rem;
}

.wiki-footer a {
  color: #3498db;
  text-decoration: none;
}

.wiki-footer a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Fix horizontal scrolling */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .wiki-container {
    grid-template-columns: 1fr;
    padding: 0.5rem;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .wiki-nav {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    padding: 0 0.5rem;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .wiki-navigation {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
  }

  .wiki-navigation a {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    min-width: 70px;
    text-align: center;
    height: auto;
    white-space: nowrap;
  }

  .socials-button {
    padding: 0.6rem 0.8rem !important;
    font-size: 0.85rem !important;
    min-width: 70px !important;
    height: auto !important;
    line-height: normal !important;
  }

  .dropdown {
    min-width: 80px;
  }

  .wiki-logo h1 {
    font-size: 1.6rem;
    word-break: break-word;
  }

  .wiki-sidebar {
    padding: 1rem;
    margin-bottom: 1rem;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .wiki-content {
    max-width: 100vw;
    box-sizing: border-box;
  }

  .wiki-article {
    padding: 1rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Mobile optimizations */
  body {
    font-size: 15px;
  }

  .article-header h1 {
    font-size: 1.8rem;
    word-break: break-word;
  }

  .item-header {
    padding: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .item-title {
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }

  .item-tags {
    flex-shrink: 0;
  }

  .dropdown-content {
    padding: 0.75rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .dropdown-content p {
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
  }

  /* Improve touch targets */
  .item-header {
    min-height: 50px;
  }

  .category-filters label {
    padding: 0.6rem 0.25rem;
    min-height: 40px;
    font-size: 0.85rem;
  }

  /* Better scrolling on mobile */
  #itemsContainer,
  #blocksContainer,
  #guidesContainer {
    max-height: 350px;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Better mobile navigation arrows */
  .wiki-navigation-arrows {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .nav-arrow {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    min-height: 45px;
    box-sizing: border-box;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-arrow span {
    white-space: nowrap;
  }

  /* Fix tables and wide content */
  .content-body {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
  }

  /* Fix image containers */
  .item-image-container {
    max-width: 100%;
    box-sizing: border-box;
  }
}
