/* =========================================================
   ElFannPlus – Home Page CSS
   Dark theme | Masonry Grid | Hover animations
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@400;600;700;800&display=swap');

/* =========================================================
   HOVER AUTOPLAY PREVIEW
   ========================================================= */

.vcard-preview {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;     /* let clicks pass through to the <a> */
  border-radius: inherit;
  overflow: hidden;
  opacity: 0;
  transition: opacity .35s ease;
}

.vcard-preview.ready { opacity: 1; }

/* YouTube iframe */
.vcard-preview iframe {
  position: absolute;
  /* push iframe edges outward so the YT controls bar / title bar stay hidden */
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  border: none;
  pointer-events: none;
}

/* MP4 video */
.vcard-preview video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Thin gradient at the bottom so card info is still readable */
.vcard-preview::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  pointer-events: none;
}

/* While preview is loading show a shimmer over the thumbnail */
.vcard-preview-loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: linear-gradient(90deg,
    rgba(255,255,255,0)   0%,
    rgba(255,255,255,.06) 50%,
    rgba(255,255,255,0)   100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer { to { background-position: -200% 0; } }

:root {
  --bg-primary:   #0a0a0f;
  --bg-secondary: #111118;
  --bg-card:      #16161f;
  --bg-card-hover:#1e1e2a;
  --border:       #252535;
  --text-primary: #f0f0f5;
  --text-secondary:#9898b0;
  --accent:       #7c3aed;
  --accent-2:     #a855f7;
  --accent-glow:  rgba(124,58,237,.35);
  --red:          #ef4444;
  --amber:        #f59e0b;
  --radius-card:  14px;
  --radius-badge: 6px;
  --transition:   .25s cubic-bezier(.4,0,.2,1);
  --font-en:      'Inter', sans-serif;
  --font-ar:      'Cairo', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-en);
  min-height: 100vh;
  overflow-x: hidden;
}

body[dir="rtl"] { font-family: var(--font-ar); }

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

img { display: block; max-width: 100%; }

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* =========================================================
   NAVBAR
   ========================================================= */
.fp-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.fp-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.fp-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.fp-search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.fp-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 20px 10px 44px;
  color: var(--text-primary);
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.fp-search::placeholder { color: var(--text-secondary); }
.fp-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.fp-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: .85rem;
}

body[dir="rtl"] .fp-search { padding: 10px 44px 10px 20px; }
body[dir="rtl"] .fp-search-icon { left: auto; right: 16px; }

.fp-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

body[dir="rtl"] .fp-nav-actions { margin-left: 0; margin-right: auto; }

.fp-lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.fp-lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================
   HERO BANNER
   ========================================================= */
.fp-hero {
  position: relative;
  overflow: hidden;
  padding: 40px 24px 50px;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,.18) 0%, transparent 70%);
}

.fp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%237c3aed' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.fp-hero-content { position: relative; z-index: 1; }

.fp-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fp-hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* =========================================================
   SECTION WRAPPER
   ========================================================= */
.fp-section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.fp-section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fp-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
  border-radius: 4px;
  flex-shrink: 0;
}

/* =========================================================
   TOP CATEGORIES
   ========================================================= */
.cat-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-radius: 50px;
  font-family: inherit;
  padding: 8px 18px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  background: var(--bg-card);
  border-color: var(--chip-color, var(--accent));
  color: var(--text-secondary);
}

.cat-chip:hover, .cat-chip.active {
  border-color: var(--chip-color, var(--accent));
  color: var(--chip-color, var(--accent));
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 12%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--chip-color, var(--accent)) 30%, transparent);
}

.cat-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent));
  flex-shrink: 0;
}

/* =========================================================
   FILTER TABS
   ========================================================= */
.fp-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.fp-filter-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-family: inherit;
  padding: 7px 18px;
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.fp-filter-btn:hover, .fp-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* =========================================================
   MASONRY GRID
   ========================================================= */
.vgrid {
  columns: 4 280px;
  column-gap: 16px;
}

@media (max-width: 1200px) { .vgrid { columns: 3 240px; } }
@media (max-width: 768px)  { .vgrid { columns: 2 180px; } }
@media (max-width: 480px)  { .vgrid { columns: 1; } }

/* =========================================================
   VIDEO CARD
   ========================================================= */
.vcard {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: block;
}

.vcard:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 50px rgba(0,0,0,.55), 0 0 0 1px var(--accent);
  border-color: var(--accent);
}

.vcard-link { display: block; }

/* Thumbnail wrapper */
.vcard-thumb-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: #0d0d14;
}

/* Short type – portrait ratio */
.vcard[data-type="short"] .vcard-thumb-wrap {
  aspect-ratio: 9/16;
}

.vcard-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s cubic-bezier(.4,0,.2,1);
}

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

/* Gradient overlay */
.vcard-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.1) 50%, transparent 100%);
  opacity: .7;
  transition: opacity var(--transition);
}

.vcard:hover .vcard-overlay { opacity: 1; }

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

.vcard-play i {
  width: 52px;
  height: 52px;
  background: rgba(124,58,237,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 28px var(--accent-glow);
  backdrop-filter: blur(4px);
}

.vcard:hover .vcard-play { opacity: 1; }

/* Duration badge */
.vcard-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(8px);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}

body[dir="rtl"] .vcard-duration { right: auto; left: 10px; }

/* Featured star */
.card-featured {
  position: absolute;
  top: 10px;
  left: 10px;
  color: var(--amber);
  font-size: .85rem;
  background: rgba(0,0,0,.65);
  padding: 3px 7px;
  border-radius: 5px;
}

body[dir="rtl"] .card-featured { left: auto; right: 10px; }

/* Short badge */
.card-type-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 5px;
  padding: 3px 8px;
  color: #fff;
  backdrop-filter: blur(8px);
}

body[dir="rtl"] .card-type-badge { right: auto; left: 10px; }

.card-type-badge.short { background: rgba(239,68,68,.85); }

/* Info section */
.vcard-info {
  padding: 12px 14px 14px;
}

.vcard-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition);
}

.vcard:hover .vcard-title { color: var(--accent-2); }

.vcard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.vcard-cat {
  font-size: .74rem;
  font-weight: 700;
  border-radius: var(--radius-badge);
  padding: 3px 9px;
  color: var(--cat-color, var(--accent));
  background: color-mix(in srgb, var(--cat-color, var(--accent)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--accent)) 30%, transparent);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.vcard-views {
  font-size: .73rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================================
   INFINITE SCROLL LOADER
   ========================================================= */
#load-sentinel {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fp-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.fp-end-msg {
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 500;
  padding: 20px;
  text-align: center;
}

/* =========================================================
   CARD ENTRANCE ANIMATION
   ========================================================= */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.vcard {
  animation: cardIn .4s var(--transition) both;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.fp-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.fp-empty i { font-size: 3rem; margin-bottom: 16px; opacity: .4; }

/* =========================================================
   FOOTER
   ========================================================= */
.fp-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 28px 24px;
  color: var(--text-secondary);
  font-size: .82rem;
}

.fp-footer a { color: var(--accent-2); }

/* =========================================================
   RESPONSIVE MISC
   ========================================================= */
@media (max-width: 640px) {
  .fp-hero { padding: 50px 20px 60px; }
  .fp-hero h1 { font-size: 1.8rem; }
  .fp-nav-inner { padding: 0 16px; }
  .fp-section { padding: 0 16px 48px; }
}

/* =========================================================
   LIGHTBOX PLAYER  (Sprint 10)
   ========================================================= */

/* ── Backdrop ────────────────────────────────────────────── */
#lb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  padding: 20px;
}

#lb-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Shell ───────────────────────────────────────────────── */
#lb-shell {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 92vh;
  display: flex;
  flex-direction: row;
  gap: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #0e0e16;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 40px 100px rgba(0,0,0,.7), 0 0 0 1px rgba(124,58,237,.2);
  transform: scale(.95) translateY(20px);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  opacity: 0;
}

#lb-backdrop.open #lb-shell {
  transform: none;
  opacity: 1;
}

/* ── Player side ─────────────────────────────────────────── */
#lb-player-side {
  flex: 1 1 60%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

#lb-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

#lb-player-wrap.portrait { aspect-ratio: 9/16; max-height: 70vh; }

#lb-player-wrap iframe,
#lb-player-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Gradient hint at bottom of player */
#lb-player-wrap::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
  pointer-events: none;
}

/* Prev / Next arrow buttons */
.lb-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  border: 1.5px solid rgba(255,255,255,.15);
  color: #fff;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  backdrop-filter: blur(8px);
}

.lb-nav-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.1);
}

.lb-nav-btn:disabled {
  opacity: .25;
  cursor: not-allowed;
  pointer-events: none;
}

#lb-prev { left: 14px; }
#lb-next { right: 14px; }

/* ── Info side ───────────────────────────────────────────── */
#lb-info-side {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 24px;
  gap: 20px;
  border-left: 1px solid rgba(255,255,255,.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

#lb-info-side::-webkit-scrollbar { width: 4px; }
#lb-info-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

/* Category badge */
#lb-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-radius: 6px;
  padding: 4px 10px;
  width: fit-content;
}

/* Title */
#lb-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

/* Stats row */
#lb-stats {
  display: flex;
  gap: 20px;
  font-size: .8rem;
  color: var(--text-secondary);
}

#lb-stats span { display: flex; align-items: center; gap: 5px; }

/* Description */
#lb-description {
  font-size: .87rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-line;
  flex: 1;
}

/* Action buttons row */
.lb-action-btn {
  flex: 1 1 calc(33% - 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}


.lb-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124,58,237,.12);
}

.lb-action-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.lb-action-btn.liked {
  background: rgba(239,68,68,.15);
  border-color: var(--red);
  color: var(--red);
}

.lb-action-btn.icon-only {
  padding: 12px;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}

#lb-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ── Close button ────────────────────────────────────────── */
#lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  border: 1.5px solid rgba(255,255,255,.15);
  color: #fff;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}

#lb-close:hover {
  background: var(--red);
  border-color: var(--red);
  transform: rotate(90deg);
}

/* ── Loading skeleton inside lightbox ───────────────────── */
#lb-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: linear-gradient(135deg, #111118 0%, #1a1a28 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .3s;
}

#lb-skeleton .lb-spin {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Share toast ─────────────────────────────────────────── */
#lb-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e1e2e;
  border: 1px solid var(--accent);
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 50px;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  white-space: nowrap;
}

#lb-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive: mobile stacked ─────────────────────────── */
@media (max-width: 860px) {
  #lb-shell {
    flex-direction: column;
    max-height: 95vh;
    border-radius: 14px;
  }

  #lb-info-side {
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 18px 16px;
    max-height: 42vh;
  }

  #lb-title { font-size: 1rem; }

  .lb-nav-btn { width: 38px; height: 38px; font-size: .85rem; }

  /* Stack actions vertically on the left side of the player */
  #lb-actions {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 12px;
    border: none;
    padding: 0;
    z-index: 50;
  }

  /* Move prev/next down so they don't overlap with actions */
  #lb-prev, #lb-next {
    top: auto;
    bottom: 30px;
    transform: none;
  }
  #lb-prev { left: calc(50% - 60px); }
  #lb-next { right: calc(50% - 60px); }

  body[dir="rtl"] #lb-actions {
    left: auto;
    right: 12px;
  }

  .lb-action-btn.icon-only {
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    flex: 0 0 44px; /* Ensure flex sizing doesn't override */
  }

  .lb-action-btn.icon-only:hover {
    background: var(--accent);
  }
}

@media (max-width: 480px) {
  #lb-backdrop { padding: 10px; }
  
  #lb-actions {
    left: 8px; /* Slightly closer to edge on very small screens */
  }
  body[dir="rtl"] #lb-actions {
    left: auto;
    right: 8px;
  }
}

/* ── Search Highlight ── */
mark {
    background-color: rgba(124, 58, 237, 0.4);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
}


.fp-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); color: #fff; margin-right: 8px; text-decoration: none; border: none; cursor: pointer; transition: background 0.2s; }
.fp-icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
