/* ══════════════════════════════════════════════════════════════
   SMFU — Course player, Trader Tools & Market widgets
   Loaded after smfu.css (reuses its :root tokens)
══════════════════════════════════════════════════════════════ */

/* ── Panel (static card, no hover lift) ── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.panel-pad { padding: 1.25rem; }
.text-up   { color: var(--green-light) !important; }
.text-down { color: #f05252 !important; }

/* ── Tools dropdown (navbar + student top bar) ── */
.tools-menu { position: relative; }
.tools-menu-btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-secondary); font: inherit; font-weight: 500; font-size: 0.92rem;
    padding: 0.45rem 0.85rem; border-radius: var(--radius-sm); transition: var(--transition);
}
.tools-menu-btn:hover, .tools-menu-btn.active, .tools-menu.open .tools-menu-btn { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.tools-caret { font-size: 0.65rem; transition: transform 0.2s; }
.tools-menu.open .tools-caret { transform: rotate(180deg); }
.tools-menu-panel {
    display: none; position: absolute; top: calc(100% + 10px); right: 0; z-index: 1100;
    width: 380px; max-width: calc(100vw - 2rem); max-height: 75vh; overflow-y: auto;
    background: var(--bg-elevated); border: 1px solid var(--border-card); border-radius: var(--radius-md);
    box-shadow: 0 18px 50px rgba(0,0,0,0.6); padding: 0.6rem; text-align: left;
}
.tools-menu.open .tools-menu-panel { display: block; animation: toolsIn 0.18s ease; }
@keyframes toolsIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tools-menu-head { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.6rem 0.6rem; font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.tools-menu .tools-menu-head a { font-size: 0.78rem; color: var(--green-light); padding: 0; background: none; }
.tools-menu-group { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0.6rem 0.6rem 0.3rem; font-weight: 700; }
.tools-menu .tools-menu-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm); color: var(--text-primary); background: none;
}
.tools-menu .tools-menu-item:hover { background: rgba(255,255,255,0.05); }
.tools-menu-icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.ti-green  { background: rgba(31,157,85,0.15);  color: var(--green-light); }
.ti-blue   { background: rgba(0,173,239,0.15);  color: var(--blue); }
.ti-yellow { background: rgba(252,209,22,0.15); color: var(--yellow); }
.tools-menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tools-menu-text strong { font-size: 0.86rem; font-weight: 600; }
.tools-menu-text small { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools-menu-soon { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.2rem 0.6rem 0.6rem; }
.tools-menu-chip { font-size: 0.72rem; color: var(--text-muted); border: 1px dashed var(--border-card); border-radius: 999px; padding: 0.25rem 0.6rem; }
.tool-badge { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; padding: 0.18rem 0.5rem; flex-shrink: 0; }
.tool-badge-live { background: rgba(31,157,85,0.18); color: var(--green-light); }
.tool-badge-soon { background: rgba(252,209,22,0.14); color: var(--yellow); }
@media (max-width: 768px) {
    /* Mobile menu centres and shrink-wraps its items; the tools item must span the menu instead */
    .nav-links .nav-tools { align-self: stretch; width: 100%; min-width: 0; }
    .nav-links .tools-menu { width: 100%; }
    .nav-links .tools-menu-btn { width: 100%; justify-content: center; padding: 0.45rem 0.85rem; font-size: inherit; }
    .nav-links .tools-menu-panel { position: static; width: 100%; max-width: 100%; box-shadow: none; margin-top: 0.4rem; max-height: none; padding: 0.4rem; }
    .nav-links .tools-menu-text small { white-space: normal; }
    .nav-links .tools-menu-chip { font-size: 0.7rem; }
    .nav-links { max-height: calc(100svh - 64px); overflow-y: auto; }
}

/* ── Student layout: responsive top bar & sidebar backdrop ── */
.student-topbar { gap: 1rem; }
.student-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.student-topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.student-topbar-date { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; }
.student-page-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-backdrop { display: none; }
@media (max-width: 1024px) {
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 999; backdrop-filter: blur(2px); }
    .student-main { padding: 1.25rem; }
}
@media (max-width: 640px) {
    .student-main { padding: 0.9rem 0.85rem 2rem; }
    .student-topbar { margin-bottom: 1rem; padding-bottom: 0.85rem; }
    .student-page-title { font-size: 1.05rem; }
    .student-topbar-date { display: none; }
    .student-topbar .tools-menu-btn span, .student-topbar .tools-caret { display: none; }
    .student-topbar .tools-menu-btn { padding: 0.45rem 0.6rem; }
}

/* ── Course player ── */
.crumbs { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.25rem; font-size: 0.85rem; color: var(--text-muted); min-width: 0; }
.crumbs a { color: var(--text-secondary); flex-shrink: 0; }
.crumbs span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-player { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.75rem; align-items: start; }
.course-player-main { min-width: 0; }
.course-player-side { position: sticky; top: 1.25rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.player-shell { border-radius: var(--radius-md); overflow: hidden; background: #000; box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid var(--border-subtle); }
.player-shell .video-wrapper { border-radius: 0; }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap; }
.lesson-head > div:first-child { min-width: 0; flex: 1 1 260px; }
.lesson-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green-light); margin-bottom: 0.35rem; }
.lesson-title { font-size: clamp(1.1rem, 2.4vw, 1.45rem); line-height: 1.3; word-break: break-word; }
.lesson-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.95rem; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-card); color: var(--text-primary);
    font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); }
.btn-ghost.disabled { opacity: 0.35; pointer-events: none; }
.btn-complete.done { background: rgba(31,157,85,0.18); border-color: rgba(31,157,85,0.5); color: var(--green-light); }
.lesson-body { color: var(--text-secondary); font-size: 0.93rem; line-height: 1.75; margin-top: 1rem; word-break: break-word; }
.lesson-body img, .lesson-body iframe { max-width: 100%; }
.course-summary { display: flex; gap: 0.9rem; align-items: center; }
.course-summary img { width: 84px; height: 52px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.course-summary h2 { font-size: 0.98rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.progress-ring-row { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.progress-ring { --p: 0; width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    background: conic-gradient(var(--green-light) calc(var(--p) * 1%), rgba(255,255,255,0.08) 0); transition: background 0.6s; }
.progress-ring span { width: 46px; height: 46px; border-radius: 50%; background: var(--bg-elevated); display: grid; place-items: center; font-size: 0.8rem; font-weight: 800; }
.lesson-list-head { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: none; color: var(--text-primary); font: inherit; cursor: pointer; padding: 0; }
.lesson-list-head h3 { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.lesson-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.85rem; max-height: 60vh; overflow-y: auto; padding-right: 0.25rem; }
.lesson-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.7rem; border-radius: var(--radius-sm); color: var(--text-secondary); border: 1px solid transparent; transition: var(--transition); }
.lesson-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.lesson-item.current { background: rgba(31,157,85,0.12); border-color: rgba(31,157,85,0.35); color: var(--text-primary); }
.lesson-item.locked { opacity: 0.6; }
.lesson-num { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.lesson-item.done .lesson-num { background: var(--green); color: #fff; }
.lesson-item.current .lesson-num { box-shadow: 0 0 0 2px var(--green-light); }
.lesson-name { flex: 1; min-width: 0; font-size: 0.86rem; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lesson-tag { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15rem 0.45rem; border-radius: 999px; background: rgba(0,173,239,0.15); color: var(--blue); flex-shrink: 0; }
.locked-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.25rem;
    background: radial-gradient(circle at center, rgba(17,24,39,0.92), rgba(8,12,20,0.98)); }
.locked-overlay i { font-size: 2.2rem; color: var(--yellow); margin-bottom: 0.75rem; }
.resource-link { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 0.9rem; background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); }
.resource-link:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.player-toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 200%); z-index: 2000; background: var(--bg-elevated); border: 1px solid rgba(31,157,85,0.5);
    color: var(--text-primary); padding: 0.75rem 1.1rem; border-radius: 999px; font-size: 0.88rem; box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: transform 0.3s; display: flex; gap: 0.75rem; align-items: center; max-width: calc(100vw - 2rem); }
.player-toast.show { transform: translate(-50%, 0); }
@media (max-width: 1100px) {
    .course-player { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
    .course-player-side { position: static; }
    .lesson-list { max-height: none; }
    .lesson-list.collapsed { display: none; }
}
@media (min-width: 1101px) { .lesson-list-toggle-icon { display: none; } }
@media (max-width: 640px) {
    /* Edge-to-edge video on phones */
    .player-shell { margin: 0 -0.85rem; border-radius: 0; border-left: none; border-right: none; }
    .lesson-actions { width: 100%; }
    .lesson-actions .btn-ghost { flex: 1; justify-content: center; padding: 0.6rem 0.5rem; }
    .lesson-actions .btn-ghost .lbl { display: none; }
    .lesson-actions .btn-complete .lbl { display: inline; }
}

/* ── Market widgets (home, tools) ── */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.market-card { padding: 1rem 1rem 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; transition: var(--transition); color: var(--text-primary); }
.market-card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); color: var(--text-primary); }
.market-card-top { display: flex; justify-content: space-between; align-items: center; }
.market-symbol { font-weight: 700; font-size: 0.92rem; letter-spacing: 0.02em; }
.market-change { font-size: 0.78rem; font-weight: 700; }
.market-price { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.market-sub { font-size: 0.72rem; color: var(--text-muted); }
.sparkline-empty { border-bottom: 1px dashed var(--border-card); opacity: 0.5; }
.market-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-light); animation: livePulse 1.8s infinite; display: inline-block; }
.live-dot.off { background: var(--text-muted); animation: none; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(39,196,104,0.6); } 70% { box-shadow: 0 0 0 8px rgba(39,196,104,0); } 100% { box-shadow: 0 0 0 0 rgba(39,196,104,0); } }

.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.pattern-card { padding: 1.1rem; }
.pattern-card .candle-pattern { background: rgba(0,0,0,0.25); border-radius: 10px; margin-bottom: 0.85rem; }
.pattern-card h3 { font-size: 1rem; margin-bottom: 0.35rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.pattern-card p { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.6; }
.pattern-type { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; }
.pattern-type.bullish { background: rgba(31,157,85,0.18); color: var(--green-light); }
.pattern-type.bearish { background: rgba(240,82,82,0.15); color: #f87171; }
.pattern-type.neutral { background: rgba(139,149,168,0.18); color: var(--text-secondary); }

.tool-card { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; height: 100%; color: var(--text-primary); }
.tool-card:hover { color: var(--text-primary); }
.tool-card.soon { opacity: 0.65; border-style: dashed; }
.tool-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { font-size: 0.87rem; color: var(--text-secondary); line-height: 1.6; flex: 1; }

/* ── Calculators ── */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.calc-input-group { display: flex; }
.calc-input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); min-width: 0; }
.calc-addon { display: flex; align-items: center; padding: 0 0.85rem; background: rgba(255,255,255,0.07); border: 1.5px solid var(--border-card); border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
select.form-control { appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%238b95a8' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat; background-position: right 0.6rem center; padding-right: 2rem; }
select.form-control option { background: #111827; color: #fff; }
.seg { display: inline-flex; background: rgba(255,255,255,0.05); border: 1px solid var(--border-card); border-radius: var(--radius-sm); padding: 3px; }
.seg button { background: none; border: none; color: var(--text-secondary); font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.35rem 0.75rem; border-radius: 6px; cursor: pointer; }
.seg button.active { background: var(--green); color: #fff; }
.result-hero { text-align: center; padding: 1.5rem 1rem; border-radius: var(--radius-md); background: linear-gradient(135deg, rgba(31,157,85,0.18), rgba(0,173,239,0.12)); border: 1px solid rgba(31,157,85,0.35); }
.result-hero .big { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.result-hero .lbl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); margin-top: 0.4rem; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.result-cell { background: rgba(255,255,255,0.04); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; min-width: 0; }
.result-cell small { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.2rem; }
.result-cell strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; word-break: break-all; }
.risk-meter { height: 8px; border-radius: 999px; background: linear-gradient(90deg, #27c468 0%, #fcd116 50%, #f05252 100%); position: relative; margin: 0.6rem 0 0.3rem; }
.risk-meter i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--bg-base); transform: translate(-50%, -50%); transition: left 0.3s; box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
.trade-viz { width: 100%; height: auto; display: block; }
.calc-teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.check-list { list-style: none; display: grid; gap: 0.6rem; margin: 1.25rem 0 1.75rem; }
.check-list li { display: flex; gap: 0.6rem; color: var(--text-secondary); font-size: 0.93rem; }
.check-list li i { color: var(--green-light); margin-top: 0.25rem; }
@media (max-width: 900px) {
    .calc-layout, .calc-teaser { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}
@media (max-width: 480px) {
    .calc-row { grid-template-columns: 1fr; }
}
.tv-chart-wrap { height: 70vh; min-height: 420px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-card); background: #0d1422; }
@media (max-width: 640px) { .tv-chart-wrap { height: 60vh; min-height: 360px; } }
.page-hero { padding: 3rem 0 2rem; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.5rem 0; }
.page-hero p { color: var(--text-secondary); max-width: 620px; }
.table-wrap { overflow-x: auto; }
.rates-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.92rem; }
.rates-table th { padding: 0.8rem 1rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border-card); white-space: nowrap; }
.rates-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rates-table tr:hover td { background: rgba(255,255,255,0.02); }

/* SweetAlert title fits on phones */
.swal2-title { font-size: clamp(1.2rem, 5vw, 1.875em) !important; }
@media (max-width: 640px) {
    .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
    .market-card { padding: 0.8rem 0.8rem 0.5rem; }
    .market-price { font-size: 1.1rem; }
    .market-symbol { font-size: 0.82rem; }
    .market-change { font-size: 0.7rem; }
    .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
    .pattern-card { padding: 0.8rem; }
    .pattern-card h3 { font-size: 0.88rem; flex-direction: column; align-items: flex-start; }
    .pattern-card p { font-size: 0.78rem; }
}

/* ── Dark dropdown lists (optgroup labels default to white on Windows) ── */
select.form-control, select.currency-switcher { color-scheme: dark; }
select.form-control optgroup {
    background: #0d1422; color: #8b95a8;
    font-style: normal; font-weight: 700; font-size: 0.78rem;
}
select.form-control option { background: #111827; color: #f0f4ff; font-weight: 500; }
select.form-control option:checked { background: #1f9d55; color: #fff; }

/* ── Image placeholders: grey pulsing logo while an image loads ── */
img.img-skel {
    background: var(--ph-logo, none) center / 42% auto no-repeat, linear-gradient(135deg, #161e2e, #0f1520);
    color: transparent;
    filter: grayscale(1);
    animation: imgHeartbeat 1.5s ease-in-out infinite;
}
img.img-failed {
    background: var(--ph-logo, none) center / 42% auto no-repeat, linear-gradient(135deg, #161e2e, #0f1520);
    color: transparent;
    filter: grayscale(1);
    opacity: 0.3;
}
img.img-loaded { animation: imgFadeIn 0.35s ease-out; }
@keyframes imgHeartbeat {
    0%, 100% { opacity: 0.28; }
    15%      { opacity: 0.5; }
    30%      { opacity: 0.32; }
    45%      { opacity: 0.55; }
    70%      { opacity: 0.28; }
}
@keyframes imgFadeIn { from { opacity: 0.3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { img.img-skel { animation: none; opacity: 0.35; } }
