/* TOPBAR (NAV + SEARCH) */
.header{
  padding:0;
  display:flex;
  align-items:center;
}

.header .container{
  height:100%;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 20px;
}

.header-left{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.header-nav{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.header-search{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:260px;
  max-width:520px;
  flex:1;
}

.header-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

/* ===== SEARCH ===== */
.search{
  flex:1;
  height:40px;
  padding:0 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  outline:none;
  font-size:14px;
  transition:all .15s ease;
  appearance:none;
  -webkit-appearance:none;
}

.search::placeholder{color:var(--muted)}

.search:focus{
  border-color:rgba(239,68,68,.55);
  box-shadow:0 0 0 4px rgba(239,68,68,.12);
}

#clearSearch{height:40px;min-width:40px;padding:0}

/* ===== FILTERS PANEL ===== */
.filters-inline{
  display:flex;
  width:100%;
  padding:14px 16px;
  gap:10px;
  align-items:flex-end;
  border-radius:18px;
  border:1px solid rgba(31,41,55,.75);
  background:linear-gradient(180deg,#0f1528,#0b1020);
  flex-wrap:wrap;
  box-shadow:0 20px 40px rgba(0,0,0,.35);
  margin-top:14px;
}

.filters-row{
  display:flex;
  align-items:flex-end;
  gap:10px;
  flex-wrap:wrap;
  width:100%;
}

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

.fi{display:flex;flex-direction:column;gap:6px;min-width:140px}
.fi-label{font-size:11px;color:var(--muted)}
.fi-btn{
  height:32px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  cursor:pointer;
  padding:0 10px;
  text-align:left;
}
.fi-btn:hover{border-color:rgba(239,68,68,.35)}
.fi-years{display:flex;gap:8px}
.fi-small{min-width:120px}
.fi-grow{flex:1;min-width:220px}
.fi-actions{display:flex;gap:10px;align-items:center;margin-left:auto}

/* ===== POPULAR STRIP ===== */
.popular-block{
  width:100%;
  margin-top:14px;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid rgba(31,41,55,.75);
  background:linear-gradient(180deg,#0f1528,#0b1020);
  box-shadow:0 20px 40px rgba(0,0,0,.35);
}

.popular-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.popular-title{
  font-weight:900;
  font-size:16px;
}

.popular-actions{display:flex;align-items:center;gap:8px}

.popular-row{
  display:flex;
  gap:12px;
  overflow:auto;
  scroll-behavior:smooth;
  padding-bottom:6px;
  scrollbar-width:none;
}
.popular-row::-webkit-scrollbar{display:none}
.popular-strip{
  position:relative;
}
.popular-row{
  padding:0 44px 6px;
}
.popular-arrow{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:36px;
  height:36px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(11,16,32,.75);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:2;
  backdrop-filter: blur(8px);
}
.popular-arrow:hover{border-color:rgba(239,68,68,.35)}
.popular-arrow-prev{left:10px}
.popular-arrow-next{right:10px}


.popular-row .movie-card{
  flex:0 0 auto;
  width:180px;
}

/* Section head */
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:18px;margin:10px 0 14px}
.section-head h2{margin:0}

.chips{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background:#0b1020;
  border:1px solid var(--border);
  color:var(--muted);
  font-size:12px;
}
.chip strong{color:var(--text)}
.chip button{border:none;background:transparent;color:var(--muted);cursor:pointer;font-size:14px;line-height:1}

/* Popover (multi-genre) */
.popover{
  position:fixed;
  top:calc(var(--topbar-h) + 24px);
  left:300px;
  width:360px;
  max-width:calc(100vw - 24px);
  max-height:calc(100vh - 140px);
  background:linear-gradient(180deg,#121a2e,#0b1020);
  border:1px solid rgba(31,41,55,.75);
  border-radius:18px;
  box-shadow:0 30px 80px rgba(0,0,0,.55);
  display:none;
  flex-direction:column;
  z-index:4000;
  overflow:hidden;
}
.popover.open{display:flex}
.popover-head{display:flex;align-items:center;justify-content:space-between;padding:12px 12px;border-bottom:1px solid rgba(31,41,55,.65)}
.popover-title{font-weight:700}
.popover-body{padding:10px 12px;overflow:auto;display:flex;flex-direction:column;gap:8px}
.gline{display:flex;gap:10px;align-items:center}
.gline input{accent-color:var(--accent)}
.gline span{font-size:13px}

/* Segmented control */
.seg{
  display:inline-flex;
  background:#0b1020;
  border:1px solid var(--border);
  border-radius:14px;
  padding:4px;
  gap:4px;
}
.seg-btn{
  height:30px;
  padding:0 12px;
  border-radius:10px;
  border:none;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  font-size:12px;
  white-space:nowrap;
}
.seg-btn.active{background:rgba(239,68,68,.18);color:var(--text)}
.seg-btn:hover{color:var(--text)}

@media(max-width:900px){
  .header .container{padding:0 12px}
  .header-nav{overflow:auto;scrollbar-width:none}
  .header-nav::-webkit-scrollbar{display:none}
  .header-search{min-width:180px;max-width:none}
  .filters-inline{padding:8px 10px;gap:10px}
  .popular-block{padding:10px 10px}
  .fi{min-width:132px}
  .fi-small{min-width:110px}
  .fi-years{gap:6px}
  .fi-actions{margin-left:0}
  .popover{left:12px}
}


/* ===== Showly 2026 Filters Upgrade ===== */

.filters-panel{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 20px;
  border-radius:16px;
  backdrop-filter:blur(12px);
}

.filters-group{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
}

.filters-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
}

@media (max-width: 768px){
  .filters-panel{
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
  }

  .filters-panel::-webkit-scrollbar{
    display:none;
  }
}


@media (min-width: 901px){

  .filters-inline{
    flex-wrap:nowrap;
    overflow-x:auto;
    scrollbar-width:none;
  }

  .filters-inline::-webkit-scrollbar{
    display:none;
  }

  .filters-row{
    flex-wrap:nowrap;
    width:auto;
    align-items:flex-end;
  }

  .filters-row:first-child .fi{
    width:160px;
  }

  .filters-row:first-child .fi .fi-btn,
  .filters-row:first-child .fi select{
    width:100%;
  }

}

/* ===== SCOPE WIDTH FIX (DESKTOP) ===== */
@media (min-width: 901px){
  /* Make the 'Все / Мои' block fit content, without affecting other blocks */
  .filters-inline .filters-row:nth-of-type(2) .fi:nth-child(3){
    min-width:0;
    width:auto;
  }
  #scopeSeg{
    width:auto;
  }
}

/* ===== SEG VISUAL FIX ===== */
@media (min-width: 901px){
  /* Align segmented control height with other inputs */
  .seg{
    height:32px;
    padding:0 4px;
    align-items:center;
  }
  .seg-btn{
    height:100%;
    display:flex;
    align-items:center;
  }
}
