/* ═══════════════════════════════════════════════════════════
   STEAM Bridge — right-side slider (Oct 2026)
   Same family as the AI Assistant / Web Search sidebars: slides in from the right,
   the board stays usable beside it (no blocking backdrop on wide screens).
   ═══════════════════════════════════════════════════════════ */

.steam-side-container {
    --st-bg: var(--bg-surface-solid, #ffffff);
    --st-soft: color-mix(in srgb, var(--st-bg) 92%, #6366f1 8%);
    --st-line: rgba(100, 116, 139, .22);
    --st-text: var(--text-main, #1e293b);
    --st-muted: color-mix(in srgb, var(--st-text) 62%, transparent);
    --st-accent: #6d5ef6;
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay, 100000);
    pointer-events: none;
    direction: ltr; /* keep it on the physical right in Arabic too */
}

.steam-side {
    position: absolute;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    height: var(--app-vh, 100vh);
    display: flex;
    flex-direction: column;
    background: var(--st-bg);
    color: var(--st-text);
    border-left: 1px solid var(--st-line);
    box-shadow: -18px 0 50px rgba(15, 23, 42, .16);
    transform: translateX(105%);
    transition: transform var(--side-panel-slide, .32s cubic-bezier(.22, 1, .36, 1)), width var(--side-panel-slide, .32s ease);
    pointer-events: auto;
    font-family: 'Outfit', 'Cairo', system-ui, sans-serif;
    z-index: 2;
}
.steam-side.wide { width: 640px; }
.steam-side-container.open .steam-side { transform: translateX(0); }

/* click-away only on small screens; on boards/laptops you keep working on the slide */
.steam-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .28); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
@media (max-width: 760px) {
    .steam-side-container.open .steam-backdrop { opacity: 1; pointer-events: auto; }
    .steam-side, .steam-side.wide { width: 100%; }
}

/* round handle on the panel edge (like the AI sidebar) */
.steam-edge-btn {
    position: absolute;
    left: -20px;
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    border-radius: 50%;
    border: 3px solid var(--st-bg);
    background: var(--st-accent);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: -4px 4px 14px rgba(0, 0, 0, .18);
    opacity: 0;
    transition: opacity .2s ease .15s, transform .2s ease;
}
.steam-side-container.open .steam-edge-btn { opacity: 1; }
.steam-edge-btn:hover { transform: scale(1.08); }
@media (max-width: 760px) { .steam-edge-btn { display: none; } }

/* ── header ── */
.steam-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 12px 20px;
    border-bottom: 1px solid var(--st-line);
}
.steam-head-text { flex: 1; min-width: 0; }
.steam-title { font-size: 1.08rem; font-weight: 800; line-height: 1.2; color: var(--st-text); }
.steam-subtitle { font-size: .74rem; color: var(--st-muted); margin-top: 2px; }
.steam-logo-ring { display: flex; gap: 1px; padding: 6px 8px; border-radius: 10px; background: #111827; font-weight: 900; font-size: .78rem; letter-spacing: 1px; }
.steam-letter.s { color: #34d399; } .steam-letter.t { color: #60a5fa; } .steam-letter.e { color: #fbbf24; }
.steam-letter.a { color: #f472b6; } .steam-letter.m { color: #a78bfa; }
.steam-icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--st-line);
    background: transparent; color: var(--st-muted); cursor: pointer; display: grid; place-items: center;
    transition: background .15s ease, color .15s ease;
}
.steam-icon-btn:hover { background: var(--st-soft); color: var(--st-text); }

/* ── topic ── */
.steam-topic { padding: 12px 20px 4px; }
.steam-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--st-muted); margin: 10px 0 6px; }
.steam-topic .steam-label { margin-top: 0; }
.steam-label i { margin-inline-end: 4px; }
.steam-opt { text-transform: none; font-weight: 500; letter-spacing: 0; }
.steam-topic-row { display: flex; gap: 8px; }
.steam-topic-input, .steam-textarea, .steam-select {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid var(--st-line);
    border-radius: 12px;
    background: var(--st-bg);
    color: var(--st-text);
    font: inherit;
    font-size: .92rem;
    padding: 10px 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.steam-topic-input { flex: 1; min-width: 0; }
.steam-textarea { resize: vertical; min-height: 72px; line-height: 1.45; unicode-bidi: plaintext; }
.steam-topic-input:focus, .steam-textarea:focus, .steam-select:focus { border-color: var(--st-accent); box-shadow: 0 0 0 3px rgba(109, 94, 246, .15); }
.steam-detect-btn {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 12px;
    border: 1.5px solid rgba(109, 94, 246, .35); background: rgba(109, 94, 246, .08); color: var(--st-accent);
    font: 700 .8rem/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.steam-detect-btn:hover { background: rgba(109, 94, 246, .15); }
.steam-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.steam-chips::-webkit-scrollbar { display: none; }
.steam-chip {
    flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px;
    border: 1px solid var(--st-line); background: transparent; color: var(--st-muted);
    font: 600 .76rem/1 inherit; font-family: inherit; cursor: pointer; transition: all .15s ease;
}
.steam-chip:hover { color: var(--st-text); border-color: rgba(109, 94, 246, .4); }
.steam-chip.active { background: var(--st-accent); border-color: var(--st-accent); color: #fff; }

/* ── tabs ── */
.steam-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 20px 0; padding: 4px; border-radius: 14px; background: var(--st-soft); }
.steam-tab {
    display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; border-radius: 10px;
    background: transparent; color: var(--st-muted); font: 700 .8rem/1 inherit; font-family: inherit; cursor: pointer; transition: all .15s ease;
}
.steam-tab.active { background: var(--st-bg); color: var(--st-text); box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.steam-tab.active i { color: var(--st-accent); }
.steam-tab[data-tab="skills"].active i { color: #0284c7; }

/* ── body ── */
.steam-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 28px; -webkit-overflow-scrolling: touch; }
.steam-tab-content[hidden], .steam-results[hidden], .steam-loading[hidden], .fs-pane[hidden], .fs-results[hidden], .steam-activity-results[hidden] { display: none !important; }
.steam-hint { margin: 0 0 12px; font-size: .82rem; line-height: 1.45; color: var(--st-muted); }
.steam-hint i { color: var(--st-accent); margin-inline-end: 4px; }

.steam-primary, .steam-secondary, .steam-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; cursor: pointer;
    font: 700 .9rem/1 inherit; font-family: inherit; transition: transform .1s ease, filter .15s ease, background .15s ease;
}
.steam-primary { width: 100%; min-height: 48px; border: 0; color: #fff; background: linear-gradient(135deg, #6d5ef6, #8b5cf6); box-shadow: 0 6px 18px rgba(109, 94, 246, .3); }
.fs-go { background: linear-gradient(135deg, #0284c7, #6d5ef6); }
.steam-primary:hover { filter: brightness(1.06); }
.steam-primary:active, .steam-secondary:active, .steam-ghost:active { transform: scale(.97); }
.steam-primary:disabled, .steam-secondary:disabled, .steam-ghost:disabled { opacity: .6; cursor: wait; }
.steam-secondary { border: 0; color: #fff; background: var(--c, var(--st-accent)); padding: 0 14px; min-height: 38px; }
.steam-ghost { border: 1px solid var(--st-line); color: var(--st-text); background: transparent; padding: 0 12px; min-height: 38px; }
.steam-ghost:hover { background: var(--st-soft); }
.small.steam-primary { width: auto; min-height: 38px; padding: 0 14px; font-size: .82rem; box-shadow: none; }
.small { font-size: .8rem; }

.steam-loading { display: flex; align-items: center; gap: 12px; padding: 18px 4px; color: var(--st-muted); font-size: .86rem; }
.steam-loading-ring { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(109, 94, 246, .2); border-top-color: var(--st-accent); animation: steam-spin .8s linear infinite; }
@keyframes steam-spin { to { transform: rotate(360deg); } }

.steam-results { margin-top: 16px; }
.steam-results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.steam-results-title { font-size: .86rem; color: var(--st-muted); margin: 14px 0 10px; }
.steam-results-head .steam-results-title { margin: 0; }
.steam-results-title i { color: var(--st-accent); margin-inline-end: 4px; }
.steam-cards { display: grid; gap: 10px; }
.steam-side.wide .steam-cards { grid-template-columns: 1fr 1fr; }

/* ── a result card ── */
.steam-card {
    position: relative;
    border: 1px solid var(--st-line);
    border-inline-start: 4px solid var(--c, var(--st-accent));
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--st-bg);
    animation: steam-in .35s ease both;
}
.steam-cards .steam-card { margin-bottom: 0; }
@keyframes steam-in { from { opacity: 0; transform: translateY(6px); } }
.steam-card h4 { margin: 4px 0 6px; font-size: .98rem; font-weight: 800; color: var(--st-text) !important; -webkit-text-fill-color: currentColor; font-family: 'Outfit', 'Cairo', system-ui, sans-serif !important; letter-spacing: 0; }
.steam-card p { margin: 0 0 8px; font-size: .88rem; line-height: 1.5; }
.steam-card-domain { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--c); margin-bottom: 6px; }
.steam-card-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); }
.steam-card-top { display: flex; flex-wrap: wrap; gap: 6px; }
.steam-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 800; padding: 4px 9px; border-radius: 999px; background: var(--c); color: #fff; }
.steam-badge.soft { background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.steam-meta { color: var(--st-muted); font-size: .84rem !important; }
.steam-meta i { color: var(--c, var(--st-accent)); }
.steam-why { font-size: .82rem !important; color: var(--st-muted); }
.steam-why i { color: #10b981; }
.steam-steps { margin: 0 0 8px; padding-inline-start: 20px; font-size: .86rem; line-height: 1.5; }
.steam-kws { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.steam-kws span { font-size: .72rem; padding: 3px 9px; border-radius: 999px; background: var(--st-soft); color: var(--st-muted); }
.steam-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.steam-error { padding: 12px 14px; border-radius: 12px; background: #fef2f2; color: #b91c1c; font-size: .85rem; }

/* ── Future Skills ── */
.fs-intro { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, rgba(2, 132, 199, .09), rgba(109, 94, 246, .09)); font-size: .82rem; line-height: 1.45; margin-bottom: 12px; }
.fs-intro strong { font-size: .9rem; }
.fs-intro-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #0284c7; color: #fff; }
.steam-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--st-soft); }
.steam-seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--st-muted); font: 700 .82rem/1 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.steam-seg button.active { background: var(--st-bg); color: var(--st-text); box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.steam-seg.small button { min-height: 34px; font-size: .78rem; }
.steam-seg.tiny { padding: 3px; }
.steam-seg.tiny button { flex: none; min-width: 38px; min-height: 30px; font-size: .78rem; }
.steam-seg.tiny button[data-l="ar"] { font-family: 'Cairo', 'Tajawal', sans-serif; font-size: 1rem; }
.fs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 12px; }
.fs-check { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; cursor: pointer; }
.fs-check input { width: 18px; height: 18px; accent-color: var(--st-accent); }
.fs-results { margin-top: 14px; }
.fs-compare { display: grid; gap: 8px; margin-bottom: 10px; }
.fs-before, .fs-after { border-radius: 14px; padding: 12px 14px; font-size: .9rem; line-height: 1.5; }
.fs-before { background: var(--st-soft); color: var(--st-muted); margin-bottom: 10px; }
.fs-compare .fs-before { margin-bottom: 0; }
.fs-after { background: linear-gradient(135deg, rgba(79, 70, 229, .1), rgba(2, 132, 199, .1)); border: 1px solid rgba(79, 70, 229, .25); font-weight: 600; }
.fs-tag { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; opacity: .75; }
.fs-after .fs-tag { color: #4f46e5; opacity: 1; }
.fs-criteria { margin: 0 0 10px; padding-inline-start: 20px; font-size: .86rem; line-height: 1.5; }
.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.fs-chip { font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.fs-chip.fw { --c: #64748b; font-weight: 600; }
.fs-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #0284c7; color: #fff; font-size: .75rem; margin-inline-end: 4px; }
.fs-answer { margin: 0 0 8px; font-size: .85rem; }
.fs-answer summary { cursor: pointer; color: #0284c7; font-weight: 700; }

/* KaTeX inside the panel */
.steam-side .katex { font-size: 1.05em; }

/* touch: bigger targets */
body.touch-device .steam-chip { padding: 9px 13px; }
body.touch-device .steam-ghost, body.touch-device .steam-secondary, body.touch-device .small.steam-primary { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
    .steam-side, .steam-card, .steam-backdrop { transition: none; animation: none; }
}

/* ── tables / graphs / charts inside the panel ── */
.st-visual { margin: 8px 0 10px; }
.st-visual .rv-figure { margin: 0 0 6px !important; }
.st-visual canvas { border: 1px solid var(--st-line); border-radius: 10px; }
.st-visual .rv-table { font-size: .82rem; color: #0f172a; }
.st-visual figcaption { color: var(--st-text) !important; }
.st-rich .mc-p { margin: 0 0 6px; font-size: .88rem; line-height: 1.5; }
.st-rich .mc-li { display: flex; gap: 8px; font-size: .88rem; margin: 0 0 4px; }
.st-rich .mc-li > b { color: var(--c, var(--st-accent)); }
.fs-questions { margin: 8px 0; padding-inline-start: 22px; font-size: .88rem; line-height: 1.55; }
.fs-questions li { margin-bottom: 6px; }
.fs-marks { font-weight: 800; color: #0284c7; white-space: nowrap; }
.fs-answer ol { margin: 6px 0 0; padding-inline-start: 20px; }


/* Arabic: the container stays LTR so the panel sits on the physical right; the panel content reads right-to-left */
[dir="rtl"] .steam-side { direction: rtl; }
[dir="rtl"] .steam-logo-ring { direction: ltr; }
