/* ═══════════════════════════════════════════════════════════
   One look for every right-side panel — the STEAM Bridge frame (Oct 10 2026)
   AI Assistant · Web Search · Quran · Slides (js/core/SidePanels.js adds .fx-side + the header
   buttons) · STEAM Bridge (css/steam-bridge.css, same values) · Class Tracker panel (width/frame).
   `html body` + !important: bakery-theme.css (loads last) and each panel's own CSS set these too.
   ═══════════════════════════════════════════════════════════ */
:root {
    --fx-w: 420px;
    --fx-w-wide: 640px;
    --fx-line: rgba(100, 116, 139, .22);
    --fx-shadow: -18px 0 50px rgba(15, 23, 42, .16);
}

html body .fx-side {
    width: var(--fx-w) !important;
    max-width: 100% !important;
    height: var(--app-vh, 100vh) !important;
    top: 0 !important;
    background: var(--bg-surface-solid, #ffffff) !important;
    border: 0 !important;
    border-left: 1px solid var(--fx-line) !important;
    border-radius: 0 !important;
    box-shadow: var(--fx-shadow) !important;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif;
}
html body .fx-side.expanded { width: var(--fx-w-wide) !important; }
html body #slidePanelSidebar.fx-side { overflow: visible !important; z-index: var(--z-overlay, 100000) !important; }
@media (max-width: 760px) {
    html body .fx-side, html body .fx-side.expanded { width: 100% !important; }
    .fx-edge { display: none !important; }
}

/* ── header: icon tile + title/subtitle, then ⤢ and × ── */
html body .fx-side .fx-head {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px 12px;
    padding: 16px 16px 12px 20px !important;
    border-bottom: 1px solid var(--fx-line) !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-height: 0;
}
html body .fx-side .fx-title {
    flex: 1 1 0 !important;   /* basis 0: a long title shrinks (ellipsis) instead of pushing ⤢ × to a new line */
    min-width: 0;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
html body .fx-side .fx-tile {
    flex: none;
    display: grid !important;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--fx-accent, #6d5ef6);
    color: #fff !important;
    font-size: 16px;
}
html body .fx-side .fx-tile i { color: #fff !important; margin: 0 !important; }
html body .fx-side .fx-title-text { display: block !important; min-width: 0; overflow: hidden; }
html body .fx-side .fx-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body .fx-side .fx-name {
    display: block !important;
    font-size: 1.08rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    color: var(--text-main, #1e293b) !important;
    -webkit-text-fill-color: currentColor;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif !important;
}
html body .fx-side .fx-sub {
    display: block !important;
    font-size: .74rem;
    font-weight: 500;
    margin-top: 2px;
    color: var(--text-muted, #64748b) !important;
    -webkit-text-fill-color: currentColor;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif !important;
    letter-spacing: 0 !important;
}
.fx-actions { display: flex; gap: 6px; flex: none; margin-inline-start: auto; }
html body .fx-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--fx-line);
    background: transparent;
    color: var(--text-muted, #64748b);
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
html body .fx-icon-btn:hover { background: color-mix(in srgb, var(--fx-accent, #6d5ef6) 10%, transparent); color: var(--text-main, #1e293b); }
body.touch-device .fx-icon-btn { width: 42px; height: 42px; }
.fx-hidden { display: none !important; }

/* ── round edge handle (closes), shown while the panel is open ── */
html .fx-edge {
    position: absolute;
    left: -20px;
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border-radius: 50%;
    border: 3px solid var(--bg-surface-solid, #fff);
    background: var(--fx-accent, #6d5ef6);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: -4px 4px 14px rgba(0, 0, 0, .18);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease .15s, transform .2s ease;
}
html .fx-edge:hover { transform: scale(1.08); }
.ai-sidebar-container.open .fx-edge,
.search-sidebar-container.open .fx-edge,
.quran-sidebar-container.open .fx-edge,
#slidePanelSidebar.open .fx-edge { opacity: 1; pointer-events: auto; }

/* ── AI Assistant: title row on top, its mode/language/export controls on a second row ── */
html body .ai-sidebar .fx-title .fx-tile,
html body .ai-sidebar:not(.expanded) .fx-title span.fx-tile { display: grid !important; }
html body .ai-sidebar:not(.expanded) .fx-title span.fx-title-text,
html body .ai-sidebar:not(.expanded) .fx-title span.fx-name,
html body .ai-sidebar:not(.expanded) .fx-title span.fx-sub { display: block !important; }
html body .ai-header.fx-head .fx-actions { order: 2; }
html body .ai-header.fx-head .ai-controls {
    order: 3;
    flex: 1 1 100% !important;
    justify-content: flex-start !important;
    overflow-x: auto;
    scrollbar-width: none;
}
html body .ai-header.fx-head #aiContextSelect { max-width: none; flex: 1 1 auto; }

/* ── Web Search: its own title markup (the manager rewrites it per tab) styled the same way ── */
html body .search-title.fx-title > i {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--fx-accent, #0ea5e9);
    color: #fff !important;
    font-size: 15px;
}
html body .search-title.fx-title > span:first-of-type {
    font-size: 1.08rem !important;
    font-weight: 800 !important;
    color: var(--text-main, #1e293b) !important;
    -webkit-text-fill-color: currentColor;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif !important;
}

/* ── Quran: keeps its Arabic/English title; reciter picker moves to its own row ── */
html body .quran-header.fx-head .quran-header-controls { order: 3; flex: 1 1 100%; }
html body .quran-header.fx-head .quran-reciter-select { max-width: none !important; width: 100%; }
html body .quran-header.fx-head .fx-actions { order: 2; }

/* ── Slides: same frame, but a compact panel (user: the cards were too big) ──
      280px with one column of cards; ⤢ → 480px with two columns. */
html body #slidePanelSidebar .slide-panel-title.fx-title { font-size: inherit !important; color: inherit !important; }
html body #slidePanelSidebar.fx-side { width: 280px !important; }
html body #slidePanelSidebar.fx-side.expanded { width: 480px !important; }
html body .fx-side .fx-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body #slidePanelSidebar .slide-panel-counter { padding: 6px 16px; font-size: .72rem; }
html body #slidePanelSidebar .slide-panel-list {
    padding: 14px 16px 84px !important;
    gap: 14px !important;
    background: color-mix(in srgb, var(--bg-surface-solid, #fff) 94%, #64748b 6%);
}
html body #slidePanelSidebar.expanded .slide-panel-list {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    align-content: start;
}
html body #slidePanelSidebar .sp-thumb-card {
    border-radius: 10px !important;
    border: 2px solid transparent !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px rgba(100, 116, 139, .2) !important;
    overflow: visible !important;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
}
html body #slidePanelSidebar .sp-thumb-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .14), 0 0 0 1px rgba(100, 116, 139, .25) !important;
}
html body #slidePanelSidebar .sp-thumb-card.active {
    border-color: var(--fx-accent, #6d5ef6) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-accent, #6d5ef6) 22%, transparent), 0 6px 16px rgba(15, 23, 42, .12) !important;
    transform: none !important;
}
/* the preview: the whole page in its real shape (aspect-ratio set per slide), never cropped */
html body #slidePanelSidebar .sp-thumb-img-wrap {
    aspect-ratio: 1123 / 794;
    background: #fff !important;
    border-radius: 8px !important;
    overflow: hidden;
}
html body #slidePanelSidebar .sp-thumb-img-wrap img { object-fit: contain !important; background: #fff; }
html body #slidePanelSidebar .sp-thumb-number { display: none !important; }   /* number is on the preview now */
html body #slidePanelSidebar .sp-num-overlay {
    position: absolute; top: 6px; left: 6px; z-index: 3;
    min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 7px;
    background: rgba(15, 23, 42, .72); color: #fff;
    font: 800 11px/22px 'Outfit', system-ui, sans-serif; text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
html body #slidePanelSidebar .sp-thumb-card.active .sp-num-overlay { background: var(--fx-accent, #6d5ef6); }
/* timer + transition buttons: bottom corners, shown on hover (or when set); always on touch screens */
html body #slidePanelSidebar .sp-timer-badge { bottom: 6px !important; left: 6px !important; }
html body #slidePanelSidebar .sp-transition-badge { bottom: 6px !important; right: 6px !important; }
html body #slidePanelSidebar .sp-timer-badge:not(.has-timer),
html body #slidePanelSidebar .sp-transition-btn:not(.has-transition) { opacity: 0; transition: opacity .15s ease; }
html body #slidePanelSidebar .sp-thumb-card:hover .sp-timer-badge,
html body #slidePanelSidebar .sp-thumb-card:hover .sp-transition-btn,
html body #slidePanelSidebar .sp-thumb-card:focus-within .sp-timer-badge,
html body #slidePanelSidebar .sp-thumb-card:focus-within .sp-transition-btn,
body.touch-device #slidePanelSidebar .sp-timer-badge,
body.touch-device #slidePanelSidebar .sp-transition-btn { opacity: 1 !important; }

/* ── Class Tracker's Quick-marks panel (outside the zoomed body): same width, frame and edge handle ── */
html .ct-host.ct-panel.ct-wide { width: min(calc(var(--fx-w-wide) * var(--app-zoom, 1)), 100vw) !important; }
html .ct-host .ct-edge { --fx-accent: #6f6be8; border-color: #fff; }
html .ct-host.ct-panel.ct-visible:not(.ct-min) .ct-edge { opacity: 1; pointer-events: auto; }
html .ct-host:not(.ct-panel) .ct-edge { display: none; }
html .ct-host.ct-panel {
    width: min(calc(var(--fx-w) * var(--app-zoom, 1)), 100vw) !important;
    box-shadow: var(--fx-shadow) !important;
    border-left: 1px solid var(--fx-line) !important;
    border-radius: 0 !important;
}
/* phones: every side panel is full width (kept last so it wins over the widths above) */
@media (max-width: 760px) { html .ct-host.ct-panel, html .ct-host.ct-panel.ct-wide { width: 100vw !important; } }
@media (max-width: 760px) { html body #slidePanelSidebar.fx-side, html body #slidePanelSidebar.fx-side.expanded { width: 100% !important; } }
/* previews show instantly (no fade/shimmer) */
html body #slidePanelSidebar .sp-thumb-img-wrap img.sp-lazy { opacity: 1 !important; animation: none !important; transition: none !important; }
