/* ==========================================================================
   card-menu.css — Video card context-menu (three-dot / ellipsis menu).
   Mirrors the original site's .video-context-menu / .context-menu structure.
   Dark panel only (matches site dark theme); light overrides at bottom.
   ========================================================================== */

/* --- trigger visibility: show the menu wrapper only on card hover --- */
.thumb-block .video-context-menu {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.thumb-block:hover .video-context-menu,
.thumb-block .video-context-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Make sure .thumb-inside is the positioning anchor */
.thumb-block .thumb-inside {
  position: relative;
}

/* --- three-dot button --- */
.context-menu {
  position: relative;
  display: inline-block;
}

.context-menu-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  transition: background .12s ease;
  user-select: none;
}
.context-menu-button:hover {
  background: rgba(0, 0, 0, .85);
}
.context-menu-button .icon-f {
  pointer-events: none;
}

/* --- tooltip panel (dropdown) --- */
.context-menu > .tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 180px;
  white-space: nowrap;
}
.context-menu.open > .tooltip {
  display: block;
}

.tooltip-contents {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .6);
  padding: 4px 0;
  overflow: hidden;
}

/* --- arrow --- */
.tooltip-arrow {
  display: none; /* optional visual arrow — hidden for simplicity */
}

/* --- action rows (_button_ class, hash-busted on origin → we redefine it) --- */
.cm-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: #e0e0e0;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: background .1s ease, color .1s ease;
  user-select: none;
}
.cm-btn:hover {
  background: #2e2e2e;
  color: #fff;
}
.cm-btn.is-active {
  color: #e8402a;
}
.cm-btn.disabled {
  opacity: .45;
  pointer-events: none;
}

.cm-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.cm-label {
  flex: 1;
}

/* --- vote row (thumb-up + thumb-down side by side) --- */
.context-menu-vote {
  display: flex;
  border-top: 1px solid #2a2a2a;
  margin-top: 2px;
}

.context-menu-like,
.context-menu-dislike {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 15px;
  transition: background .1s ease, color .1s ease;
}
.context-menu-like:hover {
  background: #2e2e2e;
  color: #4caf50;
}
.context-menu-dislike:hover {
  background: #2e2e2e;
  color: #e8402a;
}
.context-menu-like.voted {
  color: #4caf50;
}
.context-menu-dislike.voted {
  color: #e8402a;
}
.context-menu-like + .context-menu-dislike {
  border-left: 1px solid #2a2a2a;
}

/* --- playlist sub-panel (inline expansion inside tooltip-contents) --- */
.cm-playlist-panel {
  display: none;
  border-top: 1px solid #2a2a2a;
  max-height: 220px;
  overflow-y: auto;
}
.cm-playlist-panel.open {
  display: block;
}

.cm-playlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  color: #d0d0d0;
  font-size: 12px;
  cursor: pointer;
  transition: background .1s ease;
}
.cm-playlist-item:hover {
  background: #2a2a2a;
  color: #fff;
}
.cm-playlist-item.is-in {
  color: #aaa;
  pointer-events: none;
}
.cm-playlist-item .cm-pl-check {
  font-size: 13px;
  color: #4caf50;
  width: 14px;
  flex-shrink: 0;
}
.cm-playlist-empty {
  padding: 8px 14px;
  color: #888;
  font-size: 12px;
}

.cm-playlist-new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 8px;
  border-top: 1px solid #2a2a2a;
}
.cm-playlist-new input {
  flex: 1;
  background: #111;
  border: 1px solid #444;
  border-radius: 3px;
  color: #e0e0e0;
  font-size: 12px;
  padding: 4px 7px;
  outline: none;
}
.cm-playlist-new input:focus {
  border-color: #666;
}
.cm-playlist-new button {
  background: #e8402a;
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  padding: 4px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.cm-playlist-new button:hover {
  background: #cc2e1a;
}
.cm-playlist-loading {
  padding: 8px 14px;
  color: #888;
  font-size: 12px;
  text-align: center;
}

/* --- toast notification --- */
#cm-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  border: 1px solid #333;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
  text-align: center;
}
#cm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- light theme overrides --- */
html.light .context-menu-button {
  background: rgba(255, 255, 255, .8);
  color: #222;
}
html.light .context-menu-button:hover {
  background: rgba(255, 255, 255, .95);
}
html.light .tooltip-contents {
  background: #fff;
  border-color: #ddd;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
}
html.light .cm-btn {
  color: #333;
}
html.light .cm-btn:hover {
  background: #f5f5f5;
  color: #111;
}
html.light .context-menu-vote {
  border-top-color: #eee;
}
html.light .context-menu-like,
html.light .context-menu-dislike {
  color: #333;
}
html.light .context-menu-like:hover {
  background: #f5f5f5;
}
html.light .context-menu-dislike:hover {
  background: #f5f5f5;
}
html.light .context-menu-like + .context-menu-dislike {
  border-left-color: #eee;
}
html.light .cm-playlist-panel {
  border-top-color: #eee;
}
html.light .cm-playlist-item {
  color: #333;
}
html.light .cm-playlist-item:hover {
  background: #f5f5f5;
  color: #111;
}
html.light .cm-playlist-new {
  border-top-color: #eee;
}
html.light .cm-playlist-new input {
  background: #f5f5f5;
  border-color: #ccc;
  color: #111;
}
html.light #cm-toast {
  background: #fff;
  color: #222;
  border-color: #ddd;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
