/* styles.css — shared styles for index.html and player.html */
:root {
  --bg: #0b0f17;
  --surface: #131a26;
  --surface-2: #1b2433;
  --text: #e8eef7;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --border: #243047;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: rgba(11, 15, 23, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: .3px;
}

.site-header h1 .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%   { opacity: 1; transform: scale(1); }
  50%  { opacity: .55; transform: scale(.85); }
  100% { opacity: 1; transform: scale(1); }
}

.search {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  width: min(360px, 50vw);
}

.search input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  width: 100%;
  font-size: 14px;
}

/* ---------- Channel grid ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 22px 60px;
}

.group-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 4px 14px;
}

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
  min-height: 120px;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface-2);
}

.card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #062e15;
}

.card .badge.iframe {
  background: #38bdf8;
  color: #052033;
}

.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #22c55e22, #38bdf822);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 22px;
}

.card .name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.card .id {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
}

/* ---------- Player page ---------- */
.player-shell {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.player-bar .title {
  font-size: 18px;
  font-weight: 600;
}

.player-bar .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.player-bar .back:hover { border-color: var(--accent); }

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.player-frame video,
.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-js {
  width: 100% !important;
  height: 100% !important;
}

.error-box {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  background: rgba(0,0,0,.65);
  flex-direction: column;
  gap: 10px;
}

.error-box.show { display: flex; }

.error-box button {
  padding: 8px 16px;
  background: var(--accent);
  color: #062e15;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 24px 16px 40px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 10px; align-items: stretch; }
  .search { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .card { min-height: 100px; padding: 16px 10px; }
  .card .name { font-size: 13px; }
}
