/* CamStream player styles (responsive, RTL, dark) */
:root {
  --bg: #0b0f14;
  --panel: #121923;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans Hebrew", sans-serif; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; direction: rtl; }
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--panel); border-bottom: 1px solid #1f2a37;
}
.topbar .logo { height: 44px; width: auto; max-width: 160px; object-fit: contain; }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; background: #1f2a37; color: var(--muted);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live { color: #dcfce7; background: #14532d; }
.badge.live .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.badge.err { color: #fee2e2; background: #7f1d1d; }
.badge.err .dot { background: var(--bad); }
.badge.wait .dot { background: var(--warn); }

.stage { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; position: relative; min-height: 200px; }
.player { position: relative; width: 100%; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); aspect-ratio: 16 / 9; background: #000; margin: 0 auto; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 20px; pointer-events: none;
}
.overlay[hidden] { display: none !important; }
.overlay .msg { font-size: 1.1rem; color: var(--text); text-shadow: 0 1px 3px rgba(0,0,0,.8); max-width: 90%; }
.overlay .sub { font-size: 0.85rem; color: var(--muted); }
.overlay.dim { background: rgba(0,0,0,.55); }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bigbtn {
  pointer-events: auto; cursor: pointer; border: 0; border-radius: 999px;
  padding: 14px 26px; font-size: 1.1rem; font-weight: 700; color: #0b0f14; background: var(--accent);
  box-shadow: 0 6px 24px rgba(0,0,0,.5); display: inline-flex; align-items: center; gap: 10px;
}
.bigbtn:active { transform: scale(.97); }
.bigbtn svg { width: 26px; height: 26px; fill: currentColor; }

.bottombar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--panel); border-top: 1px solid #1f2a37; font-size: 0.85rem; color: var(--muted);
}
.bottombar .hint { flex: 1; min-width: 0; }
.ctl { display: flex; gap: 8px; }
.ctl button {
  cursor: pointer; border: 1px solid #334155; background: #1e293b; color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
}
.ctl button svg { width: 18px; height: 18px; fill: currentColor; }
.ctl button:hover { background: #273449; }

/* gallery */
.gallery { flex: 1; padding: 14px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-content: start; }
.gallery .card { background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid #1f2a37; display: flex; flex-direction: column; }
.gallery .card .player { max-height: none; }
.gallery .card .cardbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.gallery .card .cardbar .name { font-weight: 600; }
.gallery .card .cardbar .badge { flex-shrink: 0; }
.gallery .card .actions { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.gallery .card .actions a, .gallery .card .actions button {
  cursor: pointer; text-decoration: none; border: 1px solid #846c4d; background: transparent; color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
}
.gallery .card .actions a:hover, .gallery .card .actions button:hover { background: #846c4d; }
.gallery .card .actions button svg { width: 18px; height: 18px; fill: currentColor; }
.logos { display: flex; justify-content: center; align-items: center; gap: 24px; flex-wrap: wrap; padding: 14px; background: var(--panel); }
.logos img { max-height: 70px; max-width: 180px; width: auto; height: auto; object-fit: contain; }

@media (max-width: 600px) {
  .topbar { padding: 6px 10px; gap: 8px; }
  .topbar .logo { height: 34px; max-width: 110px; }
  .topbar h1 { font-size: 1rem; }
  .player { max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); }
  .overlay .msg { font-size: 1rem; }
  .bigbtn { padding: 12px 20px; font-size: 1rem; }
  .gallery { padding: 10px; gap: 12px; grid-template-columns: 1fr; }
  .logos img { max-height: 50px; max-width: 120px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .topbar, .bottombar { display: none; }
  .player { max-height: 100vh; max-height: 100dvh; }
}
.player:fullscreen, .player:-webkit-full-screen { max-height: none; width: 100vw; height: 100vh; aspect-ratio: auto; }
