/* styles.css — NEONSIMILAR (cyberpunk, responsive, crisp)
   Fixes:
   - Header text overflowing behind buttons (min-width:0 + ellipsis)
   - “Two different background colors” (unified base gradient + consistent glass overlays)
*/

/* -----------------------------
   Theme / reset
------------------------------*/
:root{
  --bg0:#05060c;
  --bg1:#070a14;
  --bg2:#071425;

  --card: rgba(10, 14, 28, .62);
  --card2: rgba(10, 14, 28, .72);

  --line: rgba(120, 170, 255, .18);
  --line2: rgba(120, 170, 255, .28);

  --text:#e7ecff;
  --muted: rgba(231,236,255,.68);

  --accent:#22d3ee;     /* cyan */
  --accent2:#7c3aed;    /* purple */
  --hot:#ff2bd6;        /* magenta */

  --r: 22px;
  --pad: 18px;

  --shadow: 0 16px 50px rgba(0,0,0,.45);
  --shadow2: 0 0 0 1px rgba(120,170,255,.14), 0 16px 60px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(124,58,237,.22), transparent 55%),
    radial-gradient(900px 520px at 85% 20%, rgba(34,211,238,.18), transparent 55%),
    radial-gradient(1200px 700px at 50% 100%, rgba(255,43,214,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 45%, var(--bg2) 100%);
  overflow-x:hidden;
}

/* subtle grid + vignette for crisp “cyberpunk” feel */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(to bottom, rgba(255,255,255,.03) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(circle at 50% 40%, transparent 35%, rgba(0,0,0,.55) 78%);
  mix-blend-mode:overlay;
  opacity:.22;
}

/* -----------------------------
   Layout
------------------------------*/
.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

/* Works for BOTH your old header (.topbar) and new one (.top) */
.top, .topbar{
  position: sticky;
  top: 0;
  z-index: 50;

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;

  padding: 14px 14px;
  margin: 10px 0 16px;

  border: 1px solid var(--line);
  border-radius: calc(var(--r) + 6px);

  background: rgba(8, 12, 24, .62); /* unified overlay */
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow2);
}

/* -----------------------------
   Header brand + FIX overflow behind buttons
------------------------------*/
.brand{
  display:flex;
  align-items:center;
  gap: 12px;

  flex: 1 1 auto;
  min-width: 0;               /* ✅ CRITICAL: allows flex item to shrink */
}

.logo{
  width: 58px;
  height: 58px;
  display:grid;
  place-items:center;
  border-radius: 18px;

  border: 1px solid rgba(34,211,238,.35);
  background:
    radial-gradient(circle at 30% 30%, rgba(34,211,238,.22), transparent 55%),
    radial-gradient(circle at 70% 80%, rgba(124,58,237,.22), transparent 60%),
    rgba(6,10,18,.8);
  box-shadow: 0 0 0 1px rgba(34,211,238,.12), 0 12px 30px rgba(0,0,0,.45);
}

.name{
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 20px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;     /* ✅ prevents pushing/overlapping */
  max-width: 100%;
}

.sub{
  margin-top: 4px;
  color: var(--muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;     /* ✅ prevents going behind buttons */
  max-width: 100%;
}

.topBtns{
  display:flex;
  gap: 10px;
  flex: 0 0 auto;              /* ✅ never shrink into brand */
}

/* If viewport is narrow, stack buttons under brand instead of overlap */
@media (max-width: 520px){
  .top, .topbar{
    flex-wrap: wrap;
    justify-content:flex-start;
  }
  .topBtns{
    width: 100%;
  }
  .topBtns .btn{
    flex: 1 1 auto;
  }
}

/* -----------------------------
   Cards
------------------------------*/
.card{
  border: 1px solid var(--line);
  border-radius: calc(var(--r) + 4px);
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow2);
  padding: var(--pad);
  margin: 0 0 16px;
}

h2{
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: .04em;
}

.sectionTitle{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.muted{color: var(--muted)}
.accent{color: var(--accent)}

/* -----------------------------
   Inputs / buttons
------------------------------*/
.lbl{display:block; margin: 10px 0 8px; color: var(--muted)}
.input, .select{
  width:100%;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(3,6,14,.65);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.input:focus, .select:focus{
  border-color: rgba(34,211,238,.55);
  box-shadow: 0 0 0 3px rgba(34,211,238,.12);
}

.btn{
  border: 1px solid var(--line2);
  background: rgba(6, 10, 18, .55);
  color: var(--text);
  border-radius: 18px;
  padding: 12px 14px;
  cursor:pointer;
  transition: transform .06s ease, box-shadow .18s ease, border-color .18s ease;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
}
.btn:hover{
  border-color: rgba(34,211,238,.5);
  box-shadow: 0 0 0 1px rgba(34,211,238,.16), 0 14px 40px rgba(0,0,0,.35);
}
.btn:active{transform: translateY(1px)}
.btn.primary{
  border-color: rgba(34,211,238,.55);
  background:
    radial-gradient(circle at 10% 10%, rgba(34,211,238,.28), transparent 55%),
    radial-gradient(circle at 90% 90%, rgba(124,58,237,.25), transparent 60%),
    rgba(10, 16, 34, .65);
}
.btn.full{width:100%; margin-top: 10px}

.filters{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}
@media (max-width: 720px){
  .filters{grid-template-columns: 1fr;}
}

.lblRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

/* Range */
input[type="range"]{
  width:100%;
  accent-color: var(--accent);
}

/* -----------------------------
   Suggestions dropdown
------------------------------*/
.suggest{
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(6,10,18,.78);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.hidden{display:none !important}
.suggestItem{
  width:100%;
  display:flex;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(120,170,255,.12);
  background: transparent;
  color: var(--text);
  cursor:pointer;
}
.suggestItem:hover{
  background: rgba(34,211,238,.08);
}
.suggestItem:last-child{border-bottom:0}

/* -----------------------------
   Target / Similar cards
------------------------------*/
.targetBox{
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(120,170,255,.16);
  background: rgba(6,10,18,.55);
}

.targetGrid{
  display:grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items:start;
}

.poster{
  width: 130px;
  height: 190px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(120,170,255,.22);
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
}

.targetInfo .titleRow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.title{
  font-weight: 900;
  letter-spacing: .02em;
  font-size: 28px;
}
.pill{
  border: 1px solid rgba(34,211,238,.35);
  background: rgba(34,211,238,.08);
  padding: 10px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.overview{
  margin-top: 10px;
  color: rgba(231,236,255,.78);
  line-height: 1.55;
  font-size: 18px;
}

/* clamp helpers */
.clamp3{
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Similar list container */
.chips{
  display:flex;
  flex-direction:column;
  gap: 14px;
}

/* Similar card button */
.simCard{
  width: 100%;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(120,170,255,.18);
  background: rgba(6,10,18,.58);
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  padding: 14px;
  cursor:pointer;
  transition: transform .06s ease, border-color .18s ease, box-shadow .18s ease;
}
.simCard:hover{
  border-color: rgba(34,211,238,.55);
  box-shadow: 0 0 0 1px rgba(34,211,238,.12), 0 18px 55px rgba(0,0,0,.4);
}
.simCard:active{transform: translateY(1px)}

/* Mobile: stack poster above text */
@media (max-width: 520px){
  h2{font-size: 30px}
  .title{font-size: 24px}
  .targetGrid{
    grid-template-columns: 110px 1fr;
  }
  .poster{
    width: 110px;
    height: 165px;
  }
}

/* -----------------------------
   Trailer
------------------------------*/
.trailer{
  margin-top: 14px;
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(120,170,255,.18);
  box-shadow: var(--shadow);
}
.trailer iframe{
  width:100%;
  height: 320px;
  border: 0;
}
@media (max-width: 520px){
  .trailer iframe{height: 220px;}
}

/* -----------------------------
   Actions row
------------------------------*/
.actions{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.actions .btn{flex: 1 1 160px}

/* -----------------------------
   Footer
------------------------------*/
.foot{
  padding: 14px 4px 0;
  text-align:center;
}

/* -----------------------------
   Modal (Watchlist)
------------------------------*/
.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  display:grid;
  place-items:center;
  padding: 16px;
  z-index: 100;
}
.modalCard{
  width:min(760px, 100%);
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(6,10,18,.82);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow2);
  padding: 16px;
}
.modalTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.watchlist{
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.watchItem{
  display:flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(120,170,255,.14);
  border-radius: 18px;
  background: rgba(10,14,28,.55);
}
.watchPoster{
  width: 54px;
  height: 78px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(120,170,255,.18);
}
.watchMeta{color: var(--muted); margin-top: 6px}
