/* ─────────────────────────────────────────────────────────
   Gnoke Player — player.css
   Player layout, controls, library sidebar, subtitle overlay.
   Imported only by main/index.html.
───────────────────────────────────────────────────────── */

/* ── Player layout ── */
.player-layout {
  display: flex;
  height: calc(100dvh - var(--topbar-h));
  overflow: hidden;
}
.player-area {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: #000; position: relative;
}
#player-wrap {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden; cursor: pointer;
  transition: outline .15s;
}
#player-wrap.drag-over { outline: 3px dashed var(--accent); outline-offset: -6px; }
#player-wrap.fullscreen { position: fixed; inset: 0; z-index: 500; background: #000; }

#player-video {
  max-width: 100%; max-height: 100%;
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

/* ── Subtitle overlay ── */
#subtitle-overlay {
  position: absolute; bottom: 72px; left: 0; right: 0;
  text-align: center; pointer-events: none;
  z-index: 10; padding: 0 5%;
}
.sub-text {
  display: inline-block;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.55;
  padding: 4px 12px;
  border-radius: 5px;
  white-space: pre-wrap;
  max-width: 80%;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* ── Drop zone (empty state) ── */
#drop-zone {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; pointer-events: none;
}
#player-video.has-src ~ #drop-zone { display: none; }

.drop-svg-wrap {
  position: relative; width: 120px; height: 120px;
}
.drop-svg { width: 100%; height: 100%; }
.drop-svg-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  animation: pulse-ring 2.4s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(181,101,29,.45); }
  70%  { box-shadow: 0 0 0 22px rgba(181,101,29,0); }
  100% { box-shadow: 0 0 0 0 rgba(181,101,29,0); }
}
.drop-title {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 700;
  color: rgba(255,255,255,.5); letter-spacing: -.02em;
}
.drop-sub {
  font-family: var(--font-mono); font-size: .65rem;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.25);
}
.drop-btn {
  margin-top: 4px; padding: 11px 26px; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-family: var(--font-sans); font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer; pointer-events: all;
  box-shadow: 0 4px 16px rgba(181,101,29,.4);
  transition: opacity .15s, transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.drop-btn:hover  { opacity: .9; box-shadow: 0 6px 22px rgba(181,101,29,.55); }
.drop-btn:active { transform: scale(.97); }

/* ── Error zone ── */
#error-zone {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; background: rgba(0,0,0,.88);
  pointer-events: none;
}
#error-zone.visible { display: flex; pointer-events: all; }
.error-icon  { font-size: 3rem; line-height: 1; animation: errShake .4s ease; }
@keyframes errShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.error-title {
  font-family: var(--font-display);
  font-size: 1.2rem; font-weight: 700;
  color: rgba(255,255,255,.8); letter-spacing: -.02em;
}
.error-msg {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.35); text-align: center;
  max-width: 260px; line-height: 1.7;
}
.error-actions { display: flex; gap: 10px; margin-top: 4px; }
.error-btn {
  padding: 10px 22px; border-radius: 8px;
  font-family: var(--font-sans); font-size: .82rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity .15s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.error-btn:active { transform: scale(.97); opacity: .85; }
.error-btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(181,101,29,.4); }
.error-btn-primary:hover { background: var(--accent-dk); }
.error-btn-ghost  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.15); }
.error-btn-ghost:hover { background: rgba(255,255,255,.16); }

/* ── Buffering spinner ── */
#player-spinner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#player-spinner.hidden { display: none; }
.spin-ring {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Controls bar ── */
#controls-bar {
  flex-shrink: 0;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.6) 60%, transparent 100%);
  padding: 10px 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity .22s;
}
#controls-bar.hidden { opacity: 0; pointer-events: none; }
#player-wrap.fullscreen #controls-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
}

/* Scrubber */
.scrub-row { display: flex; align-items: center; gap: 10px; }
#scrubber {
  flex: 1; height: 4px; padding: 0; border: none;
  background: transparent; appearance: none; -webkit-appearance: none;
  cursor: pointer; border-radius: 0;
}
#scrubber:focus { outline: none; box-shadow: none; }
#scrubber::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), rgba(255,255,255,.2) var(--pct, 0%));
}
#scrubber::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); margin-top: -5px;
  box-shadow: 0 0 0 3px rgba(181,101,29,.3);
}
#scrubber::-moz-range-track  { height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); }
#scrubber::-moz-range-progress { background: var(--accent); height: 4px; border-radius: 2px; }
#scrubber::-moz-range-thumb  { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none; }

.time-display {
  font-family: var(--font-mono); font-size: .7rem;
  color: rgba(255,255,255,.7); letter-spacing: .04em;
  white-space: nowrap; flex-shrink: 0;
}
.time-sep { opacity: .4; margin: 0 2px; }

/* Control buttons */
.ctrl-row { display: flex; align-items: center; gap: 6px; }
.ctrl-spacer { flex: 1; }
.ctrl-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.85); font-size: 1.1rem; line-height: 1;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover  { background: rgba(255,255,255,.12); color: #fff; }
.ctrl-btn:active { transform: scale(.93); }
.ctrl-btn.ctrl-play {
  width: 44px; height: 44px; font-size: 1.3rem;
  background: var(--accent); color: #fff;
}
.ctrl-btn.ctrl-play:hover { background: var(--accent-dk); }

/* Volume */
.vol-cluster { display: flex; align-items: center; gap: 6px; }
#volume-slider {
  width: 72px; height: 4px; padding: 0; border: none;
  background: transparent; appearance: none; -webkit-appearance: none;
  cursor: pointer;
}
#volume-slider:focus { outline: none; box-shadow: none; }
#volume-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
#volume-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; margin-top: -4px; }
#volume-slider::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
#volume-slider::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: none; }

/* Speed menu */
.speed-menu { position: relative; }
.speed-menu .menu-content { left: auto; right: 0; min-width: 100px; }

/* ── Library sidebar ── */
#library-sidebar {
  width: 0; overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .26s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
}
#library-sidebar.open { width: 260px; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-head h3 {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.sidebar-actions { display: flex; gap: 4px; }
.sidebar-icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: .8rem; padding: 4px 6px;
  border-radius: 5px; transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-icon-btn:hover { color: var(--text); background: var(--surface2); }
.lib-notice {
  margin: 8px 8px 0; padding: 8px 10px;
  border-radius: 8px; background: var(--surface2);
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .05em; color: var(--muted); line-height: 1.6;
}
.lib-notice strong { color: var(--text); font-weight: 600; }
#library-list { flex: 1; overflow-y: auto; padding: 8px; }
.lib-empty {
  text-align: center; padding: 32px 16px;
  font-family: var(--font-mono); font-size: .68rem;
  color: var(--muted); letter-spacing: .06em; line-height: 1.7;
}
.lib-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 6px; border-radius: 8px; cursor: default;
  transition: background .12s; border: 1px solid transparent;
  position: relative;
}
.lib-item:hover { background: var(--surface2); }
.lib-item-active { background: var(--accent-lt); border-color: var(--accent-dim); }
.lib-item-icon { font-size: 1.2rem; flex-shrink: 0; line-height: 1; }
.lib-item-body { flex: 1; min-width: 0; }
.lib-item-name {
  font-size: .78rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.lib-item-meta { font-family: var(--font-mono); font-size: .58rem; color: var(--muted); }
.lib-item-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.lib-item-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.lib-item-del {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: .7rem; padding: 3px 5px;
  border-radius: 4px; flex-shrink: 0; line-height: 1;
  transition: color .12s, background .12s;
  -webkit-tap-highlight-color: transparent;
}
.lib-item-del:hover { color: var(--danger); background: var(--surface3); }
.lib-item-reselect {
  position: absolute; inset: 0; border-radius: 8px;
  background: var(--accent-lt); border: 1.5px dashed var(--accent);
  display: none; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer;
  font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .06em; color: var(--accent-txt);
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}
.lib-item-reselect:hover { background: var(--accent-dim); }
.lib-item.needs-reselect .lib-item-reselect { display: flex; }
.lib-item.needs-reselect .lib-item-icon,
.lib-item.needs-reselect .lib-item-body,
.lib-item.needs-reselect .lib-item-del { opacity: 0.25; pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .menu-group { display: none; }
  #context-info { display: none; }
  #library-sidebar.open { width: 100%; position: absolute; top: 0; bottom: 0; right: 0; z-index: 50; }
  .vol-cluster #volume-slider { width: 52px; }
  .ctrl-btn { width: 32px; height: 32px; font-size: 1rem; }
  .ctrl-btn.ctrl-play { width: 40px; height: 40px; }
  #subtitle-overlay { bottom: 80px; }
}

