/* ============================================================
   Вкладка «Фильмы» — сетка в духе Google Таблиц
   ============================================================ */

/* ------------------------- Панель инструментов ------------------------- */
.toolbar {
  flex: 0 0 auto;
  background: var(--bg-chrome);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px 6px;
}
.toolbar__row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar__spacer { flex: 1 1 auto; }
.toolbar__hint { font-size: 11.5px; color: var(--ink-3); padding: 5px 2px 0; min-height: 18px; }
.toolbar__hint.is-err { color: #ff7b7b; }

.urlfield {
  flex: 1 1 380px; max-width: 620px; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid #e10300; border-radius: var(--radius-sm);
  padding: 0 10px; height: 36px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.urlfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.urlfield__ico { color: var(--ink-3); font-size: 13px; }
.urlfield input { flex: 1; background: none; border: 0; outline: none; min-width: 0; font-size: 14px; }
.urlfield input::placeholder { color: var(--ink-3); }
.urlfield__clear { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 12px; padding: 4px; }
.urlfield__clear:hover { color: var(--ink); }

/* ------------------------- Сетка ------------------------- */
.sheet {
  flex: 1 1 auto; min-height: 0; overflow: auto; position: relative;
  background: var(--bg-grid);
  --gutter: 38px;
  --cols: 7;
}

.sheet__colhead, .srow {
  display: grid;
  grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr));
}

.sheet__colhead {
  position: sticky; top: 0; z-index: 12;
  background: var(--bg-head); border-bottom: 1px solid var(--line-strong);
  height: 22px;
}
.colh {
  border-right: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px; color: var(--ink-3); user-select: none;
}
.colh--corner { position: sticky; left: 0; z-index: 2; background: var(--bg-head); }

.srow { min-height: 40px; }

.rownum {
  position: sticky; left: 0; z-index: 8;
  background: var(--bg-head); border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-3); user-select: none;
}

/* ------------------------- Ячейка фильма ------------------------- */
.cell {
  position: relative;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-cell);
  display: flex; flex-direction: column;
  min-width: 0;
  user-select: none;
  transition: background .12s, box-shadow .12s;
}
.cell--empty { background: var(--bg-grid); }
.cell:not(.cell--empty):hover { background: var(--hover); }

.cell.is-picked { background: var(--pick); box-shadow: inset 0 0 0 2px var(--pick-line); }
.cell.is-picked:hover { background: color-mix(in srgb, var(--pick) 70%, var(--hover)); }

.cell.is-dragging { opacity: .32; }
.cell.is-drop-before::before,
.cell.is-drop-after::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 3px; background: var(--accent);
  z-index: 6; box-shadow: 0 0 8px var(--accent);
}
.cell.is-drop-before::before { left: -2px; }
.cell.is-drop-after::after { right: -2px; }

.cell__poster {
  position: relative; flex: 1 1 auto; min-height: 0;
  aspect-ratio: 2 / 3; width: 100%;
  display: grid; place-items: center; overflow: hidden;
}
.cell__poster img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  -webkit-user-drag: none; user-select: none;
}
.cell__poster .noposter {
  width: 100%; height: 100%; display: grid; place-items: center; gap: 6px; padding: 10px;
  text-align: center; font-size: 12px; color: var(--ink-2);
  background: repeating-linear-gradient(45deg, var(--chip-soft) 0 8px, transparent 8px 16px);
}

/* цветная метка редкости */
.cell__rar { position: absolute; left: 0; right: 0; top: 0; height: 3px; opacity: .9; }

/* «+» — добавить в казик */
.cell__plus {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%) scale(.85);
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(15, 15, 15, .82); color: #fff; font-size: 17px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: opacity .13s, transform .13s, background .13s;
  backdrop-filter: blur(4px); z-index: 5;
}
.cell:hover .cell__plus, .cell.is-picked .cell__plus { opacity: 1; transform: translateX(-50%) scale(1); }
.cell__plus:hover { background: var(--ok); color: #05150e; border-color: var(--ok); transform: translateX(-50%) scale(1.14); }
.cell.is-picked .cell__plus { background: var(--ok); color: #05150e; border-color: transparent; }

/* подпись с хронометражом — чёрная полоса как в таблице */
.cell__cap {
  flex: 0 0 auto; height: 26px; background: #000; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; letter-spacing: .01em; overflow: hidden; white-space: nowrap;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.cell__cap b { font-weight: 500; }
.cell__cap .capdot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.cell--empty .cell__cap { background: transparent; border: 0; }

.cell__num {
  position: absolute; top: 3px; left: 4px; z-index: 4;
  font-size: 10px; color: rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .5);
  padding: 0 4px; border-radius: 3px; pointer-events: none;
}

/* ------------------------- Пусто / служебное ------------------------- */
.sheet__empty {
  position: absolute; inset: 22px 0 0 0; display: grid; place-content: center; text-align: center;
  gap: 4px; color: var(--ink-2); pointer-events: none;
}
.sheet__empty-ico { font-size: 44px; opacity: .5; }
.sheet__empty p { margin: 0; }

/* призрак при перетаскивании */
.dragghost {
  position: fixed; z-index: 100; pointer-events: none; opacity: .92;
  border-radius: 6px; overflow: hidden; box-shadow: 0 12px 34px rgba(0, 0, 0, .65);
  border: 2px solid var(--accent); transform: translate(-50%, -50%) rotate(-3deg);
}
.dragghost img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ------------------------- Нижние «листы» ------------------------- */
.sheettabs {
  flex: 0 0 auto; height: 38px; display: flex; align-items: center; gap: 4px;
  padding: 0 8px; background: var(--bg-chrome); border-top: 1px solid var(--line);
}
.sheettabs__btn {
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: var(--ink-2);
  cursor: pointer; font-size: 15px;
}
.sheettabs__btn:hover { background: var(--hover); }
.sheettabs__list { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sheettabs__list::-webkit-scrollbar { display: none; }
.sheettab {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); font-size: 12.5px; padding: 6px 12px; border-radius: 6px 6px 0 0; white-space: nowrap;
}
.sheettab:hover { background: var(--hover); }
.sheettab.is-active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); font-weight: 500; }
.sheettab__caret { font-size: 9px; opacity: .6; }
.sheettabs__status { margin-left: auto; font-size: 11px; color: var(--ink-3); white-space: nowrap; padding-right: 4px; }

@media (max-width: 900px) {
  .sheet { --gutter: 24px; }
  .toolbar__row { gap: 6px; }
  .urlfield { flex: 1 1 100%; order: -1; }
  .btn { padding: 7px 11px; font-size: 13px; }
  .cell__cap { height: 22px; font-size: 11px; }
  .cell__plus { opacity: .85; width: 26px; height: 26px; font-size: 15px; }
  .sheettabs__status { display: none; }
}
