/* ============================================================
   RAMALLAH DIGITAL — BRAND COLOR SYSTEM
   Primary: Red #C5232D | Dark: #4A5568 | Black: #0A0A0A
   ============================================================ */
:root {
  --brand:       #C5232D;
  --brand-light: #E8404A;
  --brand-dim:   #7A1218;
  --brand-glow:  rgba(197, 35, 45, 0.25);
  --border:      rgba(197, 35, 45, 0.18);
}

/* =========================================
   YouTube Video Gallery — Premium Dark UI
   Inspired by DailyMotion & YouTube
========================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&family=IBM+Plex+Sans+Arabic:wght@400;500;700&display=swap');

:root {
  --yt-bg: #0f0f0f;
  --yt-surface: #1a1a1a;
  --yt-card: #212121;
  --yt-card-hover: #272727;
  --yt-border: #2e2e2e;
  --yt-accent: #ff0000;
  --yt-accent-soft: rgba(255, 0, 0, 0.12);
  --yt-accent2: #ff4444;
  --yt-text: #f1f1f1;
  --yt-text-muted: #aaaaaa;
  --yt-text-faint: #717171;
  --yt-radius: 12px;
  --yt-radius-sm: 8px;
  --yt-shadow: 0 4px 20px rgba(0,0,0,0.4);
  --yt-shadow-hover: 0 8px 40px rgba(0,0,0,0.6);
  --yt-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-ar: 'Cairo', 'IBM Plex Sans Arabic', sans-serif;
}

/* ==============================
   Base Section
============================== */
.yt-gallery-section {
  background: var(--yt-bg);
  min-height: 100vh;
  padding: 60px 0 80px;
  font-family: var(--font-ar);
  direction: rtl;
}

.yt-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==============================
   Header
============================== */
.yt-header {
  text-align: center;
  margin-bottom: 48px;
}

.yt-main-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  color: var(--yt-text);
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #ff4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.yt-subtitle {
  font-size: 1.05rem;
  color: var(--yt-text-muted);
  margin: 0 0 32px;
}

/* ==============================
   Search Bar
============================== */
.yt-search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 700px;
  margin: 0 auto;
}

.yt-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.yt-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--yt-text-faint);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.yt-search-input {
  width: 100%;
  padding: 12px 46px 12px 16px;
  background: var(--yt-surface);
  border: 1.5px solid var(--yt-border);
  border-radius: 50px;
  color: var(--yt-text);
  font-size: 0.95rem;
  font-family: var(--font-ar);
  outline: none;
  transition: border-color var(--yt-transition), box-shadow var(--yt-transition);
  box-sizing: border-box;
}

.yt-search-input:focus {
  border-color: var(--yt-accent);
  box-shadow: 0 0 0 3px var(--yt-accent-soft);
}

.yt-filter-select {
  padding: 12px 16px;
  background: var(--yt-surface);
  border: 1.5px solid var(--yt-border);
  border-radius: 50px;
  color: var(--yt-text);
  font-family: var(--font-ar);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--yt-transition);
}

.yt-filter-select:focus {
  border-color: var(--yt-accent);
}

.yt-search-btn {
  padding: 12px 28px;
  background: var(--yt-accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-ar);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--yt-transition), transform var(--yt-transition);
  white-space: nowrap;
}

.yt-search-btn:hover {
  background: var(--yt-accent2);
  transform: translateY(-1px);
}

/* ==============================
   Stats Bar
============================== */
.yt-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 0 4px;
}

.yt-total-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--yt-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.yt-total-count svg {
  stroke: var(--yt-accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.yt-search-result-tag {
  background: var(--yt-accent-soft);
  color: var(--yt-accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255,0,0,0.2);
}

/* ==============================
   Video Grid
============================== */
.yt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1200px) { .yt-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .yt-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .yt-grid { grid-template-columns: 1fr; gap: 14px; } }

/* ==============================
   Video Card
============================== */
.yt-card {
  background: var(--yt-card);
  border-radius: var(--yt-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--yt-transition), box-shadow var(--yt-transition), background var(--yt-transition);
  border: 1px solid var(--yt-border);
  display: flex;
  flex-direction: column;
}

.yt-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--yt-shadow-hover);
  background: var(--yt-card-hover);
  border-color: #3e3e3e;
}

/* Thumbnail */
.yt-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.yt-card:hover .yt-thumb {
  transform: scale(1.06);
}

/* Play Overlay */
.yt-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--yt-transition);
}

.yt-card:hover .yt-overlay {
  opacity: 1;
}

.yt-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.yt-play-btn {
  position: relative;
  z-index: 2;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 0, 0, 0.92);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 20px rgba(255,0,0,0.5);
  backdrop-filter: blur(4px);
}

.yt-play-btn svg {
  fill: #fff;
  width: 22px;
  height: 22px;
  margin-right: -2px;
}

.yt-card:hover .yt-play-btn {
  transform: scale(1.12);
  background: #ff0000;
}

/* Category Badge */
.yt-category-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.75);
  color: var(--yt-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Card Info */
.yt-card-info {
  padding: 14px 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.yt-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--yt-text);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--yt-transition);
}

.yt-card:hover .yt-card-title {
  color: #fff;
}

.yt-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.yt-date {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--yt-text-faint);
  font-size: 0.8rem;
}

.yt-date svg {
  stroke: var(--yt-text-faint);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.yt-yt-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,0,0,0.1);
  transition: background var(--yt-transition);
}

.yt-yt-link svg {
  fill: var(--yt-accent);
  width: 16px;
  height: 16px;
}

.yt-yt-link:hover {
  background: rgba(255,0,0,0.25);
}

/* ==============================
   Empty State
============================== */
.yt-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--yt-text-muted);
}

.yt-empty-icon {
  margin-bottom: 20px;
}

.yt-empty-icon svg {
  width: 64px;
  height: 64px;
  stroke: var(--yt-border);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.yt-empty h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--yt-text-muted);
  margin-bottom: 8px;
}

.yt-empty p {
  font-size: 1rem;
  color: var(--yt-text-faint);
}

/* ==============================
   Pagination
============================== */
.yt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 56px;
  flex-wrap: wrap;
}

.yt-page-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--yt-surface);
  color: var(--yt-text);
  text-decoration: none;
  border-radius: 8px;
  font-family: var(--font-ar);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--yt-border);
  transition: background var(--yt-transition), border-color var(--yt-transition);
}

.yt-page-btn svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.yt-page-btn:hover {
  background: var(--yt-card);
  border-color: var(--yt-accent);
  color: var(--yt-accent);
}

.yt-page-numbers {
  display: flex;
  gap: 6px;
}

.yt-page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--yt-surface);
  color: var(--yt-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--yt-border);
  transition: background var(--yt-transition), border-color var(--yt-transition), color var(--yt-transition);
}

.yt-page-num:hover,
.yt-page-num.active {
  background: var(--yt-accent);
  border-color: var(--yt-accent);
  color: #fff;
}

/* ==============================
   Modal
============================== */
.yt-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.yt-modal.open {
  opacity: 1;
  pointer-events: all;
}

.yt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.yt-modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid #2e2e2e;
}

.yt-modal.open .yt-modal-box {
  transform: scale(1) translateY(0);
}

.yt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2e2e2e;
  gap: 16px;
}

.yt-modal-title {
  color: var(--yt-text);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-modal-close {
  background: #2e2e2e;
  border: none;
  color: var(--yt-text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--yt-transition);
}

.yt-modal-close:hover {
  background: var(--yt-accent);
}

.yt-modal-close svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  width: 18px;
  height: 18px;
}

.yt-modal-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.yt-modal-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ==============================
   Card entrance animation
============================== */
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.yt-card {
  animation: cardFadeIn 0.4s ease both;
}

.yt-card:nth-child(1)  { animation-delay: 0.05s; }
.yt-card:nth-child(2)  { animation-delay: 0.10s; }
.yt-card:nth-child(3)  { animation-delay: 0.15s; }
.yt-card:nth-child(4)  { animation-delay: 0.20s; }
.yt-card:nth-child(5)  { animation-delay: 0.25s; }
.yt-card:nth-child(6)  { animation-delay: 0.30s; }
.yt-card:nth-child(7)  { animation-delay: 0.35s; }
.yt-card:nth-child(8)  { animation-delay: 0.40s; }
.yt-card:nth-child(n+9){ animation-delay: 0.45s; }

/* ==============================
   Subcategory Filter
============================== */
.yt-subcat-select {
  border-color: var(--yt-accent) !important;
  background: rgba(255, 0, 0, 0.06) !important;
  color: #ffaaaa !important;
  position: relative;
}

.yt-subcat-select option {
  background: var(--yt-surface);
  color: var(--yt-text);
}

@keyframes subCatFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Subcategory badge — لون مختلف عن الرئيسية */
.yt-subcategory-badge {
  background: rgba(255, 80, 0, 0.82) !important;
  border-color: rgba(255, 130, 0, 0.3) !important;
}

/* ==============================
   Responsive tweaks
============================== */
@media (max-width: 600px) {
  .yt-gallery-section { padding: 36px 0 60px; }
  .yt-main-title { font-size: 1.6rem; }
  .yt-search-bar { gap: 8px; }
  .yt-modal-box { border-radius: 12px; }
  .yt-modal-title { font-size: 0.9rem; }
}