/**
 * Shared CSS for LifeSteal SMP website
 * Contains common styles, variables, and layout rules used across all pages
 */

/* CSS Variables - Theme Colors */
:root {
  --bg: #0c0c0c;
  --surface: #151515;
  --surface-light: #1c1c1c;
  --text: #ffffff;
  --muted: #b3b3b3;
  --accent: #ff2e2e;
  --accentHover: #ff4d4d;
  --border: #242424;
}

/* Base Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }

/* Hide default scrollbar on html */
html {
  overflow: hidden;
  scroll-behavior: smooth;
}

/* Body Base Styles */
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, Noto Sans,
    "Apple Color Emoji", "Segoe UI Emoji";
  position: relative;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  /* Remove blue tap highlight on mobile */
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

/* Background Gradient Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.25) 100%);
  opacity: 1;
}

/* Links */
a { 
  color: inherit; 
  text-decoration: none; 
}

/* Skip to main content for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  z-index: 10000;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* Enhanced focus indicators for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible {
  outline-offset: 3px;
}

/* Content typography - shared by index, vote, etc. */
main p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 16px;
  max-width: 64ch;
}
main code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.note {
  color: var(--muted);
  line-height: 1.5;
}
main h1 {
  margin: 0;
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 750;
}

/* Header/Navbar Styles */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px; /* Explicit height for consistent spacing */
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  box-sizing: border-box;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--surface-light);
  border-radius: 4px;
}

.brandtext {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  gap: 1px;
  min-width: 0;
  align-items: flex-start;
  text-align: left;
  width: max-content;
}

.brandtitle {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  white-space: nowrap;
  width: max-content;
}

.brandsub {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: -2px;
  white-space: nowrap;
  width: 100%;
}

/* Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-self: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: color 120ms ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-links a.mobile-only {
  display: none; /* Hidden on desktop, shown in mobile menu */
}

.nav-links a:hover { 
  color: var(--text);
}

.nav-links a.active {
  color: var(--text);
  position: relative;
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Hide sidebar actions on desktop */
.sidebar-actions {
  display: none;
}

/* External link icon styling for navigation links - desktop navbar */
.nav-links a .external-link-icon {
  width: 11px !important;
  height: 11px !important;
  opacity: 0.8 !important;
  display: inline-flex !important;
  align-items: center;
  flex-shrink: 0;
  margin-left: 3px;
  visibility: visible !important;
  color: currentColor;
}

.nav-links a .external-link-icon svg {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  visibility: visible !important;
}

/* Navigation Right Side */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  position: relative;
}

.menu-toggle:hover {
  background: var(--surface-light);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  transition: opacity 200ms ease, transform 200ms ease;
}

.menu-toggle svg.hamburger-icon {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg);
}

.menu-toggle svg.close-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(90deg);
}

.menu-toggle.active svg.hamburger-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.menu-toggle.active svg.close-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Mobile Menu Styles */
@media (max-width: 820px) {
  .menu-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 64px; /* Start below navbar */
    left: 0;
    bottom: 0;
    width: 75%;
    max-width: 400px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 16px 16px 24px;
    gap: 8px;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 300ms ease;
    z-index: 998;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }
  
  .nav-links.open {
    transform: translateX(0);
    visibility: visible;
  }
  
  /* Backdrop overlay */
  #mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
    z-index: 997;
    display: none;
  }
  
  .nav-links a {
    padding: 14px 16px;
    border-radius: 8px;
    width: 100%;
    font-size: 15px;
    display: block;
    position: relative;
  }
  
  .nav-links a:hover {
    background: var(--surface-light);
  }
  
  .nav-links a.mobile-only {
    display: block;
  }
  
  .nav-links a.active {
    position: relative;
    display: inline-flex !important; /* Use inline-flex to shrink to content */
    width: fit-content !important; /* Force it to be only as wide as content */
    align-self: flex-start !important; /* Override parent's align-items: stretch */
    padding: 14px 16px;
    align-items: center;
  }
  
  /* Make underline only span the text content, not the full link */
  .nav-links a.active::after {
    content: "";
    position: absolute;
    left: 18px; /* Start after left padding + 2px adjustment */
    right: 16px; /* End at right padding - this ensures it only spans text width */
    bottom: 6px; /* Position below the link text - adjusted from 8px to 6px */
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }
  
  .sidebar-actions {
    display: flex;
    flex-direction: row; /* Side by side instead of stacked */
    gap: 10px;
    margin-top: 16px;
    padding: 24px 0 0 0; /* Only top padding, no left/right so border extends fully */
    border-top: 1px solid var(--border);
    align-items: flex-start; /* Align items to the left like navbar */
    width: 100%; /* Full width so border extends fully */
    box-sizing: border-box;
  }
  
  /* Override stretch for sidebar actions - allow full width for border */
  .nav-links > .sidebar-actions {
    align-self: stretch; /* Allow full width */
  }
  
  .sidebar-actions .pill {
    flex: 2; /* 2:1 ratio with Store button */
    flex-shrink: 0;
    display: inline-flex !important;
    justify-content: center; /* Center content */
    /* Match pill's exact dimensions for height */
    height: auto !important;
    padding: 6px 10px !important; /* Match pill's exact padding (6px 10px) */
    min-width: 0; /* Allow flex to work */
    /* All other pill styles (border-radius: 999px, etc.) come from base .pill class */
  }
  
  .sidebar-actions .btn {
    flex: 1; /* 2:1 ratio with Discord pill (pill is flex: 2, button is flex: 1) */
    flex-shrink: 0;
    display: inline-flex !important;
    justify-content: center; /* Center content */
    align-items: center;
    /* Match pill's exact dimensions for height */
    height: auto !important;
    padding: 6px 10px !important; /* Match pill's exact padding (6px 10px) */
    min-width: 0; /* Allow flex to work */
    /* Red button with white text - btn-primary styles */
    background: var(--accent) !important; /* Red background */
    color: #fff !important; /* White text */
    border: none !important;
    /* All other button styles come from base .btn class */
  }
  
  /* Mobile sidebar - slightly larger icon */
  .nav-links a .external-link-icon {
    width: 12px !important;
    height: 12px !important;
    margin-left: 6px;
    opacity: 0.7;
  }
  
  .topbar { 
    grid-template-columns: 1fr auto; 
  }
  
  .nav-right .pill { 
    display: none; 
  }
  
  .nav-right .btn { 
    display: none; /* Hide Store button on mobile - it's in the menu now */
  }
  
  .brandsub { 
    display: none; 
  }
}

/* Main Content Area - Scrollable */
/* Note: index.html uses .page-content for scrolling, not main */
main {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 64px); /* Full height minus navbar */
  margin-top: 64px; /* Account for fixed header */
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) var(--bg);
}

/* Override for index.html which uses .page-content for scrolling */
.page-content main {
  overflow: visible;
  height: auto;
  margin-top: 0; /* index.html doesn't need margin-top since .page-content handles layout - page-specific styles will override this */
}

main > .container:first-of-type {
  flex: 1;
  padding: 18px 0;
}

/* Mobile: Add side spacing to cards */
@media (max-width: 820px) {
  main > .container:first-of-type {
    padding: 18px 12px; /* Add horizontal padding on mobile */
  }
}

main::-webkit-scrollbar {
  width: 10px;
}

main::-webkit-scrollbar-track {
  background: var(--bg);
  border-left: 1px solid var(--border);
}

main::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 5px;
}

main::-webkit-scrollbar-thumb:hover {
  background: var(--surface);
}

/* Footer Styles */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0 24px;
  margin-top: 48px;
}

.footer-content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px; /* Desktop padding */
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  text-align: center;
}

/* Mobile: Add more side spacing to footer */
@media (max-width: 820px) {
  .footer-content {
    padding: 0 20px; /* Increase horizontal padding on mobile only */
  }
}

@media (min-width: 640px) {
  .footer-content {
    text-align: left;
  }
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0; /* Allow text to shrink if needed */
}

.footer-copyright {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start; /* Always left-aligned */
  min-width: 0; /* Allow text to shrink if needed */
  text-align: left; /* Always left-aligned */
}

.footer-copyright-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.footer-copyright-disclaimer {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
  line-height: 1.3;
  margin-top: -2px;
}

.footer-copyright span {
  opacity: 0.8;
}

.footer-social {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .footer-social {
    justify-content: flex-end;
  }
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  transition: color 120ms ease, transform 120ms ease;
  border-radius: 6px;
}

.footer-social a:hover {
  color: var(--text);
  transform: translateY(-2px);
}

.footer-social svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Pill Component Styles */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
  cursor: pointer;
}

.pill:hover {
  background: var(--surface);
  color: var(--text);
}

#online-pill { 
  gap: 6px; 
}

.pill-text {
  display: grid;
  grid-auto-rows: min-content;
  justify-items: center;
  row-gap: 2px;
  line-height: 1.05;
}

.pill-topline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  min-width: 88px;
}

.pill-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.92;
}

#online-pill .pill-sub, 
#discord-pill .pill-sub { 
  font-weight: 700; 
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6b6b6b;
  flex: 0 0 auto;
}

#online-pill[data-state="online"] .status-dot { 
  background: #22c55e; 
}

#online-pill[data-state="offline"] .status-dot { 
  background: #ef4444; 
}

#online-pill[data-state="unknown"] .status-dot { 
  background: #6b6b6b; 
}

#playercount {
  display: inline-block;
  text-align: left;
}

.pixel-icon,
.discord-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  color: var(--muted);
  transition: color 120ms ease;
}

.pill:hover .pixel-icon,
.pill:hover .discord-icon { 
  color: var(--text); 
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
  text-decoration: none;
}

.btn:hover { 
  background: #222222; 
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover { 
  background: var(--accentHover); 
  transform: translateY(-1px);
}

.btn-white {
  background: #ffffff;
  color: #000000;
  border: none;
  font-weight: 700;
}

.btn-white:hover { 
  background: #e6e6e6; 
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:active {
  transform: scale(0.98);
}

@media (max-width: 820px) {
  .btn, .copy {
    min-height: 44px;
  }
}

/* Card - base styles shared by vote, realm, rgb, index */
.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
}

/* Copy Button - shared base */
.copy {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms ease, transform 100ms ease;
}
.copy:hover {
  background: #222222;
}
.copy:active {
  transform: scale(0.98);
}
.copy:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
