/* Optimized Index Page Styles - Windows Performance Enhanced */

/* Core theme variables */
:root {
  --panel: rgba(44, 44, 46, 0.6);
  --panel-border: rgba(255,255,255,.15);
  --muted:rgba(255,255,255,0.7);
  --text:#ffffff;
  --accent:#6ab7ff;
  --chipBg: rgba(28, 28, 30, 0.3);
  --chipActive: rgba(106,183,255,.25);
}

/* Base layout */
html, body {
  height:100%;
}

body {
  margin:0;
  font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);
  background: url(../indexBG.jpg) center center / cover no-repeat fixed !important;
  background-color: transparent !important;
  position: relative;
}

html body {
  background: url(../indexBG.jpg) center center / cover no-repeat fixed !important;
  background-color: transparent !important;
}

body::before {
  content:'';
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:0;
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.30) 60%, rgba(0,0,0,0.5) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.22), rgba(0,0,0,0.32));
}

body > * {
  position:relative;
  z-index:1;
}

/* Container */
.wrap {
  margin:0 auto 18px;
  padding:0 12px;
  width:100%;
}

/* Class bar (faction chips above filters) */
.classBar {
  display:flex;
  flex-wrap:wrap;
  gap:6px 10px;
  padding:8px 14px;
  margin-top:14px;
  align-items:center;
  position: sticky;
  top: 0;
  z-index: 101;
  background: rgba(20, 22, 26, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  will-change: transform;
}

@supports (backdrop-filter: blur(20px)) {
  body:not(.windows-compatibility) .classBar {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(20, 22, 26, 0.75);
  }
}

.classBar .chip {
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:5px 11px;
  border-radius:6px;
  background: rgba(255, 255, 255, 0.05);
  border:1px solid rgba(255, 255, 255, 0.1);
  font-size:13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  cursor:pointer;
  user-select:none;
  line-height:1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  opacity: 0.65;
}

.classBar .chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  opacity: 0.85;
}

.classBar .chip.active {
  background: transparent;
  color: #fff;
  border-color: rgba(106, 183, 255, 0.3);
  opacity: 1;
}

.classBar .chip img {
  height:16px;
  width:16px;
  object-fit:contain;
}

/* Card grid - desktop only */
@media (min-width: 769px) {
  .grid {
    display:grid;
    grid-template-columns:repeat(auto-fill, 300px);
    justify-content:center;
    gap:14px;
    margin-top:10px;
    overflow:visible;
    position: relative;
    z-index: 50;
    /* Performance: Use transform for GPU acceleration */
    transform: translateZ(0);
    will-change: auto;
  }
}

/* Card styling */
.card {
  width:300px;
  background: transparent;
  border:1px solid rgba(255, 255, 255, 0.15);
  border-radius:12px;
  overflow:visible;
  position:relative;
  transform-origin:center center;
  transition:transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s cubic-bezier(.22,1,.36,1), border-color .18s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1;
  display:flex;
  flex-direction:column;
  gap:10px;
  /* Performance optimizations */
  contain: layout style paint;
  content-visibility: auto;
}

.card::before {
  content:'';
  position:absolute;
  inset:0;
  border-radius:inherit;
  background: rgba(28, 28, 30, 0.5);
  z-index:0;
  pointer-events:none;
  transition:inherit;
}

/* Windows-compatible backdrop filter - only on non-Windows */
@supports (backdrop-filter: blur(20px)) {
  body:not(.windows-compatibility) .card::before {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(28, 28, 30, 0.4);
  }
}

.card > * {
  position:relative;
  z-index:1;
}

.card-media {
  position:relative;
  border-radius:12px 12px 0 0;
  overflow:hidden;
  background: transparent;
  width:100%;
  height:auto;
  flex-shrink:0;
}

/* Optimized hover for Windows */
.card:hover {
  transform:scale(1.08);
  z-index:102;
  box-shadow:0 18px 48px rgba(0,0,0,.5);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Even more optimized hover for Windows */
body.windows-compatibility .card {
  transition:transform .12s ease-out, box-shadow .12s ease-out, border-color .12s ease-out;
}

body.windows-compatibility .card:hover {
  transform:scale(1.05);
  box-shadow:0 12px 36px rgba(0,0,0,.45);
}

.card.card-unowned {
  border-color: rgba(248, 113, 113, 0.45);
  opacity: 0.85;
}

.card.card-unowned:hover {
  transform:scale(1.05);
}

.card.card-unowned img {
  filter: grayscale(100%);
  -webkit-filter: grayscale(100%);
}

.card-ownership-banner {
  position:absolute;
  top:11%;
  right:12%;
  padding:0px 2px;
  border-radius:7px;
  background:rgba(248, 248, 248, 0.95);
  border:none;
  border-right:2px solid rgba(255, 255, 255, 0.3);
  border-bottom:2px solid rgba(255, 255, 255, 0.3);
  font-size:9px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.6px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:black;
  z-index:20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-ownership-banner::before {
  content:'\1F512';
  font-size:16px;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition:none;
  }
  .card:hover {
    transform:none;
  }
}

/* Disable expensive hover effects on Windows when many cards are visible */
body.windows-compatibility.many-cards .card {
  transition: none;
}

body.windows-compatibility.many-cards .card:hover {
  transform: scale(1.03);
  transition: transform 0.08s ease-out;
}

.card img {
  width:100%;
  height:auto;
  display:block;
  background: transparent;
  border-radius: inherit;
  object-fit:cover;
  object-position:center;
  /* Performance: Lazy loading hint */
  content-visibility: auto;
}

.card .card-meta {
  padding:14px 16px !important;
  border-radius: 0 0 12px 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
  color:var(--text);
  border-top:1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.name {
  font-weight:800;
  font-size:16px;
}

.sub {
  color:var(--muted);
  font-size:12.5px;
}

.stats {
  margin-top:6px;
  font-size:12.5px;
  display:flex;
  gap:10px;
  color:var(--muted);
}

/* Favorite heart button - bottom right of card */
.favorite-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(28, 28, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.15s ease;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Windows-compatible backdrop filter - only on non-Windows */
@supports (backdrop-filter: blur(10px)) {
  body:not(.windows-compatibility) .favorite-btn {
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    background: rgba(28, 28, 30, 0.6);
  }
}

.card:hover .favorite-btn,
.favorite-btn.favorited {
  opacity: 1;
  pointer-events: auto;
}

.favorite-btn:hover {
  transform: scale(1.15);
  background: rgba(44, 44, 46, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

.favorite-btn.favorited {
  background: rgba(220, 20, 60, 0.85);
  border-color: rgba(220, 20, 60, 0.4);
}

/* Loading spinner */
.spinner {
  width:22px;
  height:22px;
  border:3px solid rgba(255,255,255,.3);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin 1s linear infinite;
  margin:10px auto;
}

@keyframes spin {
  to {
    transform:rotate(360deg);
  }
}

/* Ensure navbar links are always white on every page */
.sidebar-nav .nav-item,
.sidebar-nav .nav-item span,
.sidebar-nav a.nav-item,
.sidebar-nav a.nav-item span,
.sidebar-nav a.nav-item:link,
.sidebar-nav a.nav-item:visited,
.sidebar-nav a.nav-item:hover,
.sidebar-nav a.nav-item:active,
.sidebar-nav a.nav-item:focus,
.sidebar-nav a.nav-item.active,
.sidebar-nav a.nav-item.active span,
.sidebar-nav a.nav-item.active:link,
.sidebar-nav a.nav-item.active:visited,
.sidebar-nav a.nav-item.active:hover,
.sidebar-nav a.nav-item.active:active,
.sidebar-nav a.nav-item.active:focus,
.ah-nav a,
.ah-nav a:link,
.ah-nav a:visited,
.ah-nav a:hover,
.ah-nav a:active,
.ah-nav a:focus,
.ah-nav a[aria-current="page"],
nav.ah-nav a,
nav.ah-nav a:link,
nav.ah-nav a:visited,
nav.ah-nav a:hover,
nav.ah-nav a:active,
nav.ah-nav a:focus {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}

/* Ensure sidebar footer links are always white */
.sidebar-footer-links a,
.sidebar-footer-links a:link,
.sidebar-footer-links a:visited,
.sidebar-footer-links a:hover,
.sidebar-footer-links a:active,
.sidebar-footer-links a:focus {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}

/* Hide sidebar nav on mobile */
body.has-sidebar .ah-nav,
body.has-sidebar nav.ah-nav {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
}
