/****************************************************************************
 *  1. GLOBAL RESETS & VARIABLES
 ****************************************************************************/
 :root {
  /* Color & Font Variables */
  --color-bg: #1F2937;            /* Dark-ish background */
  --color-text: #F9FAFB;          /* Light text */
  --color-accent: #3B82F6;        /* Vibrant Blue (nav & footer) */
  --color-highlight: #F59E0B;     /* Vibrant Orange (buttons/headings) */
  --color-highlight-hover: #D97706; /* Darker Orange (hover) */
  --font-main: 'Press Start 2P', cursive, sans-serif;
}

/* Reset & Basic */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  margin: 0;
}
a {
  color: var(--color-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/****************************************************************************
 *  2. TABLE & "SMALL-TEXT" STYLING
 ****************************************************************************/
table.small-text {
  border-collapse: collapse;
  width: 100%;
}
table.small-text th, table.small-text td {
  padding: 0.5rem;
}
table.small-text th {
  background: #ddd;
  text-align: left;
}
.small-text {
  font-size: 0.8rem; /* 80% smaller than default */
}
.expansion-row {
  background-color: #f9f9f9;
}

/****************************************************************************
 *  3. COLLECTIONS & CARDS
 ****************************************************************************/
.collection-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-start;
  margin-top: 1rem;
}
/* Each card is 25% width on desktop => 4 across */
.collection-card {
  flex: 0 0 calc(25% - 1rem);
  background-color: #3B82F6;
  color: #FFFFFF;
  text-align: center;
  padding: 1rem;
  border-radius: 8px;
  text-decoration: none;

  /* Card layout */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  transition: transform 0.2s ease-in-out;
}
.collection-card:hover {
  transform: scale(1.05);
}
.collection-icon {
  width: 50px;
  height: 50px;
  margin-bottom: 0.5rem;
  object-fit: contain; 
}
.collection-card-text {
  font-size: 1rem;
  font-weight: bold;
}
/* For screens <= 768px, 2 cards per row */
@media screen and (max-width: 768px) {
  .collection-card {
    flex: 0 0 calc(50% - 1rem);
  }
}
/* Optional style for 'no collections' message */
.no-collections-msg {
  flex: 0 0 100%;
  background-color: #1F2937;
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  margin-top: 1rem;
}

/****************************************************************************
 *  4. MAIN LAYOUT (Container, Page Wrapper)
 ****************************************************************************/
/* 
  .page-wrapper used for "sticky footer" approach 
  if you want the footer pinned at bottom 
*/
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;  /* ensure it spans full height */
}

.main-container {
  flex: 1;           /* push footer down */
  max-width: 1200px; 
  margin: 0 auto;
  padding: 0 1rem;
}

  .container {
    max-width: 1080px;
    margin: 1rem auto;
    padding: 0 1rem;
  }

  /* dice container styling */
#diceContainer {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}
.dice-face {
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}
.dice-face:hover {
  transform: scale(1.1);
}
.dice-img {
  width: 40px;
  height: 40px;
}

/****************************************************************************
 *  5. HEADERS & NAV
 ****************************************************************************/
/* 
  top-header: separate from nav for a distinct (logo + site name) area 
  with no background from nav
*/
.top-header {
  position: relative; /* Required for absolute positioned theme panel */
  padding: 1rem;
  background: var(--color-bg); /* or #f5f5f5 if you want a lighter area for the logo */
  text-align: center;
  border-bottom: 2px solid #ccc; /* optional line */
}
.site-logo {
  text-decoration: none;
  color: var(--color-text);
}
.logo-img {
  width: 50px;
  height: 50px;
  vertical-align: middle;
}
.site-name {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 1.1rem;
  vertical-align: middle;
}

/* main-nav with background color, etc. */
.main-nav {
  background-color: var(--color-accent);
  padding: 0.5rem 1rem;
  text-align: center;
}
.main-nav ul {
  list-style: none;
  display: inline-block;
}
.main-nav li {
  display: inline-block;
  margin: 0 0.5rem;
}
/* Menu items styled as "buttons" */
.main-nav a,
.logout-btn {
  background-color: var(--color-highlight);
  color: var(--color-bg);
  border: none;
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  border-radius: 4px;
  font-size: 0.9rem;
}
.main-nav a:hover,
.logout-btn:hover {
  background-color: var(--color-highlight-hover);
}
.logout-btn {
  font-family: var(--font-main);
}

/****************************************************************************
 *  6. FOOTER
 ****************************************************************************/
.site-footer {
  background-color: var(--color-accent);
  color: var(--color-text);
  text-align: center;
  padding: 1rem;
  margin-top: auto; /* ensures it's pinned at bottom in .page-wrapper layout */
}

/****************************************************************************
 *  7. BUTTONS & HEADINGS (Generic)
 ****************************************************************************/
/* Reusable .btn style */
.btn {
  background-color: var(--color-highlight);
  border: none;
  color: var(--color-bg);
  padding: 0.7rem 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}
.btn:hover {
  background-color: var(--color-highlight-hover);
}
/* Headings in highlight color */
h1, h2, h3 {
  color: var(--color-highlight);
}

/****************************************************************************
 *  8. MOBILE MENU & RESPONSIVE NAVIGATION
 ****************************************************************************/

/* Header Container with Flexbox */
.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Mobile Menu Toggle (Hamburger) */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.menu-toggle span {
  width: 30px;
  height: 3px;
  background-color: var(--color-highlight);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Navigation Container */
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Navigation Menu Structure */
.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.nav-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.nav-section.primary,
.nav-section.secondary,
.nav-section.auth {
  width: auto;
}

.nav-item {
  flex: 0 0 auto;
}

/* Navigation Links */
.nav-item a {
  display: block;
  padding: 0.5rem 1rem;
  background-color: var(--color-highlight);
  color: var(--color-bg);
  text-decoration: none;
  font-size: 0.65rem;
  border-radius: 5px;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-transform: uppercase;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nav-item a:hover {
  background-color: var(--color-highlight-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.nav-item a:active {
  transform: translateY(0);
}

/* Divider between sections */
.nav-divider {
  width: 1px;
  height: auto;
  background-color: rgba(255,255,255,0.2);
  margin: 0 0.25rem;
}

/* Auth buttons - distinct green styling */
.nav-item.auth a,
.nav-item.auth .logout-btn {
  background-color: #27ae60;
}

.nav-item.auth a:hover,
.nav-item.auth .logout-btn:hover {
  background-color: #229954;
}

/* Mobile Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  z-index: 999;
}

.overlay.active {
  display: block;
}

/****************************************************************************
 *  9. MOBILE RESPONSIVE STYLES
 ****************************************************************************/

/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--color-bg);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    padding: 0;
  }

  .main-nav.active {
    left: 0;
  }

  .nav-container {
    padding: 5rem 1rem 2rem;
  }

  .nav-menu {
    flex-direction: column;
    gap: 0;
  }

  .nav-section {
    flex-direction: column;
    width: 100%;
    gap: 0;
    border-bottom: 2px solid var(--color-accent);
    padding: 1rem 0;
  }

  .nav-section:last-child {
    border-bottom: none;
  }

  .nav-item {
    width: 100%;
    display: block;
  }

  .nav-item a,
  .nav-item .logout-btn {
    width: 100%;
    text-align: left;
    border-radius: 0;
    padding: 1rem;
    font-size: 0.7rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .nav-divider {
    display: none;
  }

  /* Section headers for mobile */
  .nav-section::before {
    content: attr(data-section);
    display: block;
    color: var(--color-accent);
    font-size: 0.6rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
}

/* Tablet adjustments (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-item a {
    font-size: 0.6rem;
    padding: 0.45rem 0.85rem;
  }

  .logout-btn {
    font-size: 0.6rem;
    padding: 0.45rem 0.85rem;
  }
}

/* Desktop - larger screens (1200px+) */
@media (min-width: 1200px) {
  .nav-item a {
    font-size: 0.7rem;
    padding: 0.6rem 1.2rem;
  }

  .logout-btn {
    font-size: 0.7rem;
    padding: 0.6rem 1.2rem;
  }
}

/****************************************************************************
 *  10. THEME SWITCHER
 ****************************************************************************/

/* Theme Controls Button */
.theme-controls {
  display: flex;
  align-items: center;
  margin: 0 1rem;
}

.theme-toggle {
  background: none;
  border: 2px solid var(--color-highlight);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.theme-toggle:hover {
  background-color: var(--color-highlight);
  transform: scale(1.1);
}

.theme-icon {
  font-size: 1.5rem;
  line-height: 1;
}

/* Theme Panel */
.theme-panel {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-accent);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 1.5rem;
  z-index: 1002;
  max-width: 500px;
  width: 90vw;
  margin-top: 0.5rem;
  margin-right: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

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

.theme-panel h3 {
  margin: 0 0 1rem 0;
  color: var(--color-highlight);
  font-size: 0.9rem;
  text-align: center;
}

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

.theme-option {
  background: var(--color-bg);
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-family: var(--font-main);
}

.theme-option:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.theme-option.active {
  border-color: var(--color-highlight);
  background-color: var(--color-accent);
}

.theme-preview {
  width: 60px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

/* Theme Preview Colors */
.theme-preview.theme-retro-dark {
  background: linear-gradient(135deg, #1F2937 50%, #3B82F6 50%);
}

.theme-preview.theme-retro-light {
  background: linear-gradient(135deg, #F3F4F6 50%, #2563EB 50%);
}

.theme-preview.theme-space-dark {
  background: linear-gradient(135deg, #0a0e27 50%, #6366f1 50%);
}

.theme-preview.theme-space-light {
  background: linear-gradient(135deg, #dbeafe 50%, #4f46e5 50%);
}

.theme-preview.theme-modern-dark {
  background: linear-gradient(135deg, #18181b 50%, #8b5cf6 50%);
}

.theme-preview.theme-modern-light {
  background: linear-gradient(135deg, #ffffff 50%, #7c3aed 50%);
}

.theme-preview.theme-fantasy-dark {
  background: linear-gradient(135deg, #1c1410 50%, #9333ea 50%);
}

.theme-preview.theme-fantasy-light {
  background: linear-gradient(135deg, #fef3c7 50%, #7c3aed 50%);
}

.theme-label {
  font-size: 0.55rem;
  text-align: center;
  color: var(--color-text);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .theme-controls {
    margin: 0 0.5rem;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

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

  .theme-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
  }

  .theme-options {
    grid-template-columns: repeat(2, 1fr);
  }
}
