/* ============================================
   BASE LAYOUT STYLES
   Styles for baseof.html layout components
   ============================================ */

/* Search Container Styles */
#search {
    position: relative;
    z-index: 10000;
}

/* Style the search results as a floating overlay */
#search .pagefind-ui__results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow-y: auto;
    z-index: 100000;
    margin-top: 8px;
}

/* Hide results when empty */
#search .pagefind-ui__results:empty {
    display: none;
}

/* Ensure the search input doesn't cause layout shifts */
#search .pagefind-ui__search-input {
    width: 100%;
}

/* Dark theme search results */
[data-theme="dark"] #search .pagefind-ui__results {
    background: #2d2d2d;
    border-color: #555;
}

/* ============================================
   THEME DROPDOWN STYLES
   ============================================ */

.theme-selector {
    position: relative;
    margin-left: 1rem;
    flex-shrink: 0;
    z-index: 10000;
    isolation: isolate;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color, #333);
    border-radius: 4px;
    transition: background 0.2s ease;
    position: relative;
    z-index: 10002;
}

.theme-toggle-btn svg {
    display: block;
}

.theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle-btn {
    color: #e0e0e0;
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 99999;
}

.theme-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
    color: #333;
    font-size: 0.95rem;
}

.theme-option:first-child {
    border-radius: 8px 8px 0 0;
}

.theme-option:last-child {
    border-radius: 0 0 8px 8px;
}

.theme-option:hover {
    background: #f5f5f5;
}

.theme-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.theme-name {
    flex: 1;
    font-weight: 500;
}

.theme-check {
    color: #0066cc;
    opacity: 0;
    font-weight: bold;
}

.theme-option.active .theme-check {
    opacity: 1;
}

/* Dark theme dropdown */
[data-theme="dark"] .theme-dropdown {
    background: #2d2d2d;
    border-color: #555;
}

[data-theme="dark"] .theme-option {
    color: #e0e0e0;
}

[data-theme="dark"] .theme-option:hover {
    background: #3d3d3d;
}

[data-theme="dark"] .theme-check {
    color: #4da6ff;
}

/* 90s theme dropdown */
[data-theme="90s"] .theme-dropdown {
    background: #ffff00;
    border: 3px solid #000;
    box-shadow: 5px 5px 0 #ff00ff;
}

[data-theme="90s"] .theme-option {
    color: #000;
    font-family: 'Comic Sans MS', cursive;
}

[data-theme="90s"] .theme-option:hover {
    background: #00ffff;
}

[data-theme="90s"] .theme-check {
    color: #ff00ff;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .theme-selector {
        margin-left: 0.5rem;
    }

    .theme-dropdown {
        right: -0.5rem;
    }
}

/* Theme overlay for closing dropdown */
.theme-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: none;
}

.theme-overlay.active {
    display: block;
}


/* Theme Toggle Styles */
.theme-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 1rem;
}

.theme-toggle button {
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.theme-toggle button.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

.theme-toggle button[data-theme="90s"] {
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ffff00);
    border: 2px solid #000;
    animation: rainbow-border 3s ease infinite;
}

.theme-toggle button[data-theme="90s"].active {
    animation: rainbow-border 1s ease infinite, pulse 1s ease infinite;
}

@keyframes rainbow-border {
    0% { border-color: #ff00ff; }
    33% { border-color: #00ffff; }
    66% { border-color: #ffff00; }
    100% { border-color: #ff00ff; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Dark theme in search results */
[data-theme="dark"] #search .pagefind-ui__results {
    background: #2d2d2d;
    border-color: #555;
}

/* Mobile responsive theme toggle */
@media (max-width: 768px) {
    .theme-toggle {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
        margin-left: 0;
    }

    .theme-toggle button {
        flex: 1;
        justify-content: center;
    }
}

.releases {
  margin-top: 0.5rem;  /* Reduce this */
}

.releases h2 {
  margin-top: 0.5rem;  /* Reduce this */
  padding-top: 0.5rem; /* Reduce this */
  border-top: 1px solid #fff; /* This might be your line */
}

/* Or if the line is on the header: */
.game-header {
  margin-bottom: 0.5rem; /* Reduce this */
  padding-bottom: 0.5rem; /* Reduce this */
  border-bottom: 1px solid #ccc;
}

/* Or if the line is on the header: */
.game-footer {
  margin-bottom: 0.5rem; /* Reduce this */
  padding-bottom: 0.5rem; /* Reduce this */
  border-top: 1px solid #ccc;
}

/* ============================================
   ITEM PAGE STYLES (Paperwork/Stickers)
   ============================================ */

.item-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 8px;
}

.item-header {
  margin-bottom: 2rem;
}

.item-header h1 {
  margin-bottom: 0.5rem;
  font-size: 2rem;
  color: #333;
}

.item-header .description {
  color: #666;
  font-size: 1.1rem;
  margin: 0;
}

.item-images {
  margin: 2rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.image-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.image-container img {
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-caption {
  margin-top: 0.5rem;
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
  max-width: 100%;
}

.item-content {
  margin: 2rem 0;
  line-height: 1.6;
}

.variants-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid #eee;
}

.variants-section h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #333;
}

.no-variants {
  color: #666;
  font-style: italic;
}

.variant-count {
  margin-bottom: 1.5rem;
  color: #444;
  font-size: 1rem;
}

.variants-list {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: auto;
}

.variants-list thead {
  background: #f5f5f5;
}

.variants-list th,
.variants-list td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
  vertical-align: middle;
}

.variants-list th {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variants-list td {
  color: #333;
}

.variants-list tbody tr {
  transition: background 0.2s ease;
}

.variants-list tbody tr:hover {
  background: #f9f9f9;
}

.variants-list td a {
  color: #0066cc;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
}

.variants-list td a:hover {
  text-decoration: underline;
}

.variants-list td small {
  font-size: 0.85rem;
  color: #666;
}

.variants-list td strong {
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .item-images {
    grid-template-columns: 1fr;
  }

  .item-page {
    padding: 1rem;
  }

  .variants-list {
    font-size: 0.9rem;
  }

  .variants-list th,
  .variants-list td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .variants-list th:nth-child(3),
  .variants-list td:nth-child(3) {
    display: none; /* Hide EAN on very small screens */
  }
}

/* ============================================
   VARIANT PAGE IMAGE GALLERIES
   ============================================ */

.disc-images,
.manual-images,
.additional-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin: 1rem 0 2rem 0;
}

.disc-images img,
.manual-images img,
.additional-images img {
  max-width: 100%;
  max-height: 525px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Make images clickable/hoverable */
.disc-images img:hover,
.manual-images img:hover,
.additional-images img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

@media (max-width: 768px) {
  .disc-images,
  .manual-images,
  .additional-images {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

/* ============================================
   PAPERWORK AND STICKERS ON VARIANT PAGES
   ============================================ */

.paperwork-grid,
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin: 1rem 0;
}

.paperwork-item,
.sticker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.paperwork-item img,
.sticker-item img {
  max-width: 100%;
  max-height: 450px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.paperwork-item a:hover img,
.sticker-item a:hover img {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.paperwork-item > a:last-child,
.sticker-item > a:last-child {
  font-size: 0.9rem;
  color: #0066cc;
  text-decoration: none;
}

.paperwork-item > a:last-child:hover,
.sticker-item > a:last-child:hover {
  text-decoration: underline;
}