@import "../../rdp-design-system.css";

/* =============================================
   LIVE STREAMING CSS — Ramallah Digital v2.0
   Powered by RDP Design System variables
   ============================================= */

/* ============ BASE ============ */
html,
body {
  min-height: 100vh;
  width: 100vw;
  background: var(--background-dark) !important;
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* خلفية سينمائية */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, var(--primary-glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(229, 57, 53, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============ LAYOUT ============ */
.live-page {
  min-height: 100vh;
  padding: 60px 40px 80px;
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  background-color: var(--background-deep);
}

/* ============ HEADER ============ */
.live-header {
  margin-top: 80px;
  text-align: center;
  margin-bottom: 48px;
}

.live-header .section-label {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 12px;
}

.live-header h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  color: var(--text-light);
  margin-bottom: 8px;
}

.live-header .divider {
  width: 60px;
  height: 2px;
  background: var(--primary-color);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* ============ LIVE BADGE ============ */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: var(--primary-color);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
}

.live-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-subtle);
  border: 1px solid var(--border-color-muted);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
}

/* ============ PLAYER WRAPPER ============ */
.player-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  aspect-ratio: 16/9;
}

.player-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Overlay عند Offline */
.player-offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #131722 0%, var(--background-deep) 100%);
  gap: 16px;
}

.player-offline .offline-icon {
  font-size: 3.5rem;
  opacity: 0.3;
}

.player-offline p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ============ VIEWER COUNT ============ */
.viewer-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
}

.viewer-count svg { color: var(--primary-color); }

/* ============ INFO BAR ============ */
.stream-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.stream-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-light);
}

.stream-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============ SHARE BUTTONS ============ */
.share-section { margin-top: 28px; }

.share-section h3 {
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 14px;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition-base), background var(--transition-base);
}

.share-btn:hover { transform: translateY(-2px); }
.share-btn.facebook  { border-color: #1877f2; color: #1877f2; }
.share-btn.facebook:hover  { background: #1877f2; color: #fff; }
.share-btn.twitter   { border-color: #1da1f2; color: #1da1f2; }
.share-btn.twitter:hover   { background: #1da1f2; color: #fff; }
.share-btn.whatsapp  { border-color: #25d366; color: #25d366; }
.share-btn.whatsapp:hover  { background: #25d366; color: #fff; }
.share-btn.telegram  { border-color: #229ed9; color: #229ed9; }
.share-btn.telegram:hover  { background: #229ed9; color: #fff; }
.share-btn.youtube   { border-color: #ff0000; color: #ff0000; }
.share-btn.youtube:hover   { background: #ff0000; color: #fff; }
.share-btn.copy { border-color: var(--primary-color); color: var(--primary-color); }
.share-btn.copy:hover { background: var(--primary-color); color: var(--text-light); }

/* ============ DASHBOARD LAYOUT ============ */
.dashboard-live-page {
  display: grid;
  grid-template-columns: 100%;
  min-height: 100vh;
}

/* ── Sidebar ── */
.dash-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 320px;
  height: 100vh;
  background: linear-gradient(160deg, #1a0608 60%, #200a0c 100%);
  border-right: 1px solid var(--border-color);
  padding: 40px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: var(--z-fixed);
  overflow-y: auto;
  direction: rtl;
}

.dash-sidebar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  opacity: 0.6;
}

.dash-sidebar h2 {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-light);
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

/* ── Content ── */
.dash-content {
  margin-left: 320px;
  direction: rtl;
  padding: 48px 40px 80px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============ FORM ELEMENTS ============ */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color-muted);
  background: var(--background-input);
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  direction: rtl;
}

.form-group input::placeholder { color: var(--text-disabled); }

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group select option { background: var(--background-deep); }

/* ============ BUTTONS ============ */
.btn-live {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-pill);
  border: none;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-start {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  color: var(--text-light);
  box-shadow: 0 4px 18px var(--primary-glow);
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

.btn-stop {
  background: var(--background-input);
  border: 1.5px solid var(--border-color-muted);
  color: var(--text-secondary);
}
.btn-stop:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.btn-create {
  background: var(--primary-color);
  color: var(--text-light);
  box-shadow: 0 4px 18px var(--primary-glow);
}
.btn-create:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

/* ============ STREAM KEY DISPLAY ============ */
.stream-key-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  direction: ltr;
}

.stream-key-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--primary-color);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-key {
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--primary-color);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
  font-family: var(--font-body);
}
.btn-copy-key:hover {
  background: var(--primary-color);
  color: var(--text-light);
}

/* ============ PREVIEW PLAYER ============ */
.preview-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.preview-player video { width: 100%; height: 100%; object-fit: cover; }

.preview-label {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ============ OBS STATUS ============ */
.obs-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--background-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.obs-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-disabled);
  transition: background var(--transition-base);
}
.obs-dot.connected    { background: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.obs-dot.disconnected { background: var(--text-disabled); }

.obs-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============ CARDS ============ */
.dash-card {
  background: var(--background-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}

.dash-card-title {
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 16px;
}

/* ============ STREAMS TABLE ============ */
.streams-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.streams-table thead th {
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-color);
  font-weight: 600;
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.streams-table tbody tr {
  background: var(--background-input);
  transition: background var(--transition-base);
}
.streams-table tbody tr:hover { background: rgba(229, 57, 53, 0.05); }

.streams-table tbody td {
  padding: 12px;
  font-size: 0.88rem;
  color: var(--text-light);
  vertical-align: middle;
  border-top: 1px solid var(--border-color-soft);
  text-align: right;
}

/* ── Status badges ── */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid rgba(229, 57, 53, 0.3);
  color: var(--primary-color);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 800;
}

.badge-ended {
  background: var(--accent-subtle);
  border: 1px solid var(--border-color-muted);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-offline {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--color-warning);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ============ FILTER BAR ============ */
#streamsFilterBar input:focus,
#streamsFilterBar select:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
#streamsFilterBar input::placeholder { color: var(--text-disabled); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--background-deep); }
::-webkit-scrollbar-thumb { background: rgba(229, 57, 53, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(229, 57, 53, 0.55); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .dashboard-live-page { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .dash-content { margin-left: 0; padding: 28px 20px; }
}

@media (max-width: 768px) {
  .live-page { padding: 40px 20px 60px; }
  .share-buttons { flex-direction: column; }
  .share-btn { justify-content: center; }
}
