:root {
  /* Updated color scheme with purple tones */
  --primary: #e7a0a0;        /* deeper red */
  --primary-dark: #9d4646;   /* rich, bold red */
  --primary-light: #ffcdd2;  /* light red */
  --accent: #c25e57;         /* purple accent */
  --accent-dark: #b13535;    /* darker purple */
  --accent-light: #e9d1c4;   /* light purple */
  --text-on-dark: #ffffff;
  --text-primary: #212121;
  --text-secondary: #757575;
  --background: #f5f5f5;
  --card-bg: #ffffff;
  --border: #e0e0e0;
  --success: #4caf50;
  --warning: #ff9800;
  
  /* Color-coded text colors - same in both modes */
  --color-ed: #9c27b0;    /* Purple for ED */
  --color-red: #f44336;   /* Red */
  --color-orange: #ff9800; /* Orange */
  --color-yellow: #ffc107; /* Yellow */
  --color-green: #4caf50;  /* Green */

  /* --- Maroon/Beige Theme Additions --- */
  --ae-maroon: #3d0000;
  --ae-beige: #f5f2e6;
  --ae-maroon-dark: #2a0000;
  --ae-maroon-light: #6a1a1a;
  --ae-accent: #bfa16a;
  --ae-footer-text: #fff;
}

/* Dark mode colors */
[data-theme="dark"] {
  color-scheme: dark;
  --primary: #f44336;
  --primary-dark: #d32f2f;
  --primary-light: #ef9a9a;
  --accent: #9575cd;         /* lighter purple for dark mode */
  --accent-dark: #7e57c2;    /* purple for dark mode */
  --accent-light: #b39ddb;   /* very light purple */
  --text-on-dark: #ffffff;
  --text-primary: #f5f5f5;
  --text-secondary: #b0b0b0;
  --background: #121212;
  --card-bg: #1e1e1e;
  --border: #333333;
  
  /* Color-coded text colors - same as light mode */
  --color-ed: #9c27b0;    /* Purple for ED */
  --color-red: #f44336;   /* Red */
  --color-orange: #ff9800; /* Orange */
  --color-yellow: #ffc107; /* Yellow */
  --color-green: #4caf50;  /* Green */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text-primary);
  background-color: var(--background);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  position: relative;
}

/* Header and Navigation */
.navbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-dark) 100%);
  color: var(--text-on-dark);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: background 0.3s ease;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
}

.nav-logo-icon {
  margin-right: 10px;
  font-size: 1.8rem;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  width: 100%;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

.nav-links a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-links a.active {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Dark Mode Toggle */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-switch label {
  color: var(--text-on-dark);
  font-size: 0.9rem;
}

.theme-toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(30px);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 2000px;
  margin: 0 auto;
  width: 100%;
}

.filters {
  margin-bottom: 2rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: left;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.filters select, .filters input {
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: 'Poppins', sans-serif;
  background-color: var(--card-bg);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.filters select:focus, .filters input:focus {
  outline: 2px solid var(--accent-light);
  border-color: var(--accent);
}

.color-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.color-filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.color-filter-header {
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-item {
  border-right: 1px solid var(--border);
  padding-right: 1rem;
}
.filter-item:nth-last-child(1) {
  border-right: none;
}

.color-indicator {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-block;
}

.color-ed {
  background-color: var(--color-ed);
}

.color-red {
  background-color: var(--color-red);
}

.color-orange {
  background-color: var(--color-orange);
}

.color-yellow {
  background-color: var(--color-yellow);
}

.color-green {
  background-color: var(--color-green);
}

.rarity-checkboxes {
  display: flex;
  gap: 10px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.rarity-checkbox {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
}

.token-filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#tokenFilter {
  width: 40%;
}

.token-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.token-preset {
  background-color: var(--accent-light);
  color: var(--text-primary);
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.3s;
}

.token-preset:hover {
  background-color: var(--accent);
  color: var(--text-on-dark);
}

.token-input {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}

.token-input input {
  width: 80px;
}

/* Results counter and navigation */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.reset-button {
  background-color: var(--accent);
  color: var(--text-on-dark);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  transition: background-color 0.3s ease;
}

.reset-button:hover {
  background-color: var(--accent-dark);
}

.results-count {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  color: var(--text-primary);
}

.results-navigation {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-button {
  background-color: var(--accent);
  color: var(--text-on-dark);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  transition: background-color 0.3s;
}

.nav-button:hover {
  background-color: var(--accent-dark);
}

.nav-button:disabled {
  background-color: var(--border);
  cursor: not-allowed;
  opacity: 0.7;
}

.page-indicator {
  padding: 0.5rem;
  color: var(--text-primary);
}

.inventory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.item {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 1.5rem;
  max-height: 350px;
  position: relative;
  transition: all 0.3s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border-left: 4px solid var(--accent);
  z-index: 12;
}

.item:hover {
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transform: translateX(-3px);
  z-index: 15;
}

.item h4 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.item p {
  margin: 5px 0;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.item p span:first-child {
  font-weight: 500;
}

/* Color-coded text */
.text-ed {
  color: var(--color-ed);
}

.text-red {
  color: var(--color-red);
}

.text-orange {
  color: var(--color-orange);
}

.text-yellow {
  color: var(--color-yellow);
}

.text-green {
  color: var(--color-green);
}

.tooltip {
  display: none;
  position: absolute;
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 15px;
  width: 280px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  z-index: 20;
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  max-height: 300px; /* Default max height */
  overflow-y: auto; /* Make scrollable */
  top: 100%; /* Default position below */
}

.item:hover .tooltip {
  display: block;
}

.tooltip .reward {
  margin-bottom: 8px;
  font-size: 0.9rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tooltip .reward:last-child {
  border-bottom: none;
}

/* Loading state */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--accent-light);
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Footer */
.footer {
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--accent-light) 100%);
  padding: 1rem;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
  transition: background 0.3s ease;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .nav-links {
    width: 100%;
    justify-content: space-between;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .color-filters {
    flex-direction: column;
  }
  
  .results-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  background: #222;
  padding-right: 2rem;
  padding-bottom: 0.5rem;
}

.logo-container img {
  border-radius: 10px;
  padding: 0.5rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  margin: 0 1rem;
  font-weight: 500;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  transition: background 0.2s;
}

nav a.active, nav a:hover {
  background: #7e57c2;
}

@media (max-width: 768px) {
  header {
      flex-direction: column;
      text-align: center;
      gap: 1rem;
  }
}

/* --- Maroon/Beige Theme Additions --- */
.ae-explorer-body {
  background: var(--ae-beige);
  color: #2a0000;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.ae-header {
  background: var(--ae-maroon);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 2rem;
  height: 64px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.ae-header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ae-title-main {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.ae-title-sub {
  font-size: 1.1rem;
  font-weight: 400;
  margin-top: -4px;
  color: var(--ae-accent);
}
.ae-header-nav {
  display: flex;
  gap: 3rem;
}
.ae-header-link {
  color: #fff;
  text-decoration: underline;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.2rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
}
.ae-header-link:hover {
  background: var(--ae-maroon-light);
}
.ae-header-profile {
  display: flex;
  align-items: center;
}
.ae-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--ae-accent);
  background: #fff;
}

.ae-main-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: visible;
}
.ae-timeline-main {
  padding-bottom: 2rem;
  display: flex;
  flex-direction: row;
  width: 100%;
  min-height: 70vh;
  background: var(--ae-beige);
  overflow: visible;
}
.ae-timeline-rail {
  width: 60px;
  position: relative;
  min-width: 60px;
  min-height: 60px;
  display: block;
  padding-top: 0;
}
.ae-timeline-dot,
.ae-timeline-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.ae-timeline-dot {
  width: 18px;
  height: 18px;
  background: var(--ae-maroon);
  border: 3px solid var(--ae-accent);
  border-radius: 50%;
  z-index: 2;
}
.ae-timeline-line {
  width: 6px;
  background: var(--ae-maroon);
  border-radius: 3px;
  z-index: 1;
}
.ae-timeline-line:nth-child(1) {
  height: 10px;
}
.ae-timeline-hr {
  width: 6px;
  height: 2px;
  background: var(--ae-maroon);
  margin: 1.5rem 0 0 0;
  position: relative;
}
.ae-timeline-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 0.5rem 0 0.5rem 0.5rem;
  padding-right: 2.5rem;
}
.ae-timeline-section {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.ae-timeline-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ae-maroon);
}
.ae-timeline-filters-row {
  margin-left: 0.5rem;
}
.ae-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ae-maroon);
}
.ae-inventory-area {
  background: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  min-height: 350px;
}

/* Footer */
.ae-footer {
  background: var(--ae-maroon);
  color: var(--ae-footer-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 2.5rem;
  font-size: 1.1rem;
  margin-top: auto;
  flex-wrap: wrap;
  gap: 1rem;
}
.ae-footer-link{
  color: var(--ae-footer-text);
  text-decoration: underline;
}
.ae-footer-left, .ae-footer-center, .ae-footer-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.ae-footer-center a {
  color: var(--ae-accent);
  text-decoration: underline;
  margin-right: 0.5rem;
}
.ae-footer-center span {
  color: #fff;
}

/* Responsive */
@media (max-width: 1100px) {
  .ae-main-content {
    padding: 1rem 0.5rem;
  }
  .ae-explorer-section {
    padding: 1rem 0.5rem;
  }
}
@media (max-width: 800px) {
  .ae-header {
    flex-direction: column;
    height: auto;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
  }
  .ae-header-nav {
    gap: 1.5rem;
  }
  .ae-main-wrapper {
    flex-direction: column;
    overflow: visible;
  }
  .ae-timeline-main {
    flex-direction: column;
    min-height: auto;
    padding-bottom: 1rem;
    overflow: visible;
  }
  .ae-timeline-rail-desktop {
    display: none !important;
  }
  .ae-timeline-content {
    padding: 1rem 0.5rem;
    padding-right: 0.5rem;
    gap: 2rem;
    overflow: visible;
  }
  .ae-timeline-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group {
    width: 100%;
  }
  .color-filters {
    flex-direction: column;
  }
  .filter-item {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
  .filter-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }
  .results-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .results-count {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .results-navigation {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .inventory {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
  }
  .item {
    padding: 1rem;
    max-height: 300px;
  }
  .token-options {
    justify-content: flex-start;
  }
  .rarity-checkboxes {
    flex-direction: column;
    gap: 5px;
  }
  .rarity-checkbox {
    font-size: 0.75rem;
  }
  .small-input {
    width: 60px;
  }
  .ae-footer {
    flex-direction: column;
    text-align: center;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
    position: relative;
  }
  .ae-footer-left, .ae-footer-center, .ae-footer-right {
    justify-content: center;
    width: 100%;
  }
  .ae-footer-center {
    flex-direction: column;
    gap: 0.5rem;
  }
  .ae-footer-center span {
    display: none;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .ae-explorer-body {
    min-height: 100vh;
    min-height: 100dvh;
  }
  .ae-timeline-content {
    padding: 0.5rem;
    gap: 1.5rem;
    overflow: visible;
  }
  .ae-timeline-main {
    padding-bottom: 0.5rem;
    overflow: visible;
  }
  .inventory {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .item {
    padding: 0.8rem;
    max-height: 280px;
  }
  .ae-footer {
    padding: 0.8rem 0.5rem;
    font-size: 1rem;
    position: relative;
  }
  .ae-header {
    padding: 0.8rem 0.5rem;
  }
  .filters {
    gap: 8px;
  }
  .filter-group {
    margin-bottom: 0.5rem;
  }
}