/* =====================================================================
   TOKULIST - widget compartilhado (index, serie, player, catalogo, tokulist)
   Usa as variáveis de cada página quando existirem, com valores padrão.
   ===================================================================== */
:root {
    --tl-accent: var(--primary-color, var(--red, #ff2b3a));
    --tl-surface: var(--surface-color, var(--s1, #13131b));
    --tl-surface-2: var(--surface-hover, var(--s2, #1c1c27));
    --tl-text: var(--text-main, var(--tx, #f4f3f8));
    --tl-muted: var(--text-muted, var(--mut, #9aa3b5));
    --tl-line: var(--border-soft, var(--line, rgba(255, 255, 255, .1)));
    --tl-plan: #6d8dff;
    --tl-watch: #ff5a67;
    --tl-done: #10b981;
}

/* ---------- Botão (poster) ---------- */
.tl-btn {
    display: inline-grid; place-items: center; cursor: pointer; border: 1px solid rgba(255, 255, 255, .18);
    color: #fff; background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: background .2s ease, border-color .2s ease, transform .2s ease, color .2s ease;
}
.tl-btn--poster {
    position: absolute; top: 8px; right: 8px; z-index: 4; width: 34px; height: 34px; border-radius: 50%; font-size: .8rem;
}
.tl-btn--poster:hover, .tl-btn--poster:focus-visible { background: var(--tl-accent); border-color: transparent; transform: scale(1.08); }
.tl-btn[data-state="planejo"] { background: var(--tl-plan); border-color: transparent; }
.tl-btn[data-state="assistindo"] { background: var(--tl-watch); border-color: transparent; }
.tl-btn[data-state="concluido"] { background: var(--tl-done); border-color: transparent; }
.card:hover .tl-btn--poster { transform: translateY(-4px); }
.card:hover .tl-btn--poster:hover { transform: translateY(-4px) scale(1.08); }
@media (hover: none) {
    .card:hover .tl-btn--poster { transform: none; }
}

/* ---------- Menu ---------- */
.tl-backdrop { position: fixed; inset: 0; z-index: 9998; background: transparent; }
.tl-menu {
    position: fixed; z-index: 9999; min-width: 230px; padding: 6px; border-radius: 14px;
    background: var(--tl-surface); color: var(--tl-text); border: 1px solid var(--tl-line);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .55); font-family: inherit; animation: tlPop .14s ease;
}
.tl-menu-title { padding: 8px 12px 6px; color: var(--tl-muted); font-size: .76rem; font-weight: 700; letter-spacing: .02em; }
.tl-item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px;
    background: transparent; color: inherit; font: inherit; font-size: .92rem; font-weight: 600; text-align: left; cursor: pointer;
}
.tl-item:hover, .tl-item:focus-visible { background: var(--tl-surface-2); outline: none; }
.tl-item i { width: 18px; text-align: center; font-size: .9rem; }
.tl-item[data-s="planejo"] i { color: var(--tl-plan); }
.tl-item[data-s="assistindo"] i { color: var(--tl-watch); }
.tl-item[data-s="concluido"] i { color: var(--tl-done); }
.tl-item .tl-on { margin-left: auto; color: var(--tl-done); display: none; }
.tl-item[aria-checked="true"] .tl-on { display: inline; }
.tl-item.tl-rm { color: #f87171; margin-top: 4px; border-top: 1px solid var(--tl-line); border-radius: 0 0 10px 10px; }
@keyframes tlPop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Celular: o menu vira uma folha na parte de baixo da tela */
@media (max-width: 640px) {
    .tl-backdrop { background: rgba(0, 0, 0, .55); }
    .tl-menu {
        left: 0 !important; right: 0; top: auto !important; bottom: 0; min-width: 0; width: 100%;
        border-radius: 20px 20px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
        animation: tlSheet .2s ease;
    }
    .tl-item { padding: 15px 14px; font-size: 1rem; }
}
@keyframes tlSheet { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Aviso ---------- */
.tl-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10000; max-width: min(92vw, 420px);
    padding: 12px 18px; border-radius: 999px; background: var(--tl-surface); color: var(--tl-text); border: 1px solid var(--tl-line);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .5); font-size: .9rem; font-weight: 600; animation: tlToast .2s ease;
}
.tl-toast.err { border-color: rgba(239, 68, 68, .6); }
@media (max-width: 900px) { .tl-toast { bottom: 88px; } }
@keyframes tlToast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
    .tl-menu, .tl-toast { animation: none; }
    .tl-btn { transition: none; }
}
