/* ══════════════════════════════════════════
   ROOT & RESET
══════════════════════════════════════════ */
:root {
  --bg: #0b1220;
  --bg-soft: #121b2e;
  --card: rgba(18,27,46,0.72);
  --text: #eef2ff;
  --muted: #b7c3e0;
  --brand: #6d8dff;
  --brand-2: #53e0c2;
  --accent: #ff7edb;
  --border: rgba(255,255,255,0.14);
  --shadow: 0 20px 40px rgba(8,12,22,0.45);
  --radius: 18px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "Cairo","Tajawal","Segoe UI",Tahoma,sans-serif;
  font-size: 16px;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%,#172340 0%,var(--bg) 45%,#080d18 100%);
  min-height: 100%;
  scroll-behavior: smooth;
  direction: rtl; text-align: right;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; }
.container { width: min(1140px, 92%); margin: 0 auto; }

/* ══════════════════════════════════════════
   BACKGROUND EFFECTS
══════════════════════════════════════════ */
.bg-orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.28; animation: orbDrift 12s ease-in-out infinite; }
.orb-1 { width: 520px; height: 520px; background: radial-gradient(circle,#6d8dff 0%,transparent 70%); top: -120px; left: -100px; animation-duration: 14s; }
.orb-2 { width: 400px; height: 400px; background: radial-gradient(circle,#53e0c2 0%,transparent 70%); bottom: 10%; right: -80px; animation-duration: 18s; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle,#ff7edb 0%,transparent 70%); top: 55%; left: 40%; animation-duration: 22s; animation-delay: -10s; opacity: 0.14; }
@keyframes orbDrift {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-40px) scale(1.06); }
  66%      { transform: translate(-20px,20px) scale(0.96); }
}
#particles-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.45; }

/* ══════════════════════════════════════════
   SHARED COMPONENTS
══════════════════════════════════════════ */
.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.tag {
  display: inline-block; font-size: 0.78rem; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--brand-2);
  background: rgba(83,224,194,0.1); border: 1px solid rgba(83,224,194,0.25);
  padding: 3px 10px; border-radius: 999px; font-weight: 700;
}
.btn {
  border: 1px solid var(--border); padding: 12px 20px; border-radius: 12px;
  font-weight: 700; font-family: inherit; font-size: 0.95rem;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { background: linear-gradient(135deg,var(--brand),#4fcbf4); color: #fff; border: none; }
.gradient-text {
  background: linear-gradient(120deg,var(--brand),var(--brand-2),var(--accent));
  background-size: 200%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shiftGradient 4s ease infinite;
}
@keyframes shiftGradient { 0%,100%{background-position:0% 50%;} 50%{background-position:100% 50%;} }
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.is-visible { opacity: 1; transform: translateY(0); transition: opacity 0.7s ease, transform 0.7s ease; }

/* ══════════════════════════════════════════
   VIDEO PLAYER PAGE
══════════════════════════════════════════ */
.vp-main { padding: 32px 0 70px; min-height: 100vh; }

/* Breadcrumb */
.vp-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--muted); margin-bottom: 22px; flex-wrap: wrap; }
.vp-breadcrumb a { color: var(--muted); transition: color 0.2s; }
.vp-breadcrumb a:hover { color: var(--brand); }
.vp-breadcrumb__sep { color: rgba(255,255,255,0.2); }

/* Grid layout */
.vp-layout { display: grid; grid-template-columns: minmax(0,1fr) 365px; gap: 26px; align-items: start; direction: ltr; }
.vp-player-col, .vp-sidebar { min-width: 0; direction: rtl; }
.vp-player-col { display: flex; flex-direction: column; gap: 18px; }

/* Video frame */
.vp-frame-wrap {
  position: relative; border-radius: 22px; overflow: hidden;
  background: #050a14; border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(109,141,255,0.1), 0 24px 54px rgba(0,0,0,0.52);
  animation: vpFrameReveal 0.65s cubic-bezier(0.2,0,0,1) both;
  scroll-margin-top: 104px;
}
@keyframes vpFrameReveal { from{opacity:0;transform:translateY(28px) scale(0.98);} to{opacity:1;transform:translateY(0) scale(1);} }
/*
  Clean Google Drive embed — hides the top toolbar & bottom controls
  by making the iframe larger than its clipping container.
  --vp-embed-scale  : how much BIGGER than 100% the iframe is
  --vp-embed-nudge-y: shifts the video down slightly to re-centre it
                      (top bar is taller than bottom bar)
*/
.vp-frame-inner {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
  overflow: hidden;
  --vp-embed-scale:   1.18;   /* hides Google Drive top toolbar */
  --vp-embed-nudge-y: 4%;     /* shifts iframe down to keep video centred */
}
.vp-frame-inner iframe {
  position: absolute;
  top:  50%;
  left: 50%;
  width:  calc(100% * var(--vp-embed-scale));
  height: calc(100% * var(--vp-embed-scale));
  border: none;
  transform: translate(-50%, calc(-50% + var(--vp-embed-nudge-y)));
  transform-origin: center center;
}

/* Bottom bar mask — solid colour matching the frame background,
   sits on top of the iframe so the controls are never visible     */
.vp-frame-inner::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;                /* desktop controls bar height      */
  background: transparent;         /* invisible mask */
  z-index: 6;                  /* above loading overlay (z:4) and JS blocker (z:5) */
  pointer-events: none;        /* clicks pass through to iframe    */
}

@media (max-width: 820px) {
  .vp-frame-inner {
    --vp-embed-scale: 1.22;
    --vp-embed-nudge-y: 4%;
  }
  .vp-frame-inner::after { height: 50px; }
}

@media (max-width: 560px) {
  .vp-frame-inner {
    --vp-embed-scale: 1.28;
    --vp-embed-nudge-y: 4.5%;
  }
  .vp-frame-inner::after { height: 44px; }
}

/* Loading overlay */
.vp-loading-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(5,10,20,0.9); color: var(--muted); font-size: 0.87rem;
  z-index: 4; transition: opacity 0.5s ease; pointer-events: none;
}
.vp-loading-overlay.hidden { opacity: 0; }
.vp-spinner { width: 42px; height: 42px; border: 3px solid rgba(109,141,255,0.15); border-top-color: var(--brand); border-right-color: var(--brand-2); border-radius: 50%; animation: vpSpin 0.8s linear infinite; }
@keyframes vpSpin { to { transform: rotate(360deg); } }

/* Progress bar */
.vp-progress-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  overflow: visible;
}
.vp-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg,var(--brand),var(--brand-2)); border-radius: 0 999px 999px 0; transition: width 0.1s linear; }
.vp-progress-thumb {
  position: absolute; top: 50%; right: calc(var(--progress,0%) - 6px);
  transform: translateY(-50%) scale(0); width: 14px; height: 14px;
  border-radius: 50%; background: var(--brand); box-shadow: 0 0 10px rgba(109,141,255,0.9);
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.vp-progress-track:hover .vp-progress-thumb { opacity: 1; transform: translateY(-50%) scale(1); }

/* Meta panel */
.vp-meta {
  margin-top: 0;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015)),
    var(--card);
  box-shadow: 0 18px 42px rgba(5,10,20,0.28);
}
.vp-meta__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.vp-meta__tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vp-live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(83,224,194,0.12); border: 1px solid rgba(83,224,194,0.3); color: var(--brand-2); font-size: 0.78rem; font-weight: 700; }
.vp-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); animation: vpPulse 1.6s ease-in-out infinite; }
@keyframes vpPulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.5;transform:scale(1.4);} }
.vp-meta__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vp-action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.035);
  color: var(--muted); font-size: 0.78rem; font-weight: 700;
  font-family: inherit; transition: all 0.2s; white-space: nowrap; min-height: 38px;
}
.vp-action-btn svg { flex-shrink: 0; }
.vp-action-btn:hover { background: rgba(109,141,255,0.12); border-color: rgba(109,141,255,0.4); color: var(--text); transform: translateY(-1px); }
.vp-action-btn.active { background: rgba(109,141,255,0.18); border-color: rgba(109,141,255,0.5); color: var(--brand); }
.vp-title { font-size: clamp(1.18rem,2vw,1.58rem); font-weight: 800; line-height: 1.4; margin: 0 0 16px; color: var(--text); }
.vp-info-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.vp-instructor { display: flex; align-items: center; gap: 12px; }
.vp-instructor__avatar { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg,var(--brand),var(--brand-2)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; color: #fff; flex-shrink: 0; box-shadow: 0 10px 22px rgba(83,224,194,0.18); }
.vp-instructor__name { display: block; font-weight: 700; font-size: 0.94rem; }
.vp-instructor__role { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.vp-stats-mini { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.vp-stats-mini span { display: inline-flex; align-items: center; gap: 5px; }
.vp-desc-wrap { margin-bottom: 16px; }
.vp-desc { color: var(--muted); font-size: 0.92rem; line-height: 1.8; margin: 0; overflow: hidden; max-height: 3.6em; transition: max-height 0.5s ease; }
.vp-desc.expanded { max-height: 400px; }
.vp-desc-toggle { background: none; border: none; color: var(--brand); font-size: 0.84rem; font-weight: 700; padding: 4px 0; margin-top: 4px; font-family: inherit; transition: color 0.2s; }
.vp-desc-toggle:hover { color: var(--brand-2); }
.vp-tags-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }

/* Section titles */
.vp-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.vp-section-title { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; font-weight: 800; margin: 0; }
.vp-section-count { font-size: 0.78rem; color: var(--brand-2); background: rgba(83,224,194,0.1); border: 1px solid rgba(83,224,194,0.2); padding: 3px 10px; border-radius: 999px; font-weight: 600; }

/* Sidebar */
.vp-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 115px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015)),
    var(--card);
  box-shadow: 0 18px 42px rgba(5,10,20,0.24);
  scrollbar-width: thin;
  scrollbar-color: rgba(109,141,255,0.3) transparent;
}
.vp-sidebar::-webkit-scrollbar { width: 4px; }
.vp-sidebar::-webkit-scrollbar-thumb { background: rgba(109,141,255,0.3); border-radius: 2px; }
.vp-sidebar__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

/* Filter pills */
.vp-filter-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.vp-pill { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--muted); font-size: 0.78rem; font-weight: 600; font-family: inherit; transition: all 0.2s; }
.vp-pill:hover { border-color: rgba(109,141,255,0.4); color: var(--text); }
.vp-pill.active { background: linear-gradient(135deg,rgba(109,141,255,0.25),rgba(83,224,194,0.15)); border-color: rgba(109,141,255,0.5); color: var(--text); }

/* Rec cards */
.vp-rec-list { display: flex; flex-direction: column; gap: 10px; }
.vp-rec-card {
  display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 12px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card);
  cursor: pointer; transition: all 0.25s; position: relative; overflow: hidden;
  animation: vpCardIn 0.4s ease both;
}
.vp-rec-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg,rgba(109,141,255,0.07),transparent); opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.vp-rec-card:hover { border-color: rgba(109,141,255,0.5); transform: translateX(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.28), 4px 0 0 rgba(109,141,255,0.4) inset; }
.vp-rec-card:hover::before { opacity: 1; }
.vp-rec-card.active { border-color: rgba(109,141,255,0.7); background: rgba(109,141,255,0.1); box-shadow: 4px 0 0 var(--brand) inset; }
@keyframes vpCardIn { from{opacity:0;transform:translateY(14px);} to{opacity:1;transform:translateY(0);} }
.vp-rec-thumb { position: relative; aspect-ratio: 16/9; border-radius: 9px; overflow: hidden; background: #080d18; }
.vp-rec-thumb__overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.4); opacity: 0; transition: opacity 0.25s; }
.vp-rec-card:hover .vp-rec-thumb__overlay, .vp-rec-card.active .vp-rec-thumb__overlay { opacity: 1; }
.vp-play-icon { width: 28px; height: 28px; border-radius: 50%; background: rgba(109,141,255,0.85); display: flex; align-items: center; justify-content: center; }
.vp-play-icon svg { fill: #fff; margin-right: -1px; }
.vp-rec-duration { position: absolute; bottom: 5px; left: 6px; font-size: 0.67rem; font-weight: 700; background: rgba(0,0,0,0.78); color: #fff; padding: 2px 6px; border-radius: 4px; }
.vp-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.vp-rec-body { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.vp-rec-title { font-size: 0.84rem; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; }
.vp-rec-meta { display: flex; flex-direction: column; gap: 3px; }
.vp-rec-instructor { font-size: 0.73rem; color: var(--brand-2); font-weight: 600; }
.vp-rec-views { font-size: 0.71rem; color: var(--muted); }
.vp-rec-category { display: inline-block; font-size: 0.67rem; padding: 2px 8px; border-radius: 999px; background: rgba(109,141,255,0.1); border: 1px solid rgba(109,141,255,0.2); color: var(--brand); font-weight: 600; margin-top: 4px; align-self: flex-start; }

/* Toast */
.vp-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg-soft); border: 1px solid rgba(109,141,255,0.4); color: var(--text); padding: 12px 26px; border-radius: 12px; font-size: 0.88rem; font-weight: 600; box-shadow: 0 12px 36px rgba(0,0,0,0.55); opacity: 0; pointer-events: none; z-index: 9999; transition: opacity 0.3s, transform 0.3s; white-space: nowrap; }
.vp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 1024px) { .vp-layout { grid-template-columns: minmax(0,1fr) 300px; gap: 18px; } }
@media (max-width: 820px) {
  .vp-layout { grid-template-columns: 1fr; }
  .vp-main > .container { width: min(1140px, 100%); }
  .vp-player-col { order: -1; }
  .vp-sidebar {
    position: static;
    max-height: none;
    order: 0;
    padding: 14px;
    border-radius: 18px;
  }
  .vp-frame-wrap { border-radius: 0; border-left: 0; border-right: 0; }
  .vp-meta,
  .vp-breadcrumb,
  .vp-sidebar { width: min(1140px, 92%); margin-left: auto; margin-right: auto; }
  .vp-rec-list { display: grid; grid-template-columns: repeat(2,1fr); }
  .vp-rec-card { grid-template-columns: 1fr; }
  .vp-rec-thumb { width: 100%; }
}
@media (max-width: 560px) {
  .vp-rec-list { grid-template-columns: 1fr; }
  .vp-rec-card { grid-template-columns: 90px 1fr; }
  .vp-meta {
    padding: 16px 14px 18px;
    border-radius: 18px;
  }
  .vp-meta__top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .vp-title {
    font-size: 1.04rem;
    line-height: 1.5;
    margin-bottom: 12px;
  }
  .vp-info-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
  }
  .vp-stats-mini { justify-content: flex-start; gap: 12px; }
  .vp-meta__actions {
    width: calc(100% + 4px);
    margin-inline: -2px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .vp-meta__actions::-webkit-scrollbar { display: none; }
  .vp-action-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 8px 12px;
    font-size: 0.74rem;
    gap: 5px;
  }
}
@keyframes fadeUp { from{opacity:0;transform:translateY(18px);} to{opacity:1;transform:translateY(0);} }