/* =========================================================================
   FilmyFly Movies — front-end styles
   Grid (img 1/2), category header (img 2), single detail (img 3).
   Fully responsive: 6 cols -> 2 cols down the breakpoints.
   ========================================================================= */

:root{
  --ff-accent:#f5c518;
  --ff-card-bg:#ffffff;
  --ff-text:#12141d;
  --ff-muted:#7a8291;
  --ff-badge-bg:rgba(20,22,29,.82);
  --ff-radius:14px;
  --ff-shadow:0 6px 20px rgba(20,22,29,.08);
  --ff-shadow-hover:0 14px 30px rgba(20,22,29,.16);
}

/* ---------- GRID ---------- */
.ff-grid{
  display:grid;
  grid-template-columns:repeat(6, 1fr);
  gap:22px 18px;
  width:100%;
  margin:0 0 8px;
}

/* ---------- CARD ---------- */
.ff-card{ min-width:0; }
.ff-card__link{
  display:block;
  background:var(--ff-card-bg);
  border-radius:var(--ff-radius);
  overflow:hidden;
  box-shadow:var(--ff-shadow);
  text-decoration:none;
  color:var(--ff-text);
  transition:transform .18s ease, box-shadow .18s ease;
  height:100%;
}
.ff-card__link:hover{
  transform:translateY(-4px);
  box-shadow:var(--ff-shadow-hover);
}
.ff-poster{
  position:relative;
  width:100%;
  aspect-ratio:2 / 3;
  background:#e9ecf1;
  overflow:hidden;
}
.ff-poster__img{
  width:100%; height:100%;
  object-fit:cover; display:block;
}
.ff-poster__ph{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  padding:12px; text-align:center;
  color:#fff; font-weight:600; font-size:14px;
  background:linear-gradient(135deg,#2a2f3d,#151821);
}

/* badges */
.ff-badge{
  position:absolute;
  display:inline-flex; align-items:center; gap:4px;
  font-size:12px; font-weight:700; line-height:1;
  color:#fff; background:var(--ff-badge-bg);
  padding:5px 8px; border-radius:8px;
  backdrop-filter:blur(2px);
}
.ff-badge--rating{ top:8px; left:8px; }
.ff-badge--rating .ff-star{ color:var(--ff-accent); font-size:12px; }
.ff-badge--lang{
  top:8px; right:8px;
  font-size:10px; letter-spacing:.5px;
  background:rgba(20,22,29,.72);
}

/* meta */
.ff-meta{ padding:12px 12px 14px; }
.ff-title{
  margin:0 0 6px; font-size:15px; font-weight:700;
  line-height:1.3; color:var(--ff-text);
  display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical;
  overflow:hidden;
}
.ff-sub{ display:flex; align-items:center; gap:10px; font-size:13px; }
.ff-year{ color:var(--ff-muted); font-weight:600; }
.ff-genre{ color:var(--ff-accent); font-weight:600; }

/* section title / states */
.ff-section-title{ font-size:22px; font-weight:800; margin:0 0 18px; }
.ff-empty,.ff-error{
  padding:24px; border-radius:12px; background:#fff5f5;
  color:#b23b3b; font-weight:600; text-align:center;
}

/* ---------- CATEGORY PAGE HEADER (img 2) ---------- */
.ff-cat-header{ margin:0 0 26px; }
.ff-breadcrumb{ font-size:13px; color:var(--ff-muted); margin:0 0 14px; }
.ff-breadcrumb a{ color:var(--ff-muted); text-decoration:none; }
.ff-breadcrumb a:hover{ color:var(--ff-text); }
.ff-breadcrumb .sep{ margin:0 6px; opacity:.6; }
.ff-cat-title{ font-size:34px; font-weight:800; margin:0 0 10px; letter-spacing:-.5px; }
.ff-cat-sub{ font-size:16px; color:var(--ff-muted); margin:0 0 18px; max-width:720px; }
.ff-cat-sub b, .ff-cat-sub strong{ color:var(--ff-accent); }
.ff-cat-divider{ height:1px; background:#e7eaef; border:0; margin:0 0 26px; }
.ff-lede{ font-size:16px; color:var(--ff-muted); }

/* ============ SINGLE DETAIL PAGE (img 3) ============ */
.ff-detail{ color:var(--ff-text); }

/* hero */
.ff-hero{
  position:relative;
  background:#0d0f16;
  background-image:var(--ff-backdrop);
  background-size:cover; background-position:center 20%;
  color:#fff;
}
.ff-hero__overlay{
  position:absolute; inset:0;
  background:linear-gradient(90deg, rgba(11,13,20,.96) 0%, rgba(11,13,20,.82) 45%, rgba(11,13,20,.55) 100%);
}
.ff-hero__inner{
  position:relative;
  display:flex; gap:28px;
  max-width:1180px; margin:0 auto;
  padding:40px 20px;
}
.ff-hero__poster{ flex:0 0 200px; }
.ff-hero__poster img{
  width:200px; border-radius:12px; display:block;
  box-shadow:0 10px 30px rgba(0,0,0,.5);
}
.ff-hero__info{ flex:1; min-width:0; }
.ff-pills{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.ff-pill{
  font-size:12px; font-weight:600;
  padding:5px 12px; border-radius:999px;
  background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.18);
  color:#fff !important;
}
.ff-hero__title{ font-size:34px; font-weight:800; margin:0 0 6px; line-height:1.15; color:#fff !important; }
.ff-hero__year{ font-weight:400; opacity:.75; color:#fff !important; }
.ff-hero__tagline{ font-style:italic; margin:0 0 16px; font-size:16px; color:rgba(255,255,255,.82) !important; }
.ff-hero__meta{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.ff-chip{
  font-size:12px; font-weight:600;
  padding:4px 10px; border-radius:6px;
  background:rgba(255,255,255,.12);
  color:#fff !important;
}
.ff-hero__director{ font-size:14px; margin:0 0 18px; color:rgba(255,255,255,.9) !important; }
.ff-hero__director strong{ color:var(--ff-accent) !important; font-weight:700; }
.ff-btn{
  display:inline-flex; align-items:center; gap:8px;
  background:var(--ff-accent); color:#12141d;
  font-weight:700; font-size:14px;
  padding:11px 20px; border-radius:8px; text-decoration:none;
  transition:filter .15s ease;
}
.ff-btn:hover{ filter:brightness(.92); }

/* body layout */
.ff-body{
  display:grid; grid-template-columns:1fr 300px; gap:40px;
  max-width:1180px; margin:0 auto; padding:34px 20px;
}
.ff-h2{ font-size:22px; font-weight:800; margin:0 0 14px; }
.ff-main .ff-h2{ margin-top:8px; }
.ff-overview{ font-size:15px; line-height:1.7; color:#333a48; margin:0 0 26px; }

/* watch box */
.ff-watch-box{
  border:1px solid #e7eaef; border-radius:12px;
  padding:16px 18px; margin:0 0 30px; background:#fbfcfe;
}
.ff-watch-box__head{
  display:flex; align-items:center; gap:10px;
  font-weight:700; margin:0 0 6px;
}
.ff-bar{ width:4px; height:18px; background:var(--ff-accent); border-radius:2px; }
.ff-watch-box__note{ margin:0; color:var(--ff-muted); font-size:14px; }
.ff-providers{ display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; }
.ff-provider img{ width:42px; height:42px; border-radius:9px; display:block; }

/* cast */
.ff-cast{
  display:grid; grid-template-columns:repeat(9, 1fr);
  gap:14px 10px;
}
.ff-cast__member{ text-align:center; min-width:0; }
.ff-cast__avatar{
  width:64px; height:64px; border-radius:50%;
  margin:0 auto 8px; overflow:hidden; background:#e9ecf1;
  display:flex; align-items:center; justify-content:center;
}
.ff-cast__avatar img{ width:100%; height:100%; object-fit:cover; }
.ff-cast__initials{ font-weight:700; color:#8a92a1; font-size:20px; }
.ff-cast__name{ font-size:12px; font-weight:700; margin:0 0 2px; line-height:1.2; }
.ff-cast__role{ font-size:11px; color:var(--ff-muted); margin:0; line-height:1.2; }

/* sidebar */
.ff-facts{
  border:1px solid #e7eaef; border-radius:12px; padding:16px 18px; margin:0 0 18px;
}
.ff-facts__head{ font-size:12px; letter-spacing:1px; text-transform:uppercase; color:var(--ff-muted); margin:0 0 12px; font-weight:700; }
.ff-facts p{ display:flex; justify-content:space-between; gap:10px; margin:0 0 10px; font-size:14px; }
.ff-facts__k{ color:var(--ff-muted); }
.ff-facts__v{ font-weight:700; text-align:right; }
.ff-keywords{ border:1px solid #e7eaef; border-radius:12px; padding:16px 18px; margin:0 0 18px; }
.ff-keywords__head{ font-size:12px; letter-spacing:1px; text-transform:uppercase; color:var(--ff-muted); margin:0 0 12px; font-weight:700; }
.ff-keywords__list{ display:flex; flex-wrap:wrap; gap:8px; }
.ff-kw{ font-size:12px; background:#eef1f6; color:#3a4252; padding:5px 10px; border-radius:6px; }
.ff-back{ display:inline-block; color:var(--ff-accent); font-weight:700; text-decoration:none; font-size:14px; }
.ff-back:hover{ text-decoration:underline; }

/* recommendations */
.ff-recs{ max-width:1180px; margin:0 auto; padding:10px 20px 46px; }
.ff-recs__scroll{
  display:grid; grid-auto-flow:column; grid-auto-columns:150px;
  gap:16px; overflow-x:auto; padding-bottom:10px;
  scroll-snap-type:x mandatory;
}
.ff-recs__scroll .ff-card{ scroll-snap-align:start; }
.ff-recs__scroll::-webkit-scrollbar{ height:8px; }
.ff-recs__scroll::-webkit-scrollbar-thumb{ background:#d4d9e1; border-radius:8px; }

/* =========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================= */
@media (max-width:1100px){
  .ff-grid{ grid-template-columns:repeat(4, 1fr); }
  .ff-cast{ grid-template-columns:repeat(6, 1fr); }
}
@media (max-width:900px){
  .ff-body{ grid-template-columns:1fr; }
  .ff-side{ order:2; }
}
@media (max-width:760px){
  .ff-grid{ grid-template-columns:repeat(3, 1fr); gap:18px 14px; }
  .ff-hero__inner{ flex-direction:column; gap:20px; }
  .ff-hero__poster{ flex:0 0 auto; }
  .ff-hero__poster img{ width:140px; }
  .ff-hero__title{ font-size:26px; }
  .ff-cat-title{ font-size:26px; }
  .ff-cast{ grid-template-columns:repeat(4, 1fr); }
}
@media (max-width:520px){
  .ff-grid{ grid-template-columns:repeat(2, 1fr); gap:16px 12px; }
  .ff-title{ font-size:14px; }
  .ff-sub{ font-size:12px; }
  .ff-cast{ grid-template-columns:repeat(3, 1fr); }
  .ff-cat-title{ font-size:22px; }
  .ff-hero__title{ font-size:22px; }
}

/* =========================================================================
   SEARCH BAR + AUTOCOMPLETE
   ========================================================================= */
.ff-search{ position:relative; width:100%; max-width:560px; margin:0 auto; }
.ff-search__box{
  display:flex; align-items:center; gap:10px;
  background:#fff; border:1px solid #e1e5ec; border-radius:12px;
  padding:0 14px; height:50px;
  box-shadow:var(--ff-shadow);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.ff-search__box:focus-within{
  border-color:var(--ff-accent);
  box-shadow:0 0 0 3px rgba(245,197,24,.18);
}
.ff-search__icon{ color:var(--ff-muted); flex:0 0 auto; }
.ff-search__input{
  flex:1; border:0; outline:0; background:transparent;
  font-size:15px; color:var(--ff-text); height:100%;
}
.ff-search__input::placeholder{ color:#9aa2b1; }
.ff-search__spinner{
  width:18px; height:18px; flex:0 0 auto; opacity:0;
  border:2px solid #e1e5ec; border-top-color:var(--ff-accent);
  border-radius:50%; transition:opacity .15s ease;
}
.ff-search__spinner.is-on{ opacity:1; animation:ff-spin .7s linear infinite; }
@keyframes ff-spin{ to{ transform:rotate(360deg); } }

/* dropdown */
.ff-search__results{
  position:absolute; z-index:60; top:calc(100% + 8px); left:0; right:0;
  background:#fff; border:1px solid #e7eaef; border-radius:12px;
  box-shadow:0 18px 40px rgba(20,22,29,.18);
  overflow:hidden; max-height:420px; overflow-y:auto;
}
.ff-search__row{
  display:flex; align-items:center; gap:12px;
  padding:9px 12px; text-decoration:none; color:var(--ff-text);
  border-bottom:1px solid #f2f4f8;
}
.ff-search__row:last-child{ border-bottom:0; }
.ff-search__row:hover, .ff-search__row.is-active{ background:#f6f8fb; }
.ff-search__poster{
  width:40px; height:60px; border-radius:6px; object-fit:cover;
  flex:0 0 auto; background:#e9ecf1; display:block;
}
.ff-search__poster--ph{ background:linear-gradient(135deg,#2a2f3d,#151821); }
.ff-search__text{ display:flex; flex-direction:column; min-width:0; flex:1; }
.ff-search__title{
  font-size:14px; font-weight:700; line-height:1.3;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ff-search__meta{ font-size:12px; color:var(--ff-muted); }
.ff-search__rating{
  font-size:12px; font-weight:700; color:#12141d;
  background:#fff2c4; padding:3px 8px; border-radius:6px; flex:0 0 auto;
}
.ff-search__empty{ padding:16px; text-align:center; color:var(--ff-muted); font-size:14px; }

@media (max-width:520px){
  .ff-search__box{ height:46px; }
  .ff-search__poster{ width:34px; height:51px; }
}

/* =========================================================================
   HERO CTA BUTTONS + TRAILER MODAL
   ========================================================================= */
.ff-cta{ display:flex; flex-wrap:wrap; gap:12px; margin-top:4px; }
.ff-btn__ico{ font-size:12px; }

.ff-btn--play{
  background:var(--ff-accent); color:#12141d;
}
.ff-btn--play:hover{ filter:brightness(.92); }

.ff-btn--ghost{
  background:rgba(255,255,255,.12); color:#fff;
  border:1px solid rgba(255,255,255,.35);
  cursor:pointer;
}
.ff-btn--ghost:hover{ background:rgba(255,255,255,.2); }

.ff-btn--link{
  background:transparent; color:#fff;
  border:1px solid rgba(255,255,255,.25);
}
.ff-btn--link:hover{ background:rgba(255,255,255,.12); }

/* modal */
.ff-modal{
  position:fixed; inset:0; z-index:9999;
  display:flex; align-items:center; justify-content:center;
  padding:20px;
}
.ff-modal[hidden]{ display:none; }
.ff-modal__backdrop{
  position:absolute; inset:0;
  background:rgba(6,7,12,.86); backdrop-filter:blur(3px);
}
.ff-modal__dialog{
  position:relative; z-index:1;
  width:100%; max-width:900px;
  animation:ff-pop .18s ease;
}
@keyframes ff-pop{ from{ transform:scale(.96); opacity:0; } to{ transform:scale(1); opacity:1; } }
.ff-modal__video{
  position:relative; width:100%;
  aspect-ratio:16 / 9;
  background:#000; border-radius:12px; overflow:hidden;
  box-shadow:0 24px 60px rgba(0,0,0,.6);
}
.ff-modal__video iframe{
  position:absolute; inset:0; width:100%; height:100%; border:0;
}
.ff-modal__close{
  position:absolute; top:-44px; right:0;
  width:36px; height:36px; border-radius:50%;
  background:rgba(255,255,255,.14); color:#fff;
  border:0; cursor:pointer; font-size:22px; line-height:1;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s ease;
}
.ff-modal__close:hover{ background:rgba(255,255,255,.28); }

@media (max-width:520px){
  .ff-cta .ff-btn{ flex:1 1 auto; justify-content:center; }
  .ff-modal__close{ top:0; right:0; background:rgba(0,0,0,.5); }
}
