/* ── Layout ── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 32px;
    transition: margin .3s;
    direction: rtl;
    min-width: 0;
}
@media(max-width:768px){
    .main-content { margin-left:0; padding:16px; padding-top:64px; }
}

/* ── Page header ── */
.page-header { margin-bottom: 32px; }
.page-title {
    font-size: 1.5rem; font-weight: 700;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.page-title i { color: var(--gold); }
.page-subtitle { color: var(--text-muted); font-size: .9rem; }

/* ── Card grid ── */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 860px;
}
@media(max-width:600px){ .tutorial-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.tutorial-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: box-shadow .22s ease, border-color .22s ease, transform .22s ease;
    position: relative;
}
.tutorial-card:hover {
    box-shadow: var(--shadow-md), -3px 0 0 0 var(--gold) inset;
    border-color: var(--border-gold);
    transform: translateY(-2px);
}
.card-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    background: var(--gold-glow);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; color: var(--gold);
}
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: .97rem; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.card-desc { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.card-arrow { color: var(--border-medium); font-size: .8rem; flex-shrink: 0; }
.tutorial-card:hover .card-arrow { color: var(--gold); }

/* ── Overlay ── */
.drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 900;
    opacity: 0; pointer-events: none;
    transition: opacity .28s ease;
}
.drawer-overlay.active { opacity: 1; pointer-events: all; }

/* ── Drawer panel ── */
.drawer-panel {
    position: fixed; top: 0; right: 0;
    width: 560px; max-width: 100vw; height: 100vh;
    background: var(--bg-secondary);
    z-index: 901;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s ease;
    direction: rtl;
    box-shadow: -8px 0 40px rgba(0,0,0,0.12);
}
.drawer-panel.active { transform: translateX(0); }
.drawer-panel.iframe-fullscreen {
    width: 100vw !important;
    max-width: 100vw !important;
}
@media(max-width:600px){ .drawer-panel { width: 100vw; } }

/* ── Drawer header ── */
.drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    position: sticky; top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}
.drawer-header-left { display: flex; align-items: center; gap: 10px; }
.drawer-icon { font-size: 1.2rem; color: var(--gold); }
.drawer-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.drawer-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem; padding: 4px 8px;
    border-radius: 6px; transition: color .15s, background .15s;
}
.drawer-close:hover { color: var(--text-primary); background: var(--bg-primary); }

/* ── Progress bar ── */
.drawer-progress-wrap {
    height: 3px; background: var(--border-light); flex-shrink: 0;
}
.drawer-progress-bar {
    height: 100%; background: var(--gold);
    transition: width .3s ease;
    width: 0%;
}

/* ── Drawer content ── */
.drawer-content {
    flex: 1; overflow-y: auto; padding: 24px 20px;
    position: relative;
}

/* ── Step animations ── */
.step-slide {
    animation: stepIn .2s ease forwards;
}
.step-slide-out {
    animation: stepOut .2s ease forwards;
}
@keyframes stepIn {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes stepOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(18px); }
}

/* ── Step content typography ── */
.step-body { font-size: .93rem; line-height: 1.8; color: var(--text-secondary); }
.step-body h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.step-body p { margin-bottom: 10px; }
.step-body ul { padding-right: 18px; margin-bottom: 10px; }
.step-body li { margin-bottom: 5px; }
.step-body .highlight { color: var(--gold); font-weight: 600; }

/* ── Drawer footer ── */
.drawer-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-secondary);
}
@media(max-width:600px){
    .drawer-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
.drawer-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: 9px; border: none;
    font-family: var(--font-fa); font-size: .88rem; font-weight: 600;
    cursor: pointer; transition: background .18s, color .18s;
}
.btn-next { background: var(--gold); color: #fff; }
.btn-next:hover { background: var(--gold-dim); }
.btn-prev { background: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border-light); }
.btn-prev:hover { background: var(--border-light); }
.btn-prev:disabled { opacity: .35; cursor: default; }
.step-counter { font-size: .85rem; color: var(--text-muted); font-family: var(--font-en); }

/* ── Visual containers ── */
.visual-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex; align-items: center; justify-content: center;
    min-height: 160px;
}

/* ── Broker signup visuals ── */
.mock-form { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }
.mock-field {
    border: 1px solid var(--border-medium); border-radius: 8px;
    padding: 9px 12px; font-size: .85rem; color: var(--text-secondary);
    background: var(--bg-secondary); overflow: hidden; white-space: nowrap;
    font-family: var(--font-en);
}
.mock-field.typing { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.mock-btn {
    background: var(--gold); color: #fff; border: none;
    border-radius: 8px; padding: 10px; font-family: var(--font-fa);
    font-size: .88rem; font-weight: 600; cursor: pointer;
    text-align: center;
}
.envelope-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.envelope-icon { font-size: 3rem; color: var(--gold); animation: envelopeOpen .6s ease .2s both; }
@keyframes envelopeOpen {
    0%   { transform: scale(0.6) rotate(-8deg); opacity: 0; }
    60%  { transform: scale(1.1) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.check-appear { font-size: 1.5rem; color: var(--green); animation: checkPop .4s ease .7s both; }
@keyframes checkPop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.account-number-wrap { display: flex; align-items: center; gap: 10px; }
.account-number {
    font-family: var(--font-en); font-size: 1.1rem; letter-spacing: 2px;
    color: var(--text-primary); font-weight: 500;
    background: var(--bg-primary); border: 1px solid var(--border-light);
    border-radius: 8px; padding: 8px 14px;
}
.copy-btn {
    background: none; border: 1px solid var(--border-medium); border-radius: 7px;
    padding: 7px 11px; cursor: pointer; color: var(--text-muted);
    transition: all .15s;
}
.copy-btn:hover, .copy-btn.copied { border-color: var(--gold); color: var(--gold); }

/* ── Hierarchy diagram ── */
.hierarchy-diagram { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.hier-node {
    background: var(--bg-secondary); border: 1px solid var(--border-gold);
    border-radius: 9px; padding: 8px 20px; font-size: .85rem; font-weight: 600;
    color: var(--text-primary); opacity: 0;
    animation: nodeAppear .4s ease forwards;
}
.hier-node:nth-child(1) { animation-delay: .1s; }
.hier-node:nth-child(3) { animation-delay: .35s; }
.hier-node:nth-child(5) { animation-delay: .6s; }
@keyframes nodeAppear {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hier-arrow { color: var(--gold); font-size: .8rem; }

/* ── Copy trade diagram ── */
.copytrade-diagram { width: 100%; max-width: 340px; }
.master-node {
    text-align: center; background: var(--gold-glow); border: 1px solid var(--border-gold);
    border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: .9rem;
    color: var(--gold); margin-bottom: 8px;
}
.follower-row { display: flex; justify-content: space-around; gap: 8px; }
.follower-node {
    flex: 1; text-align: center; background: var(--bg-primary);
    border: 1px solid var(--border-light); border-radius: 10px;
    padding: 8px 4px; font-size: .78rem; color: var(--text-secondary);
    opacity: 0; animation: nodeAppear .35s ease forwards;
}
.follower-node:nth-child(1) { animation-delay: .5s; }
.follower-node:nth-child(2) { animation-delay: .7s; }
.follower-node:nth-child(3) { animation-delay: .9s; }
.flow-arrows { display: flex; justify-content: space-around; padding: 4px 20px; }
.flow-arrow { color: var(--gold); font-size: .85rem; opacity: 0; animation: nodeAppear .3s ease forwards; }
.flow-arrow:nth-child(1) { animation-delay: .4s; }
.flow-arrow:nth-child(2) { animation-delay: .4s; }
.flow-arrow:nth-child(3) { animation-delay: .4s; }

/* ── Ratio slider ── */
.ratio-wrap { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.ratio-slider { width: 100%; accent-color: var(--gold); }
.ratio-display { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-secondary); }
.ratio-display span { font-family: var(--font-en); font-weight: 600; color: var(--gold); }

/* ── Pie chart ── */
.pie-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pie-svg { width: 120px; height: 120px; }
.pie-legend { display: flex; gap: 16px; font-size: .8rem; color: var(--text-secondary); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 5px; }

/* ── Risk chart ── */
.risk-chart-wrap { width: 100%; }
.risk-btns { display: flex; gap: 8px; margin-bottom: 12px; justify-content: center; }
.risk-btn {
    padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border-medium);
    background: var(--bg-secondary); font-family: var(--font-fa); font-size: .82rem;
    cursor: pointer; transition: all .15s; color: var(--text-secondary);
}
.risk-btn.active { background: var(--gold); border-color: var(--gold); color: #fff; }

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-primary); border-radius: 10px; padding: 12px 14px;
    border: 1px solid var(--border-light); opacity: 0;
    animation: nodeAppear .3s ease forwards;
}
.check-item:nth-child(1) { animation-delay: .05s; }
.check-item:nth-child(2) { animation-delay: .15s; }
.check-item:nth-child(3) { animation-delay: .25s; }
.check-item:nth-child(4) { animation-delay: .35s; }
.check-item:nth-child(5) { animation-delay: .45s; }
.check-item i { color: var(--green); font-size: 1rem; flex-shrink: 0; }
.check-item span { font-size: .88rem; color: var(--text-secondary); }

/* ── Getting started checklist ── */
.gs-checklist { display: flex; flex-direction: column; gap: 10px; }
.gs-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-primary); border-radius: 10px; padding: 13px 16px;
    border: 1px solid var(--border-light); transition: border-color .3s, background .3s;
}
.gs-item.done { border-color: var(--green); background: rgba(46,125,100,0.05); }
.gs-tick {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid var(--border-medium); display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; transition: all .3s;
    font-size: .75rem; color: transparent;
}
.gs-item.done .gs-tick { border-color: var(--green); background: var(--green); color: #fff; }
.gs-label { font-size: .9rem; font-weight: 500; color: var(--text-secondary); }
.gs-item.done .gs-label { color: var(--text-primary); }

/* ── Broker card ── */
.broker-card {
    background: var(--bg-secondary); border: 1px solid var(--border-gold);
    border-radius: 14px; padding: 20px; width: 100%; max-width: 320px;
    display: flex; flex-direction: column; gap: 12px;
}
.broker-logo {
    width: 48px; height: 48px; border-radius: 10px;
    background: var(--gold-glow); display: flex; align-items: center;
    justify-content: center; font-size: 1.3rem; color: var(--gold);
}
.broker-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.broker-facts { display: flex; flex-direction: column; gap: 6px; }
.broker-fact { display: flex; justify-content: space-between; font-size: .82rem; }
.fact-label { color: var(--text-muted); }
.fact-val { color: var(--text-primary); font-weight: 500; }
.stamp-badge {
    align-self: flex-start;
    background: rgba(46,125,100,0.1); border: 1px solid var(--green);
    color: var(--green); border-radius: 8px; padding: 5px 12px;
    font-size: .8rem; font-weight: 700;
    animation: stampIn .4s ease .3s both;
}
@keyframes stampIn {
    from { transform: scale(1.4) rotate(-4deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
.coming-soon { font-size: .82rem; color: var(--text-muted); text-align: center; margin-top: 4px; opacity: 0; animation: nodeAppear .4s ease .8s forwards; }

/* ── Page wireframes ── */
.wireframe-wrap { position: relative; width: 100%; }
.wireframe-svg { width: 100%; border-radius: 10px; }
.wf-tooltip {
    position: absolute; background: var(--text-primary); color: #fff;
    font-size: .78rem; padding: 5px 10px; border-radius: 7px;
    pointer-events: none; opacity: 0; transition: opacity .2s;
    max-width: 180px; text-align: center; line-height: 1.4; z-index: 10;
    white-space: normal;
}
.wf-tooltip.show { opacity: 1; }

/* ── Balance animate ── */
.balance-pill-mock {
    background: var(--gold-glow); border: 1px solid var(--border-gold);
    border-radius: 20px; padding: 8px 20px; font-size: .95rem;
    font-family: var(--font-en); color: var(--gold); font-weight: 600;
    animation: pillAppear .5s ease .4s both;
}
@keyframes pillAppear {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Iframe page visual ── */
.iframe-visual {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    gap: 0;
}
.iframe-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    border: none;
    background: var(--bg-primary);
}
.page-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.iframe-hotspot-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.iframe-hotspot {
    position: absolute;
    transform: translate(-50%, -50%) scale(1);
    transition: left .28s ease, top .28s ease, opacity .18s ease, transform .18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.hotspot-pulse {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(184,148,79,0.25);
    animation: hotspotPulse 1.6s ease-out infinite;
}
.hotspot-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(184,148,79,0.5);
    position: relative;
    z-index: 1;
}
@keyframes hotspotPulse {
    0%   { transform: scale(0.6); opacity: .8; }
    70%  { transform: scale(1.8); opacity: 0; }
    100% { transform: scale(0.6); opacity: 0; }
}
.hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: #fff;
    font-size: .78rem;
    line-height: 1.5;
    padding: 7px 11px;
    border-radius: 8px;
    width: 180px;
    text-align: center;
    pointer-events: none;
    white-space: normal;
    z-index: 3;
    direction: rtl;
}
.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
}
/* Flip tooltip to bottom when hotspot is near the top */
.iframe-hotspot[style*="top:1"],
.iframe-hotspot[style*="top:2"] {
    /* tooltip appears below dot instead */
}
.hotspot-tooltip-below {
    top: calc(100% + 10px);
    bottom: auto;
}
.hotspot-tooltip-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--text-primary);
}

/* ── Hotspot nav bar ── */
.iframe-hotspot-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 6px 0 2px;
}
.hs-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    transition: all .15s;
}
.hs-nav-btn:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-glow);
}
.hs-nav-btn:disabled { opacity: .35; cursor: default; }
.hs-counter {
    font-size: .82rem;
    color: var(--text-muted);
    font-family: var(--font-en);
    min-width: 56px;
    text-align: center;
}
