/* ePlayHD — Main Stylesheet */

:root {
  --bg: #0a0a0f;
  --bg-card: #14141c;
  --bg-sidebar: #0e0e16;
  --border: rgba(255,255,255,0.08);
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --text: #f0f0f0;
  --text-muted: rgba(240,240,240,0.45);
  --text-sub: rgba(240,240,240,0.65);
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =============================================
   Layout
   ============================================= */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  display: none;
  flex-direction: column;
  width: 240px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}
@media (min-width: 768px) { .sidebar { display: flex; } }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.brand-icon { width: 24px; height: 24px; color: var(--primary); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--bg-card); color: var(--text); }
.nav-item svg { width: 16px; height: 16px; color: var(--primary); }

/* Main */
.main-content {
  flex: 1;
  padding: 20px 16px 48px;
  max-width: 860px;
}
@media (min-width: 768px) { .main-content { padding: 32px 40px 64px; } }

/* Mobile header */
.mobile-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 700;
}
.mobile-header svg { width: 20px; height: 20px; color: var(--primary); }
@media (min-width: 768px) { .mobile-header { display: none; } }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
@media (min-width: 768px) { .page-header h1 { font-size: 26px; } }

/* Refresh button */
.refresh-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  transition: color 0.15s;
  padding: 6px 10px;
  border-radius: 7px;
}
.refresh-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.refresh-btn svg { width: 15px; height: 15px; }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.6s linear infinite; }

/* =============================================
   Search
   ============================================= */
.search-wrapper {
  position: relative;
  margin-bottom: 16px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px 11px 40px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: rgba(239,68,68,0.5); box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }

/* =============================================
   Match List
   ============================================= */
.match-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.match-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.match-item:hover { background: rgba(20,20,28,0.7); border-color: rgba(239,68,68,0.35); }
.match-item:active { transform: scale(0.995); }
.match-item:disabled { opacity: 0.65; cursor: not-allowed; }
.match-item.loading { opacity: 0.7; }

/* Avatar */
.match-avatar { position: relative; flex-shrink: 0; }
.avatar-img {
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.avatar-fallback svg { width: 20px; height: 20px; color: var(--text-muted); }
.live-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

/* Info */
.match-info { flex: 1; min-width: 0; }
.match-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.match-time { margin-left: 4px; color: var(--text-sub); }

/* Action */
.match-action { flex-shrink: 0; color: var(--text-muted); }
.match-action svg { width: 20px; height: 20px; }

/* Mini spinner */
.mini-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* =============================================
   States
   ============================================= */
.loader-wrapper {
  display: flex; align-items: center; justify-content: center;
  padding: 80px 0;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.error-state, .empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 80px 0;
  color: var(--text-muted);
}
.error-state svg, .empty-state svg { width: 36px; height: 36px; }
.error-state p, .empty-state p { font-size: 14px; }

.retry-link {
  background: none; border: none;
  color: var(--primary); font-size: 14px;
  cursor: pointer; font-family: var(--font);
  text-decoration: underline;
}
.retry-link:hover { color: var(--primary-hover); }

/* Match count */
.match-count {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
}
