/* ============================================================
   CBQ Bookmarks — heart button + bookmarks page
   ============================================================ */

/* ---------- Bookmark button on cards (🔖) ---------- */
/* Defensive: force sizing + positioning so card flex/grid rules can never stretch this button */
.cbq-bookmark-heart {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    flex: 0 0 36px !important;
    border-radius: 50% !important;
    background: rgba(255, 241, 242, 0.85);       /* subtle pink-50 tint */
    border: 1px solid rgba(254, 205, 211, 0.6);  /* pink-200 @ 60% */
    color: #fda4af;                              /* pink-300 outline */
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform .2s cubic-bezier(.4,0,.2,1),
                color .2s ease,
                background .2s ease,
                box-shadow .2s ease;
    z-index: 5;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
}
.cbq-bookmark-heart svg {
    transition: fill .2s ease;
    fill: transparent;
    stroke: currentColor;
}

/* Hover — subtle enlarge, hint at the "active" color */
.cbq-bookmark-heart:hover {
    transform: scale(1.12);
    color: #fb7185;                              /* pink-400 */
    background: rgba(255, 228, 230, 0.95);       /* pink-100 */
    box-shadow: 0 4px 14px -3px rgba(244, 63, 94, 0.28);
}

/* Active — filled hot-red gradient */
.cbq-bookmark-heart.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, #ef4444 0%, #e11d48 55%, #be123c 100%); /* red-500 → rose-600 → rose-700 */
    border-color: #be123c;
    box-shadow: 0 4px 14px -2px rgba(225, 29, 72, 0.5),
                inset 0 1px 0 rgba(255,255,255,0.18);
}
.cbq-bookmark-heart.is-active svg {
    fill: #ffffff;
    stroke: #ffffff;
}
.cbq-bookmark-heart.is-active:hover {
    transform: scale(1.12);
    color: #ffffff;
    background: linear-gradient(135deg, #dc2626 0%, #be123c 55%, #9f1239 100%);
    box-shadow: 0 6px 18px -3px rgba(225, 29, 72, 0.6);
}

/* Click pop — also used when toggled active */
.cbq-bookmark-heart.is-animating {
    animation: cbq-bookmark-pop .4s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes cbq-bookmark-pop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.5); }
    65%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

/* ---------- Tooltip: "Save Test" / "Saved" ---------- */
.cbq-bookmark-heart::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: .2px;
    font-family: 'Inter', system-ui, sans-serif;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 6px 16px -4px rgba(15,23,42,.3);
}
.cbq-bookmark-heart::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    right: 12px;
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #0f172a;
    opacity: 0;
    transition: opacity .18s;
    pointer-events: none;
    z-index: 20;
}
.cbq-bookmark-heart:hover::after,
.cbq-bookmark-heart:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}
.cbq-bookmark-heart:hover::before,
.cbq-bookmark-heart:focus-visible::before {
    opacity: 1;
}

/* Dark theme */
html[data-mcqp-theme="dark"] .cbq-bookmark-heart {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(251, 113, 133, 0.35);
    color: #fda4af;
}
html[data-mcqp-theme="dark"] .cbq-bookmark-heart:hover {
    background: rgba(51, 65, 85, 0.95);
    color: #fb7185;
}
html[data-mcqp-theme="dark"] .cbq-bookmark-heart.is-active {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 55%, #be123c 100%);
    border-color: #be123c;
}
html[data-mcqp-theme="dark"] .cbq-bookmark-heart::after { background: #f1f5f9; color: #0f172a; }
html[data-mcqp-theme="dark"] .cbq-bookmark-heart::before { border-top-color: #f1f5f9; }

/* Heart inline (inside test engine question toolbar — no absolute positioning) */
.cbq-bookmark-heart.cbq-heart-inline {
    position: static;
    width: 32px; height: 32px;
}

/* Archive cards need position:relative so absolute heart positions correctly */
.ca-test-card, .cbq-exam-card, .gk-test-card {
    position: relative !important;
    overflow: visible !important;  /* MCQ card had overflow:hidden which clipped hover scale + tooltip */
}

/* ============================================================
   BOOKMARKS PAGE
   ============================================================ */
.cbq-bm-hero {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 18px;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.cbq-bm-hero h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    color: #1e293b;
    letter-spacing: -.01em;
}
.cbq-bm-hero p {
    font-size: 14px;
    color: #475569;
    margin: 0;
    max-width: 520px;
}
.cbq-bm-hero-stats {
    display: flex; gap: 16px;
}
.cbq-bm-hero-stats .stat {
    background: #fff;
    padding: 14px 22px;
    border-radius: 12px;
    text-align: center;
    min-width: 110px;
    box-shadow: 0 2px 8px -2px rgba(15,23,42,.06);
}
.cbq-bm-hero-stats .v {
    font-size: 26px;
    font-weight: 800;
    color: #4f46e5;
    line-height: 1;
}
.cbq-bm-hero-stats .l {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 6px;
}

.cbq-bm-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}
.cbq-bm-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.cbq-bm-tab:hover { color: #334155; }
.cbq-bm-tab.is-active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.cbq-bm-section {
    margin-bottom: 24px;
}
.cbq-bm-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.cbq-bm-section-head .icon { font-size: 22px; }
.cbq-bm-section-head h2 {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.cbq-bm-count {
    margin-left: auto;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.cbq-bm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.cbq-bm-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    transition: all .2s;
    display: flex;
    flex-direction: column;
}
.cbq-bm-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -8px rgba(79,70,229,.15);
    border-color: #c7d2fe;
}
.cbq-bm-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.cbq-bm-card-type {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
    letter-spacing: .3px;
}
.cbq-bm-card-type.mcq { background: #dbeafe; color: #1d4ed8; }
.cbq-bm-card-type.gk  { background: #e0e7ff; color: #4338ca; }
.cbq-bm-card-type.ca  { background: #dcfce7; color: #15803d; }
.cbq-bm-card-type.pyq { background: #fce7f3; color: #be185d; }

.cbq-bm-card-body {
    flex: 1;
    text-decoration: none !important;
    color: inherit !important;
    display: block;
}
.cbq-bm-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cbq-bm-card-meta {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 14px;
}
.cbq-bm-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff !important;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-decoration: none !important;
    align-self: flex-start;
    transition: all .15s;
}
.cbq-bm-card-cta:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px -2px rgba(79,70,229,.4);
}

.cbq-bm-empty {
    padding: 30px 24px;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}
.cbq-bm-empty p { margin: 0 0 4px; }

/* Question list */
.cbq-bm-q-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cbq-bm-q-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    transition: all .15s;
}
.cbq-bm-q-item:hover { border-color: #c7d2fe; box-shadow: 0 4px 12px -4px rgba(79,70,229,.12); }
.cbq-bm-q-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.cbq-bm-q-test {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cbq-bm-q-remove { position: static; width: 28px; height: 28px; }
.cbq-bm-q-text {
    font-size: 13px;
    color: #0f172a;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cbq-bm-q-go {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    text-decoration: none;
}
.cbq-bm-q-go:hover { text-decoration: underline; }

/* Toast for bookmark feedback */
.cbq-bm-toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    box-shadow: 0 12px 24px -6px rgba(0,0,0,.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all .25s cubic-bezier(.4,0,.2,1);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cbq-bm-toast.show { opacity: 1; transform: translateY(0); }
.cbq-bm-toast.success { background: #15803d; }
.cbq-bm-toast.remove  { background: #475569; }

@media (max-width: 640px) {
    .cbq-bm-hero { padding: 20px 22px; flex-direction: column; align-items: flex-start; }
    .cbq-bm-hero-stats { width: 100%; }
    .cbq-bm-hero-stats .stat { flex: 1; min-width: 0; }
    .cbq-bm-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   v4.4.9 — Dark mode readability for bookmarks
   ============================================================ */
html[data-mcqp-theme="dark"] .cbq-bookmark-btn {
    background: rgba(255,255,255,.06);
    color: #94a3b8;
    border-color: rgba(255,255,255,.1);
}
html[data-mcqp-theme="dark"] .cbq-bookmark-btn:hover {
    background: rgba(255,255,255,.1);
    color: #fbbf24;
}
html[data-mcqp-theme="dark"] .cbq-bookmark-btn.is-bookmarked {
    background: rgba(248,150,2,.15);
    border-color: rgba(248,150,2,.3);
    color: #fbbf24;
}
html[data-mcqp-theme="dark"] .cbq-bookmarks-empty {
    background: #121a32;
    border-color: #233056;
    color: #94a3b8;
}
html[data-mcqp-theme="dark"] .cbq-bookmarks-empty h3 { color: #e2e8f0; }

/* ============================================================
   v4.12.102 — Full dark-mode pass for the /bookmarks/ page
   ============================================================
   The original file only had dark-mode rules for a couple of
   pre-redesign classes (cbq-bookmark-btn, cbq-bookmarks-empty).
   The CURRENT redesigned page classes (cbq-bm-*) had NO dark
   overrides. Combined with the hardcoded data-theme="light"
   in class-cbq-bookmarks.php (also fixed this release), the
   entire page was stuck in light mode even when the user had
   dark theme enabled. */

/* Hero banner — pale blue gradient becomes deep indigo */
.mcqp-fe[data-theme="dark"] .cbq-bm-hero {
    background: linear-gradient(135deg, rgba(79,70,229,.18) 0%, rgba(99,102,241,.12) 50%, rgba(124,58,237,.15) 100%), #0f172a;
    border-color: rgba(99,102,241,.3);
}
.mcqp-fe[data-theme="dark"] .cbq-bm-hero h1 { color: #f1f5f9; }
.mcqp-fe[data-theme="dark"] .cbq-bm-hero p { color: #94a3b8; }

/* Hero stat boxes — white panels become dark panels with lighter numbers */
.mcqp-fe[data-theme="dark"] .cbq-bm-hero-stats .stat {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: none;
}
.mcqp-fe[data-theme="dark"] .cbq-bm-hero-stats .v { color: #a5b4fc; }
.mcqp-fe[data-theme="dark"] .cbq-bm-hero-stats .l { color: #94a3b8; }

/* Tabs */
.mcqp-fe[data-theme="dark"] .cbq-bm-tabs { border-bottom-color: #1f2937; }
.mcqp-fe[data-theme="dark"] .cbq-bm-tab { color: #94a3b8; }
.mcqp-fe[data-theme="dark"] .cbq-bm-tab:hover { color: #cbd5e1; }
.mcqp-fe[data-theme="dark"] .cbq-bm-tab.is-active {
    color: #a5b4fc;
    border-bottom-color: #a5b4fc;
}

/* Section heads + count pill */
.mcqp-fe[data-theme="dark"] .cbq-bm-section-head h2 { color: #f1f5f9; }
.mcqp-fe[data-theme="dark"] .cbq-bm-count {
    background: rgba(255,255,255,.06);
    color: #94a3b8;
}

/* Card grid — white cards become dark cards */
.mcqp-fe[data-theme="dark"] .cbq-bm-card {
    background: #111827;
    border-color: #1f2937;
}
.mcqp-fe[data-theme="dark"] .cbq-bm-card:hover {
    border-color: rgba(99,102,241,.5);
    box-shadow: 0 12px 24px -8px rgba(0,0,0,.4);
}
.mcqp-fe[data-theme="dark"] .cbq-bm-card-title { color: #f1f5f9; }
.mcqp-fe[data-theme="dark"] .cbq-bm-card-meta { color: #64748b; }

/* Card-type chips — same pastel-bg-dark-text problem as analytics stat icons */
.mcqp-fe[data-theme="dark"] .cbq-bm-card-type.mcq { background: rgba(59,130,246,.18); color: #93c5fd; }
.mcqp-fe[data-theme="dark"] .cbq-bm-card-type.gk  { background: rgba(99,102,241,.18); color: #a5b4fc; }
.mcqp-fe[data-theme="dark"] .cbq-bm-card-type.ca  { background: rgba(34,197,94,.18); color: #86efac; }
.mcqp-fe[data-theme="dark"] .cbq-bm-card-type.pyq { background: rgba(236,72,153,.18); color: #f9a8d4; }

/* Empty state card (including PYQ Coming Soon) */
.mcqp-fe[data-theme="dark"] .cbq-bm-empty {
    background: rgba(255,255,255,.02);
    border-color: rgba(255,255,255,.12);
    color: #94a3b8;
}
.mcqp-fe[data-theme="dark"] .cbq-bm-empty strong { color: #e2e8f0; }

/* Question list items */
.mcqp-fe[data-theme="dark"] .cbq-bm-q-item {
    background: #111827;
    border-color: #1f2937;
}
.mcqp-fe[data-theme="dark"] .cbq-bm-q-item:hover {
    border-color: rgba(99,102,241,.5);
    box-shadow: 0 4px 12px -4px rgba(0,0,0,.4);
}
.mcqp-fe[data-theme="dark"] .cbq-bm-q-test { color: #94a3b8; }
.mcqp-fe[data-theme="dark"] .cbq-bm-q-text { color: #f1f5f9; }
.mcqp-fe[data-theme="dark"] .cbq-bm-q-go { color: #a5b4fc; }
