/* ══════════════════════════════════════════════════════════════
   GAMING KB — CUSTOM BLOCKS & ENHANCED TOC STYLES
   ══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────
   TOC — STYLE VARIANTS
────────────────────────────────── */

/* Common TOC reset */
.gamekb-table-of-contents .gamekb-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.gamekb-toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    opacity: 0.6;
    transition: opacity .2s, transform .3s;
}
.gamekb-toc-toggle:hover { opacity: 1; }
.gamekb-toc-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.gamekb-toc-collapsible .gamekb-toc-body { transition: max-height .35s ease, opacity .25s ease; overflow: hidden; }
.gamekb-toc-collapsible.gamekb-toc-collapsed .gamekb-toc-body { max-height: 0 !important; opacity: 0; padding: 0; }

/* ── Style: Modern Dark ── */
.gamekb-toc-style-modern-dark {
    background: #1e293b;
    border-radius: 10px;
    padding: 16px 18px;
    border-left: 4px solid #6366f1;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.gamekb-toc-style-modern-dark .gamekb-toc-title { color: #e2e8f0; font-size: 1.1rem; }
.gamekb-toc-style-modern-dark .gamekb-toc-toggle { color: #94a3b8; }
.gamekb-toc-style-modern-dark .gamekb-toc-list a {
    color: #cbd5e1; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
    border-radius: 6px; padding: 8px 12px; display: block; text-decoration: none; transition: all .2s;
}
.gamekb-toc-style-modern-dark .gamekb-toc-list a:hover {
    background: rgba(99,102,241,.15); color: #a5b4fc; border-color: rgba(99,102,241,.3);
}

/* ── Style: Minimal ── */
.gamekb-toc-style-minimal {
    background: transparent; border: none; padding: 5px 0 5px 16px; border-left: 3px solid #e5e7eb;
}
.gamekb-toc-style-minimal .gamekb-toc-title { font-size: 1rem; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.gamekb-toc-style-minimal .gamekb-toc-list a {
    color: #374151; background: none; border: none; padding: 5px 0; display: block; text-decoration: none; transition: color .2s;
}
.gamekb-toc-style-minimal .gamekb-toc-list a:hover { color: #2563eb; }

/* ── Style: Gradient Accent ── */
.gamekb-toc-style-gradient {
    background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 50%, #e0e7ff 100%);
    border-radius: 12px; padding: 18px 20px;
    border: 1px solid rgba(139,92,246,.15);
    box-shadow: 0 2px 10px rgba(139,92,246,.08);
}
.gamekb-toc-style-gradient .gamekb-toc-title { color: #6d28d9; }
.gamekb-toc-style-gradient .gamekb-toc-list a {
    color: #4c1d95; background: rgba(255,255,255,.6); border: 1px solid rgba(139,92,246,.1);
    border-radius: 8px; padding: 9px 14px; display: block; text-decoration: none; transition: all .2s;
}
.gamekb-toc-style-gradient .gamekb-toc-list a:hover {
    background: rgba(255,255,255,.9); border-color: rgba(139,92,246,.25); box-shadow: 0 2px 8px rgba(139,92,246,.1);
}

/* ── Style: Boxed Cards ── */
.gamekb-toc-style-boxed {
    background: #f9fafb; border: 2px solid #e5e7eb; border-radius: 12px; padding: 16px;
}
.gamekb-toc-style-boxed .gamekb-toc-title { color: #111827; }
.gamekb-toc-style-boxed .gamekb-toc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.gamekb-toc-style-boxed .gamekb-toc-item { margin: 0; }
.gamekb-toc-style-boxed .gamekb-toc-list a {
    color: #1f2937; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px;
    display: block; text-decoration: none; text-align: center; font-weight: 500; transition: all .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.gamekb-toc-style-boxed .gamekb-toc-list a:hover {
    border-color: #3b82f6; color: #2563eb; box-shadow: 0 2px 8px rgba(59,130,246,.12);
}

/* ──────────────────────────────────
   TOC — FLOATING ICON + DROPDOWN PANEL
────────────────────────────────── */
.gamekb-toc-floating {
    position: fixed; left: 16px; top: 50%; transform: translateY(-50%);
    z-index: 999;
    display: none; /* hidden by default, shown via JS */
    transition: opacity .25s ease;
}
.gamekb-toc-floating.gamekb-visible { display: block; }

.gamekb-toc-floating-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: #fff; border: 2px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #6b7280; transition: all .2s;
    padding: 0; line-height: 1;
    /* Fallback icon via background-image in case SVG is stripped */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cline x1='3' y1='12' x2='15' y2='12'/%3E%3Cline x1='3' y1='18' x2='21' y2='18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
}
/* Hide background when inline SVG renders fine */
.gamekb-toc-floating-btn .gamekb-toc-floating-icon { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; }
.gamekb-toc-floating-btn .gamekb-toc-floating-icon svg { display: block !important; width: 20px; height: 20px; color: inherit; }
.gamekb-toc-floating-btn:hover {
    border-color: #3b82f6; color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59,130,246,.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cline x1='3' y1='12' x2='15' y2='12'/%3E%3Cline x1='3' y1='18' x2='21' y2='18'/%3E%3C/svg%3E");
}

.gamekb-toc-floating-panel {
    display: none; /* toggled via JS */
    position: absolute; left: 52px; top: 50%; transform: translateY(-50%);
    width: 300px; max-height: 65vh; overflow-y: auto;
    background: #fff; border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    border: 1px solid #e5e7eb;
    padding: 0;
}
.gamekb-toc-floating-panel.gamekb-panel-open { display: block; }

.gamekb-toc-floating-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: #fff; border-radius: 12px 12px 0 0; z-index: 1;
}
.gamekb-toc-floating-title { font-weight: 600; font-size: .9rem; color: #374151; }
.gamekb-toc-floating-close {
    background: none; border: none; font-size: 20px; cursor: pointer; color: #9ca3af; line-height: 1; padding: 0 2px;
}
.gamekb-toc-floating-close:hover { color: #ef4444; }

.gamekb-toc-floating-body { padding: 8px 12px 12px; }
.gamekb-toc-floating-body .gamekb-toc-list { padding: 0; margin: 0; list-style: none; }
.gamekb-toc-floating-body .gamekb-toc-list a {
    display: block; padding: 6px 10px; color: #374151; text-decoration: none; font-size: .88rem;
    border-radius: 6px; transition: background .15s, color .15s;
}
.gamekb-toc-floating-body .gamekb-toc-list a:hover { background: #f3f4f6; color: #2563eb; }
.gamekb-toc-floating-body .gamekb-toc-list a.gamekb-toc-active {
    background: #eff6ff; color: #2563eb; font-weight: 600;
}
.gamekb-toc-floating-body .gamekb-toc-level-3 a { padding-left: 24px; font-size: .84rem; }
.gamekb-toc-floating-body .gamekb-toc-level-4 a { padding-left: 38px; font-size: .82rem; }

/* ──────────────────────────────────
   READING PROGRESS BAR
────────────────────────────────── */
.gamekb-reading-progress {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 4px;
    background: rgba(0,0,0,.06); z-index: 9999;
}
.gamekb-reading-progress-bar {
    height: 100%; width: 0%; background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width .15s ease-out;
    border-radius: 0 2px 2px 0;
}

/* ══════════════════════════════════════════════════════════════
   CHECKLIST BLOCK
   ══════════════════════════════════════════════════════════════ */
.gamekb-checklist-block {
    border: 2px solid #3b82f6; border-radius: 12px;
    background: #f8fafc; margin: 24px 0; overflow: hidden;
    box-shadow: 0 2px 8px rgba(59,130,246,.08);
}
.gamekb-checklist-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; background: linear-gradient(135deg, #eff6ff, #f0f4ff);
    border-bottom: 1px solid rgba(59,130,246,.12);
}
.gamekb-checklist-title { flex: 1; font-size: .95rem; }
.gamekb-checklist-counter { font-size: .82rem; color: #6b7280; white-space: nowrap; }
.gamekb-checklist-toggle,
.gamekb-checklist-pin {
    background: none; border: none; cursor: pointer; padding: 4px; color: #6b7280; transition: color .2s;
}
.gamekb-checklist-toggle:hover,
.gamekb-checklist-pin:hover { color: #3b82f6; }
.gamekb-checklist-body { padding: 10px 16px 14px; }
.gamekb-checklist-items { list-style: none; margin: 0; padding: 0; }
.gamekb-checklist-item { margin: 0 0 6px; }
.gamekb-checklist-item label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: background .2s; }
.gamekb-checklist-item label:hover { background: #f1f5f9; }
.gamekb-checklist-checkbox { display: none; }
.gamekb-checklist-checkmark {
    width: 20px; height: 20px; min-width: 20px; border: 2px solid #cbd5e1; border-radius: 5px;
    display: flex; align-items: center; justify-content: center; transition: all .2s; margin-top: 1px;
}
.gamekb-checklist-checkbox:checked ~ .gamekb-checklist-checkmark {
    background: #3b82f6; border-color: #3b82f6;
}
.gamekb-checklist-checkbox:checked ~ .gamekb-checklist-checkmark::after {
    content: '✓'; color: #fff; font-size: 13px; font-weight: 700;
}
.gamekb-checklist-checkbox:checked ~ .gamekb-checklist-text {
    text-decoration: line-through; color: #9ca3af;
}
.gamekb-checklist-text { font-size: .92rem; line-height: 1.5; }
.gamekb-checklist-reset {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
    background: none; border: 1px solid #e5e7eb; border-radius: 6px; padding: 4px 10px;
    font-size: .8rem; color: #6b7280; cursor: pointer; transition: all .2s;
}
.gamekb-checklist-reset:hover { border-color: #ef4444; color: #ef4444; }

/* Stickable — pinned to side (follows scroll via position:fixed) */
/* When pinned, the JS moves the element to <body> to escape overflow:hidden */
.gamekb-checklist-block.gamekb-checklist-pinned {
    position: fixed; top: 50%; transform: translateY(-50%);
    z-index: 997; width: 300px; max-height: 60vh; overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,.15); border-color: #6366f1;
}
.gamekb-checklist-block.gamekb-checklist-pinned.gamekb-pin-right {
    right: 12px; left: auto;
}
.gamekb-checklist-block.gamekb-checklist-pinned.gamekb-pin-left {
    left: 12px; right: auto;
}

/* ══════════════════════════════════════════════════════════════
   TROPHY BLOCK
   ══════════════════════════════════════════════════════════════ */
.gamekb-trophy-block {
    display: flex; align-items: center; gap: 16px;
    border-radius: 12px; padding: 18px 20px; margin: 20px 0;
    border: 2px solid; transition: box-shadow .2s;
}
.gamekb-trophy-block:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

/* Type-specific colors */
.gamekb-trophy-bronze   { background: linear-gradient(135deg, #fdf2e9, #faebd7); border-color: #cd7f32; }
.gamekb-trophy-silver   { background: linear-gradient(135deg, #f3f4f6, #e5e7eb); border-color: #c0c0c0; }
.gamekb-trophy-gold     { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #d4a017; }
.gamekb-trophy-platinum { background: linear-gradient(135deg, #f0f4ff, #e0e7ff); border-color: #6366f1; }

.gamekb-trophy-avatar {
    width: 56px; height: 56px; min-width: 56px; border-radius: 10px;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.5);
}
.gamekb-trophy-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gamekb-trophy-avatar-placeholder { background: rgba(0,0,0,.04); }
.gamekb-trophy-avatar-placeholder svg { color: #9ca3af; }
.gamekb-trophy-info { flex: 1; min-width: 0; }
.gamekb-trophy-title { font-weight: 700; font-size: 1rem; margin-bottom: 2px; color: #1f2937; }
.gamekb-trophy-description { font-size: .88rem; color: #4b5563; line-height: 1.4; }
.gamekb-trophy-type {
    display: flex; align-items: center; justify-content: center;
    min-width: 44px; flex-shrink: 0;
}
.gamekb-trophy-type img { width: 40px; height: 40px; }

/* ══════════════════════════════════════════════════════════════
   SIDE NOTE BLOCK
   ══════════════════════════════════════════════════════════════ */
.gamekb-note-block {
    display: flex; gap: 14px; align-items: flex-start;
    border-left: 4px solid var(--gamekb-note-color, #3b82f6);
    background: var(--gamekb-note-bg, #eff6ff);
    border-radius: 0 12px 12px 0;
    padding: 16px 18px; margin: 20px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.gamekb-note-icon {
    flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    margin-top: 15px;
}
.gamekb-note-icon img { width: 24px; height: 24px; }
.gamekb-note-content { flex: 1; min-width: 0; }
.gamekb-note-title {
    font-weight: 700; font-size: .9rem; margin-bottom: 4px;
    color: var(--gamekb-note-color, #3b82f6); text-transform: uppercase; letter-spacing: .03em;
}
.gamekb-note-text { font-size: .92rem; line-height: 1.55; color: #374151; }
.gamekb-note-text p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .gamekb-toc-floating-panel { width: 260px; max-height: 55vh; }
    .gamekb-checklist-block.gamekb-checklist-pinned { width: 260px; }
    .gamekb-checklist-block.gamekb-checklist-pinned.gamekb-pin-right { right: 8px; }
    .gamekb-checklist-block.gamekb-checklist-pinned.gamekb-pin-left { left: 8px; }
    .gamekb-trophy-block { flex-wrap: wrap; gap: 12px; padding: 14px; }
    .gamekb-trophy-avatar { width: 48px; height: 48px; min-width: 48px; }
    .gamekb-toc-style-boxed .gamekb-toc-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .gamekb-toc-floating { left: 8px; }
    .gamekb-toc-floating-panel { left: 0; top: auto; bottom: 56px; transform: none; width: calc(100vw - 32px); max-height: 45vh; }
    .gamekb-checklist-block.gamekb-checklist-pinned { width: calc(100vw - 24px); top: auto; bottom: 12px; transform: none; max-height: 45vh; left: 12px !important; right: auto !important; }
}
