/* ===================================
   Esports Plugin Layout (Stories/Garage-style)
   =================================== */

.esports-plugin {
  --ep-ink: #14171a;
  --ep-surface: #ffffff;
  --ep-surface-2: #f4f6f8;
  --ep-surface-3: #e8ecef;
  --ep-text: #1c2025;
  --ep-text-dim: #6b7280;
  --ep-accent: #1d4ed8;
  --ep-accent-bright: #3b82f6;
  --ep-moss: #0f766e;
  --ep-line: rgba(20, 23, 26, 0.09);
  --ep-line-strong: rgba(20, 23, 26, 0.16);
  --ep-radius: 16px;
  --ep-radius-sm: 10px;
  --ep-shadow: 0 8px 24px -12px rgba(20, 23, 26, 0.18);
  --ep-ease: cubic-bezier(0.22, 1, 0.36, 1);
  overflow: visible;
  padding-bottom: 2rem;
  color: var(--ep-text);
}

body.night-mode .esports-plugin {
  --ep-surface: #1c2025;
  --ep-surface-2: #242a30;
  --ep-surface-3: #2c333a;
  --ep-text: #edeae2;
  --ep-text-dim: #9da19b;
  --ep-line: rgba(237, 234, 226, 0.09);
  --ep-line-strong: rgba(237, 234, 226, 0.18);
  --ep-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.45);
}

.esports-plugin .display {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.esports-shell {
  background: var(--ep-surface);
  border: 1px solid var(--ep-line);
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-shadow);
  position: relative;
}

.esports-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 60% 40% at 0% 0%, rgba(29, 78, 216, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 100%, rgba(15, 118, 110, 0.08), transparent 50%);
}

.esports-app-content {
  position: relative;
  z-index: 1;
  padding: 16px 20px 24px;
  color: var(--ep-text);
}

@media (max-width: 767px) {
  .esports-app-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

.esports-side-nav-card {
  border-radius: var(--ep-radius);
  border: 1px solid var(--ep-line);
  box-shadow: var(--ep-shadow);
  overflow: hidden;
  background: var(--ep-surface);
}

.esports-side-nav-card .card-body {
  padding: 18px 14px;
}

.esports-side-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ep-text);
}

.esports-side-brand-link:hover {
  text-decoration: none;
  color: var(--ep-text);
}

.esports-side-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ep-accent-bright), var(--ep-moss));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.esports-side-brand-text {
  font-size: 18px;
  line-height: 1;
}

.esports-side-nav li {
  margin-bottom: 4px;
}

.esports-side-nav li a {
  margin: 0 6px;
  padding: 9px 12px !important;
  border-radius: 10px;
  transition: background 0.18s var(--ep-ease), color 0.18s var(--ep-ease);
  display: flex;
  align-items: center;
}

.esports-side-nav li.active > a {
  background: rgba(29, 78, 216, 0.12);
}

.esports-side-nav li a:hover {
  background: rgba(29, 78, 216, 0.08);
  text-decoration: none;
}

.esports-side-cats {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ep-line);
}

.esports-side-cats-title {
  display: block;
  margin: 0 12px 10px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ep-accent);
}

.esports-side-nav-cats li a {
  font-size: 13px;
}

.esports-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--ep-line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border-radius: var(--ep-radius) var(--ep-radius) 0 0;
}

body.night-mode .esports-topbar {
  background: rgba(28, 32, 37, 0.82);
}

.esports-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.esports-sidebar-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--ep-line);
  background: var(--ep-surface-2);
  color: var(--ep-text);
}

.esports-topbar-title {
  margin: 0;
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1.1;
  color: var(--ep-text);
}

.esports-topbar-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ep-text-dim);
}

.esports-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-es-primary {
  background: var(--ep-accent);
  border-color: var(--ep-accent);
  color: #fff !important;
  border-radius: 10px;
  font-weight: 600;
}

.btn-es-primary:hover {
  background: #1e40af;
  border-color: #1e40af;
  color: #fff !important;
}

.es-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 767px) {
  .es-hub-grid { grid-template-columns: 1fr; }
}

.es-hub-panel {
  background: var(--ep-surface);
  border: 1px solid var(--ep-line);
  border-radius: var(--ep-radius-sm);
  overflow: hidden;
}

.es-hub-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ep-line);
  background: var(--ep-surface-2);
}

.es-hub-panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.es-hub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.es-hub-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ep-line);
}

.es-hub-list li:last-child { border-bottom: 0; }

.es-hub-list a {
  color: var(--ep-text);
  font-weight: 600;
  text-decoration: none;
}

.es-hub-list a:hover { color: var(--ep-accent); }

.es-hub-meta {
  color: var(--ep-text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.es-hub-empty {
  padding: 18px 14px;
  color: var(--ep-text-dim);
  font-size: 13px;
}

.es-section-title {
  margin: 8px 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.es-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.es-card {
  display: block;
  background: var(--ep-surface);
  border: 1px solid var(--ep-line);
  border-radius: var(--ep-radius-sm);
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s var(--ep-ease), box-shadow 0.15s var(--ep-ease);
}

.es-card:hover {
  border-color: rgba(29, 78, 216, 0.35);
  box-shadow: var(--ep-shadow);
  text-decoration: none;
  color: inherit;
}

.es-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.es-card-meta {
  font-size: 12px;
  color: var(--ep-text-dim);
}

.es-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ep-text-dim);
  background: var(--ep-surface-2);
  border-radius: var(--ep-radius-sm);
  border: 1px dashed var(--ep-line);
}

.es-match-scoreline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.es-match-score {
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.es-bracket-slot {
  padding: 0.65rem 0.75rem;
  background: var(--ep-surface-2);
  border: 1px solid var(--ep-line);
  border-radius: 8px;
}

.es-live-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 767px) {
  .esports-sidebar-col { display: none; }
  .esports-sidebar-col.is-open {
    display: block;
    position: fixed;
    z-index: 1050;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    overflow: auto;
    background: var(--ep-surface);
    padding: 1rem;
    box-shadow: 8px 0 30px rgba(0,0,0,.2);
  }
  .esports-sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1040;
  }
}
