// ============================================================
// TRADING BASICS PAGE
// ============================================================

const BASICS_MODULES = [
  { icon: 'book',    color: 'acid', title: 'Ce este trading-ul?',
    desc: 'Definiția corectă, diferența dintre investing și trading, ce pot și ce nu pot face un trader retail.',
    time: '8 min', level: 'Începător' },
  { icon: 'globe',   color: 'cyan', title: 'Ce este NASDAQ?',
    desc: 'Index, futures (NQ, MNQ), sesiuni, lichiditate, ce mișcă prețul și cine cumpără la ce ore.',
    time: '10 min', level: 'Începător' },
  { icon: 'candle',  color: 'blue', title: 'Ce sunt futures?',
    desc: 'Contracte futures, leverage, margin, expirare, settlement. Diferența vs CFD-uri și de ce contează.',
    time: '12 min', level: 'Începător' },
  { icon: 'shield',  color: 'cyan', title: 'Ce este un prop firm?',
    desc: 'Modelul de business, ce e funding-ul, ce reguli sunt comune, ce capcane să eviți.',
    time: '14 min', level: 'Intermediar' },
  { icon: 'target',  color: 'blue', title: 'Ce este risk management?',
    desc: 'Sizing, stop loss, daily loss limit, drawdown — fără asta, restul nu contează.',
    time: '15 min', level: 'Esențial' },
  { icon: 'layout',  color: 'gold', title: 'Ce este un trading plan?',
    desc: 'Cum scrii unul real, ce trebuie să conțină, cum îl testezi și cum îl ajustezi în timp.',
    time: '11 min', level: 'Intermediar' },
  { icon: 'brain',   color: 'gold', title: 'Psihologia în trading',
    desc: 'FOMO, revenge trading, tilt, overconfidence — sursele și antidoturile.',
    time: '13 min', level: 'Esențial' },
];

const CONCEPTS = [
  {
    id: 'po3',
    title: 'Power of Three (PO3)',
    color: 'gold',
    summary: 'Accumulation → Manipulation → Distribution. Trei faze pe care marketul le repetă constant.',
    body: 'PO3 descrie ciclul instituțional: faza 1 — accumulation (range strâns, lichiditate strânsă), faza 2 — manipulation (sweep peste/sub range pentru a colecta stop-uri), faza 3 — distribution (mișcarea reală în direcția opusă manipulării). Recunoști PO3 = anticipezi sweep-ul și prinzi mișcarea reală.',
    formula: 'AMD = Accumulation → Manipulation → Distribution'
  },
  {
    id: 'reversal',
    title: 'Reversal',
    color: 'rose',
    summary: 'Schimbare clară de direcție validată de BOS + structură nouă.',
    body: 'Un reversal real necesită Break of Structure (BOS) în direcția opusă, urmat de un retest valid al order block-ului sau FVG-ului care a produs displacement-ul. Fără BOS și fără urmărire de structură nouă, nu e reversal — e doar pullback temporar.',
    formula: 'BOS opposite + new structure low/high = Reversal'
  },
  {
    id: 'retracement',
    title: 'Retracement',
    color: 'cyan',
    summary: 'O corecție temporară împotriva trendului, fără a-l invalida.',
    body: 'Retracement-ul este o mișcare în direcția opusă trendului dominant, dar care NU sparge structura. Zonele uzuale de retracement: Fibonacci 38.2–61.8%, OB-ul anterior, FVG-ul care a produs displacement. Diferența vs reversal: retracement = pullback, reversal = schimbare reală de direcție.',
    formula: 'Pullback fără BOS = Retracement · Pullback + BOS = Reversal'
  },
  {
    id: 'liquidity',
    title: 'Liquidity',
    color: 'acid',
    summary: 'Locurile unde stau order-urile în piață — sub low-urile recente, peste high-urile recente.',
    body: 'Lichiditatea înseamnă bani parcați sub formă de stop loss-uri și pending orders. Marketul caută aceste zone pentru a-și executa volumul. Identifici liquidity pool-urile uitându-te la swing high/low, equal highs/lows și sesiunile anterioare. Cea mai utilă întrebare: "unde au pus retailul stop-urile?"',
    formula: 'External liquidity = swing extremes · Internal liquidity = mid-range'
  },
  {
    id: 'orderblock',
    title: 'Order Block (OB)',
    color: 'cyan',
    summary: 'Ultima candelă bearish înainte de o mișcare bullish puternică (sau invers).',
    body: 'Un order block reprezintă zona în care instituțiile au plasat volum semnificativ. Devine zonă de interes la retest. Confirmarea vine cu reacție clară: rejection wick, FVG creat, displacement în direcția opusă.',
    formula: 'Bullish OB = last bearish candle before BOS · Bearish OB = last bullish candle before BOS'
  },
  {
    id: 'fvg',
    title: 'Fair Value Gap (FVG)',
    color: 'blue',
    summary: 'Imbalance de 3 candele — gap între wick-ul candelei 1 și wick-ul candelei 3.',
    body: 'FVG-ul indică o mișcare suficient de rapidă încât să nu existe tranzacționare în acel interval. Marketul revine adesea pentru a "rebalansa" acel gap. Folosit ca zonă de entry sau ca țintă.',
    formula: 'High[1] vs Low[3] (bullish FVG) · Low[1] vs High[3] (bearish FVG)'
  },
  {
    id: 'ifvg',
    title: 'Inverse FVG (IFVG)',
    color: 'gold',
    summary: 'Un FVG care a fost umplut și acum acționează în direcția opusă inițială.',
    body: 'Când un FVG bullish e umplut complet și prețul rejectează acea zonă închizând sub el, devine inverse — acum e zonă de rezistență. Concept puternic pentru continuation trades.',
    formula: 'Filled FVG + opposite reaction = IFVG'
  },
  {
    id: 'breaker',
    title: 'Breaker Block',
    color: 'acid',
    summary: 'Un order block care a fost violat, urmat de o întoarcere a structurii.',
    body: 'Breaker = OB care nu și-a respectat rolul. După invalidare, dacă structura se inversează, OB-ul violat devine breaker block și acționează în direcția opusă inițială.',
    formula: 'Failed OB + BOS opposite = Breaker'
  },
  {
    id: 'displacement',
    title: 'Displacement',
    color: 'cyan',
    summary: 'O mișcare impulsivă, cu candele mari și volum, care indică o intenție clară.',
    body: 'Displacement-ul confirmă că instituționalii au intrat. Caută candele cu body mare relativ la average true range, închidere puternică și creare de FVG. Fără displacement, e doar zgomot.',
    formula: 'Large body candle + FVG created + BOS'
  },
  {
    id: 'rr',
    title: 'Risk-to-Reward (R:R)',
    color: 'blue',
    summary: 'Raportul între riscul pe trade și potențialul de câștig.',
    body: 'Un trade 1:3 înseamnă riști 1R pentru a câștiga 3R. Cu win rate de 35% și R:R mediu de 1:3, ești profitabil pe termen lung. Calculezi întotdeauna ÎNAINTE de a intra, nu după.',
    formula: 'R:R = (TP - Entry) / (Entry - SL)'
  },
  {
    id: 'sessions',
    title: 'Session Timing',
    color: 'gold',
    summary: 'Asia, London, NY — fiecare cu profil propriu de lichiditate și volatilitate.',
    body: 'Asia (00:00-08:00 RO) — acumulare, range. London (09:00-17:00 RO) — primul move real, sweep al Asia range. NY (15:30-22:00 RO) — volumul maxim, reverse-uri puternice. Cele mai bune setup-uri: London open + NY open.',
    formula: 'Asia → London sweep → NY reversal/continuation'
  },
  {
    id: 'news',
    title: 'Economic News',
    color: 'acid',
    summary: 'CPI, NFP, FOMC, PPI — știrile care mișcă serios NASDAQ.',
    body: 'În prop firm, multe firme interzic trading-ul cu 2-5 min înainte și după știri high impact. Verifică calendarul economic zilnic. CPI și FOMC sunt cele mai periculoase și cele mai oportune pentru NQ.',
    formula: 'High impact = no trade window for prop'
  },
];

const Accordion = ({ items, forceOpenId }) => {
  const [open, setOpen] = React.useState(null);

  // Auto-open when forceOpenId changes (e.g. user clicked a folder card)
  React.useEffect(() => {
    if (!forceOpenId) return;
    const idx = items.findIndex((it) => it.id === forceOpenId);
    if (idx >= 0) setOpen(idx);
  }, [forceOpenId, items]);

  return (
    <div className="accordion">
      {items.map((it, i) => {
        const isOpen = open === i;
        return (
          <div key={it.id} id={`concept-${it.id}`} className={`acc-item ${isOpen ? 'open' : ''}`}>
            <button className="acc-head" onClick={() => setOpen(isOpen ? null : i)}>
              <div className="acc-num mono">{String(i + 1).padStart(2, '0')}</div>
              <IconChip icon="bolt" color={it.color}/>
              <div className="acc-title">
                <h4>{it.title}</h4>
                <p>{it.summary}</p>
              </div>
              <div className="acc-toggle">
                <Icon name={isOpen ? 'x' : 'plus'} size={16}/>
              </div>
            </button>
            <div className="acc-body">
              <div className="acc-body-inner">
                <p>{it.body}</p>
                {it.formula && (
                  <div className="acc-formula">
                    <span className="acc-formula-label">DEFINITION</span>
                    <code>{it.formula}</code>
                  </div>
                )}
              </div>
            </div>
          </div>
        );
      })}
      <style>{`
        .accordion { display: flex; flex-direction: column; gap: 10px; }
        .acc-item {
          border: 1px solid var(--line);
          border-radius: var(--r-card);
          background: rgba(255,255,255,0.025);
          overflow: hidden;
          transition: border-color 0.2s;
        }
        .acc-item.open { border-color: var(--line-2); }
        .acc-head {
          width: 100%;
          display: flex; align-items: center; gap: 20px;
          padding: 18px 22px;
          background: transparent;
          border: none;
          cursor: pointer;
          font-family: inherit;
          color: inherit;
          text-align: left;
        }
        .acc-num {
          font-size: 12px;
          color: var(--text-faint);
          width: 28px; flex-shrink: 0;
        }
        .acc-title { flex: 1; min-width: 0; }
        .acc-title h4 { color: var(--text); font-size: 16px; }
        .acc-title p { color: var(--text-mute); font-size: 13px; margin-top: 4px; }
        .acc-toggle {
          width: 36px; height: 36px; border-radius: 50%;
          background: rgba(255,255,255,0.05);
          border: 1px solid var(--line);
          color: var(--text); flex-shrink: 0;
          display: grid; place-items: center;
          transition: all 0.2s;
        }
        .acc-item.open .acc-toggle { background: var(--acid); color: #050505; }
        .acc-body {
          display: grid; grid-template-rows: 0fr;
          transition: grid-template-rows 0.35s ease;
        }
        .acc-item.open .acc-body { grid-template-rows: 1fr; }
        .acc-body-inner { overflow: hidden; }
        .acc-item.open .acc-body-inner {
          padding: 0 22px 22px 80px;
        }
        .acc-body-inner p { font-size: 14px; line-height: 1.65; }
        .acc-formula {
          margin-top: 16px; padding: 14px 18px;
          border-radius: 12px;
          background: rgba(0,0,0,0.5);
          border: 1px dashed var(--line);
        }
        .acc-formula-label {
          font-size: 10px; color: var(--text-mute);
          letter-spacing: 0.14em; display: block; margin-bottom: 6px;
        }
        .acc-formula code {
          font-family: 'JetBrains Mono', monospace;
          font-size: 13px;
          color: var(--acid);
        }
        @media (max-width: 700px) {
          .acc-item.open .acc-body-inner { padding: 0 18px 18px; }
        }
      `}</style>
    </div>
  );
};

// ============================================================
// CONCEPTS FOLDER — iOS-style yellow folder with peek cards
// ------------------------------------------------------------
// Default: cards peek ~18% above the folder.
// Hover:   cards rise ~85% out + slight fan rotation.
// Click:   sets the matching CONCEPT in the accordion open and
//          scrolls to it smoothly.
// ============================================================
const FOLDER_CARDS = [
  { id: 'breaker',     label: 'Breaker Block', accent: 'acid'  },
  { id: 'liquidity',   label: 'Lichiditate',   accent: 'cyan'  },
  { id: 'orderblock',  label: 'Order Block',   accent: 'blue'  },
  { id: 'reversal',    label: 'Reversal',      accent: 'rose'  },
  { id: 'retracement', label: 'Retracement',   accent: 'cyan'  },
  { id: 'po3',         label: 'PO3',           accent: 'gold'  },
];

const ConceptsFolder = ({ onOpen }) => {
  const [hovered, setHovered] = React.useState(false);

  const clickCard = (id) => {
    onOpen?.(id);
    setTimeout(() => {
      const el = document.getElementById(`concept-${id}`);
      if (el) el.scrollIntoView({ behavior: 'smooth', block: 'center' });
    }, 50);
  };

  // 6 cards. Rest = small horizontal stagger + tiny tilt (each card peeks
  // slightly differently above the folder rim). Hover = wide fan-out arc.
  const restArrangement = [
    { tx: -52, rot: -3.0 },
    { tx: -32, rot: -1.8 },
    { tx: -10, rot: -0.6 },
    { tx:  10, rot:  0.6 },
    { tx:  32, rot:  1.8 },
    { tx:  52, rot:  3.0 },
  ];
  const hoverArrangement = [
    { tx: -132, rot: -14 },
    { tx:  -80, rot:  -8 },
    { tx:  -27, rot:  -2 },
    { tx:   27, rot:   2 },
    { tx:   80, rot:   8 },
    { tx:  132, rot:  14 },
  ];

  return (
    <div
      className={`cf-wrap ${hovered ? 'is-hovered' : ''}`}
      onMouseEnter={() => setHovered(true)}
      onMouseLeave={() => setHovered(false)}>
      <div className="cf-stage">
        {/* Folder back (the wall behind the cards) */}
        <div className="cf-folder-back" />
        {/* Folder tab on top */}
        <div className="cf-folder-tab" />

        {/* Cards — clipped at the folder rim so the bottoms stay hidden */}
        <div className="cf-cards-layer">
          {FOLDER_CARDS.map((card, i) => {
            const a = hovered ? hoverArrangement[i] : restArrangement[i];
            // Rest: card top peeks ~28px above the folder back top, bottom hidden inside.
            // Hover: card rises fully out of the folder.
            const restY  = -40;
            const hoverY = -150;
            const ty    = hovered ? hoverY : restY;
            const scale = hovered ? 1 : 0.96;
            return (
              <div
                key={card.id}
                className={`cf-card cf-card-${card.accent}`}
                style={{
                  transform: `translate(${a.tx}px, ${ty}px) rotate(${a.rot}deg) scale(${scale})`,
                  transitionDelay: `${i * 35}ms`,
                  zIndex: 20 - i,
                }}
                onClick={(e) => { e.stopPropagation(); clickCard(card.id); }}>
                <div className="cf-card-corner" />
                <div className="cf-card-icon"><Icon name="bolt" size={11}/></div>
                <div className="cf-card-text">{card.label}</div>
                <div className="cf-card-arrow"><Icon name="arrowUR" size={10}/></div>
              </div>
            );
          })}
        </div>

        {/* Folder front (the pocket lip) — sits IN FRONT of cards, hides the
           bottom portion of every card so only the top edge peeks above the rim. */}
        <div className="cf-folder-front" />
        <div className="cf-folder-shine" />
      </div>

      <style>{`
        .cf-wrap {
          position: relative;
          width: 100%;
          max-width: 400px;
          margin-left: auto;
          padding: 60px 12px 32px;
          user-select: none;
        }
        @media (max-width: 980px) { .cf-wrap { margin: 30px auto 0; } }

        .cf-stage {
          position: relative;
          width: 100%;
          aspect-ratio: 320 / 220;
          display: flex; align-items: flex-end; justify-content: center;
        }

        /* Folder body — iOS-style yellow */
        .cf-folder-back {
          position: absolute;
          left: 8%; right: 8%; bottom: 0;
          height: 78%;
          border-radius: 22px;
          background: linear-gradient(180deg, #FACC15 0%, #D97706 100%);
          border: 1px solid rgba(0, 0, 0, 0.18);
          box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.45),
            inset 0 -2px 0 rgba(180, 90, 0, 0.30),
            0 24px 50px rgba(0, 0, 0, 0.55),
            0 0 60px rgba(245, 158, 11, 0.18);
        }
        .cf-folder-tab {
          position: absolute;
          left: 14%;
          bottom: calc(78% - 2px);
          width: 38%;
          height: 18px;
          border-radius: 10px 12px 0 0;
          background: linear-gradient(180deg, #FBBF24 0%, #E58F12 100%);
          border: 1px solid rgba(0, 0, 0, 0.18);
          border-bottom: none;
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.40);
        }

        /* Cards layer — clip-path hides anything below the folder rim at rest,
           so the cards' bottom halves stay inside the folder like real papers. */
        .cf-cards-layer {
          position: absolute;
          left: 50%;
          bottom: 0;
          transform: translateX(-50%);
          width: 100%;
          height: 100%;
          pointer-events: none;
          /* negative insets on top/left/right so the fan-out doesn't get
             trimmed by the cards-layer bounds; only the bottom is clipped to
             hide the cards' bodies inside the folder. */
          clip-path: inset(-200px -200px 62% -200px);
          -webkit-clip-path: inset(-200px -200px 62% -200px);
          transition: clip-path 0.55s cubic-bezier(0.34, 1.32, 0.64, 1),
                      -webkit-clip-path 0.55s cubic-bezier(0.34, 1.32, 0.64, 1);
        }
        .cf-wrap.is-hovered .cf-cards-layer {
          clip-path: inset(-200px -200px 0 -200px);
          -webkit-clip-path: inset(-200px -200px 0 -200px);
        }

        .cf-card {
          position: absolute;
          bottom: 12px;
          left: 50%;
          width: 150px;
          height: 200px;
          margin-left: -75px;
          border-radius: 14px;
          padding: 12px 12px 14px;
          background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.015) 100%),
            rgba(12, 12, 14, 0.94);
          border: 1px solid var(--cf-border, rgba(183, 255, 26, 0.40));
          box-shadow:
            0 12px 30px rgba(0, 0, 0, 0.55),
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 0 18px var(--cf-glow, rgba(183, 255, 26, 0.15));
          cursor: pointer;
          pointer-events: auto;
          transform-origin: bottom center;
          transition: transform 0.55s cubic-bezier(0.34, 1.32, 0.64, 1),
                      box-shadow 0.3s ease,
                      border-color 0.3s ease;
          display: flex; flex-direction: column; justify-content: space-between;
        }
        .cf-card-acid { --cf-border: rgba(183, 255, 26, 0.45); --cf-glow: rgba(183, 255, 26, 0.20); --cf-text: var(--acid); }
        .cf-card-cyan { --cf-border: rgba(79, 231, 213, 0.45); --cf-glow: rgba(79, 231, 213, 0.20); --cf-text: var(--cyan); }
        .cf-card-blue { --cf-border: rgba(90, 200, 255, 0.45); --cf-glow: rgba(90, 200, 255, 0.20); --cf-text: var(--blue); }
        .cf-card-gold { --cf-border: rgba(255, 203, 82, 0.45); --cf-glow: rgba(255, 203, 82, 0.20); --cf-text: var(--gold); }
        .cf-card-rose { --cf-border: rgba(244, 63, 94, 0.45); --cf-glow: rgba(244, 63, 94, 0.20); --cf-text: #FB7185; }

        /* On individual card hover (while folder is open) — bring it to the
           foreground and brighten so it's fully readable. The transform stays
           on its inline value; we boost via z-index + filter + shadow. */
        .cf-wrap.is-hovered .cf-card:hover {
          z-index: 100 !important;
          filter: brightness(1.12) saturate(1.18);
          border-color: color-mix(in oklab, var(--cf-text), white 30%);
          box-shadow:
            0 26px 60px rgba(0, 0, 0, 0.75),
            inset 0 1px 0 rgba(255, 255, 255, 0.22),
            0 0 56px var(--cf-glow, rgba(183, 255, 26, 0.55));
        }

        .cf-card-corner {
          position: absolute; top: 0; right: 0;
          width: 22px; height: 22px;
          background: linear-gradient(135deg, transparent 50%, var(--cf-text, var(--acid)) 50%);
          opacity: 0.35;
          border-top-right-radius: 14px;
          pointer-events: none;
        }
        .cf-card-icon {
          width: 24px; height: 24px;
          border-radius: 7px;
          display: grid; place-items: center;
          background: var(--cf-glow);
          color: var(--cf-text);
          border: 1px solid var(--cf-border);
        }
        .cf-card-text {
          font-size: 14px;
          font-weight: 700;
          letter-spacing: -0.01em;
          color: #fff;
          line-height: 1.2;
        }
        .cf-card-arrow {
          align-self: flex-end;
          width: 22px; height: 22px;
          border-radius: 50%;
          display: grid; place-items: center;
          background: rgba(255, 255, 255, 0.06);
          color: var(--cf-text);
          border: 1px solid rgba(255, 255, 255, 0.10);
        }

        /* Folder front lip — taller than typical so it covers most of the
           cards' bodies. Only the top ~28% of each card peeks above the rim. */
        .cf-folder-front {
          position: absolute;
          left: 8%; right: 8%; bottom: 0;
          height: 62%;
          border-radius: 14px 14px 22px 22px;
          background:
            linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
          border: 1px solid rgba(0, 0, 0, 0.20);
          box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.50),
            inset 0 -3px 0 rgba(120, 60, 0, 0.40),
            0 18px 40px rgba(0, 0, 0, 0.55);
          z-index: 25;
        }
        .cf-folder-shine {
          position: absolute;
          left: 8%; right: 8%; bottom: 0;
          height: 62%;
          border-radius: 14px 14px 22px 22px;
          background: linear-gradient(135deg, rgba(255,255,255,0.32) 0%, transparent 40%, transparent 75%, rgba(255,255,255,0.12) 100%);
          pointer-events: none;
          z-index: 26;
        }

        @media (max-width: 540px) {
          .cf-card { width: 130px; height: 170px; margin-left: -65px; }
        }
        @media (prefers-reduced-motion: reduce) {
          .cf-card { transition: none; }
        }
      `}</style>
    </div>
  );
};

// ============================================================
// NEXT LEVEL CARD — interactive CTA with cursor-follow glow
// Replaces the old `eborder acid` line animation with a soft
// acid spotlight that tracks the mouse + subtle 3D tilt.
// ============================================================
const NextLevelCard = ({ onApply, onNav, user }) => {
  const cardRef = React.useRef(null);
  const [hovered, setHovered] = React.useState(false);
  const [pos, setPos]   = React.useState({ x: 50, y: 50 });   // % within card
  const [tilt, setTilt] = React.useState({ x: 0, y: 0 });

  const onMove = (e) => {
    const el = cardRef.current;
    if (!el) return;
    const r = el.getBoundingClientRect();
    const px = ((e.clientX - r.left) / r.width)  * 100;
    const py = ((e.clientY - r.top)  / r.height) * 100;
    setPos({ x: px, y: py });
    // ±3° subtle tilt — keeps it premium, not jarring
    setTilt({
      x: ((py / 100) - 0.5) * -3,
      y: ((px / 100) - 0.5) *  3,
    });
  };
  const onLeave = () => {
    setHovered(false);
    setTilt({ x: 0, y: 0 });
    setPos({ x: 50, y: 50 });
  };

  return (
    <div
      ref={cardRef}
      className={`nlc ${hovered ? 'is-hovered' : ''}`}
      style={{
        transform: `perspective(1200px) rotateX(${tilt.x}deg) rotateY(${tilt.y}deg)`,
        '--mx': `${pos.x}%`,
        '--my': `${pos.y}%`,
      }}
      onMouseEnter={() => setHovered(true)}
      onMouseMove={onMove}
      onMouseLeave={onLeave}>

      {/* spotlight that follows the cursor */}
      <div className="nlc-spot" />
      {/* subtle texture grain */}
      <div className="nlc-grain" />
      {/* gradient border highlight */}
      <div className="nlc-border" />

      <div className="nlc-inner">
        <div className="eyebrow nlc-eyebrow"><span className="dot"/>NEXT LEVEL</div>
        <h2 className="nlc-title">
          Vrei să înveți <span className="acid">structurat?</span>
        </h2>
        <p className="nlc-desc">
          Aplică pentru Elite Plan — mentorship 1-on-1, live calls de 2 ori pe săptămână, trade reviews și suport direct pe WhatsApp.
        </p>
        <div className="nlc-cta">
          {!isEliteUser(user) && <Button variant="acid" size="lg" onClick={onApply}>Apply for Elite</Button>}
          <Button variant="ghost" size="lg" onClick={() => onNav('elite')}>Vezi ce conține</Button>
        </div>
      </div>

      <style>{`
        .nlc {
          position: relative;
          padding: 56px 36px;
          border-radius: 24px;
          overflow: hidden;
          isolation: isolate;
          background:
            linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.005) 100%),
            rgba(10, 10, 12, 0.85);
          border: 1px solid rgba(255, 255, 255, 0.08);
          box-shadow:
            0 30px 80px rgba(0, 0, 0, 0.55),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            0 0 30px rgba(183, 255, 26, 0.04);
          transition:
            transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
            box-shadow 0.4s ease,
            border-color 0.4s ease;
          backdrop-filter: blur(12px);
          -webkit-backdrop-filter: blur(12px);
          text-align: center;
          will-change: transform;
        }
        .nlc.is-hovered {
          border-color: rgba(183, 255, 26, 0.22);
          box-shadow:
            0 40px 100px rgba(0, 0, 0, 0.7),
            inset 0 1px 0 rgba(255, 255, 255, 0.10),
            0 0 50px rgba(183, 255, 26, 0.14);
        }

        /* Cursor-following spotlight */
        .nlc-spot {
          position: absolute; inset: -1px;
          pointer-events: none;
          border-radius: inherit;
          background: radial-gradient(
            520px circle at var(--mx) var(--my),
            rgba(183, 255, 26, 0.18) 0%,
            rgba(183, 255, 26, 0.06) 25%,
            transparent 60%
          );
          opacity: 0;
          transition: opacity 0.35s ease;
          z-index: 1;
        }
        .nlc.is-hovered .nlc-spot { opacity: 1; }

        /* Subtle SVG grain — premium texture */
        .nlc-grain {
          position: absolute; inset: 0;
          opacity: 0.05;
          mix-blend-mode: overlay;
          pointer-events: none;
          background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
          z-index: 2;
        }

        /* Gradient border highlight — top edge fade */
        .nlc-border {
          position: absolute; inset: 0;
          border-radius: inherit;
          padding: 1px;
          background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 60%);
          -webkit-mask:
            linear-gradient(#000 0 0) content-box,
            linear-gradient(#000 0 0);
          -webkit-mask-composite: xor;
                  mask-composite: exclude;
          pointer-events: none;
          z-index: 3;
        }

        .nlc-inner { position: relative; z-index: 5; }
        .nlc-eyebrow { display: inline-flex; justify-content: center; }
        .nlc-title {
          margin-top: 18px;
          max-width: 720px;
          margin-left: auto; margin-right: auto;
          font-size: clamp(28px, 4vw, 48px);
          line-height: 1.05;
          letter-spacing: -0.03em;
        }
        .nlc-title .acid {
          background: linear-gradient(180deg, #DCFF7A 0%, #B7FF1A 60%, #8FE000 100%);
          -webkit-background-clip: text; background-clip: text; color: transparent;
        }
        .nlc-desc {
          margin: 18px auto 0;
          max-width: 560px;
          font-size: 15px;
          line-height: 1.55;
          color: var(--text-dim);
        }
        .nlc-cta {
          margin-top: 32px;
          display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
        }

        @media (prefers-reduced-motion: reduce) {
          .nlc { transition: none; transform: none !important; }
          .nlc-spot { display: none; }
        }
      `}</style>
    </div>
  );
};

const BasicsPage = ({ onNav, onApply, user, onLogin, onSignup }) => {
  const [openConceptId, setOpenConceptId] = React.useState(null);

  return (
  <>
    <section style={{paddingTop: 80, paddingBottom: 40}}>
      <div className="container">
        <div className="basics-hero-grid">
          <div>
            <div className="eyebrow"><span className="dot"/>BASICS · MODULE</div>
            <h1 style={{ marginTop: 18, maxWidth: 880 }}>
              Trading <span className="acid">Basics</span>
            </h1>
            <p className="lead" style={{ marginTop: 22, maxWidth: 640 }}>
              Începe cu bazele corecte înainte să riști bani reali sau conturi de funding. Fără shortcuts, fără promisiuni.
            </p>
            {!user && (
              <div className="basics-free-badge">
                <span className="basics-free-pill">
                  <Icon name="unlock" size={13}/>
                  <span><strong>Cont gratuit</strong> = acces complet la toate materialele</span>
                </span>
                <div className="basics-free-actions">
                  <Button variant="acid" size="sm" onClick={onSignup} icon="arrow">
                    Creează cont gratuit
                  </Button>
                  <Button variant="ghost" size="sm" onClick={onLogin}>
                    Login
                  </Button>
                </div>
              </div>
            )}
          </div>
          <ConceptsFolder onOpen={(id) => setOpenConceptId(id)} />
        </div>
      </div>
      <style>{`
        .basics-hero-grid {
          display: grid;
          grid-template-columns: 1.05fr 0.95fr;
          gap: 30px;
          align-items: center;
        }
        @media (max-width: 980px) {
          .basics-hero-grid { grid-template-columns: 1fr; }
        }
        .basics-free-badge {
          margin-top: 28px;
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          gap: 8px;
        }
        .basics-free-pill {
          display: inline-flex;
          align-items: center;
          gap: 10px;
          padding: 10px 16px;
          border-radius: 999px;
          background:
            linear-gradient(180deg, rgba(183,255,26,0.10), rgba(183,255,26,0.04)),
            rgba(10,10,12,0.6);
          border: 1px solid rgba(183,255,26,0.32);
          color: var(--text);
          font-size: 13.5px;
          line-height: 1.3;
          box-shadow:
            0 8px 24px rgba(0,0,0,0.45),
            0 0 24px rgba(183,255,26,0.10),
            inset 0 1px 0 rgba(255,255,255,0.06);
          backdrop-filter: blur(8px);
          -webkit-backdrop-filter: blur(8px);
        }
        .basics-free-pill svg { color: var(--acid); flex-shrink: 0; }
        .basics-free-pill strong {
          color: var(--acid);
          font-weight: 700;
          text-shadow: 0 0 12px rgba(183,255,26,0.30);
        }
        .basics-free-actions {
          display: flex; gap: 10px; flex-wrap: wrap;
          margin-top: 4px;
        }
      `}</style>
    </section>

    <section style={{paddingTop: 30}}>
      <div className="container">
        <SectionHeader
          eyebrow="LEARNING PATH"
          title="7 module fundamentale"
          subtitle="Parcurge-le în ordine sau alege ce te interesează. Toate sunt free, fără email-uri capturate."
        />
        <div className="grid grid-3">
          {BASICS_MODULES.map((m, i) => (
            <Reveal key={m.title} delay={i * 50}>
              <div className="basic-card card">
                <div className="basic-card-head">
                  <IconChip icon={m.icon} color={m.color}/>
                  <span className="basic-card-num mono">{String(i + 1).padStart(2, '0')} / 07</span>
                </div>
                <h4 style={{ marginTop: 22, fontSize: 18 }}>{m.title}</h4>
                <p style={{ marginTop: 8, fontSize: 13.5, lineHeight: 1.55 }}>{m.desc}</p>
                <div className="basic-card-foot">
                  <div className="row" style={{gap:8}}>
                    <span className="tag" style={{fontSize:10, padding:'4px 8px'}}>
                      <Icon name="clock" size={11}/> {m.time}
                    </span>
                    <span className={`tag ${m.color}`} style={{fontSize:10, padding:'4px 8px'}}>{m.level}</span>
                  </div>
                  <div className="basic-card-link">
                    <Icon name="arrow" size={14}/>
                  </div>
                </div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>

    <section>
      <div className="container">
        <SectionHeader
          eyebrow="KEY CONCEPTS"
          title="Concepte cheie, explicate clar."
          subtitle="Limbajul real folosit în trade reviews. Nu memora — înțelege."
        />
        <Accordion items={CONCEPTS} forceOpenId={openConceptId}/>
      </div>
    </section>

    <section>
      <div className="container">
        <NextLevelCard onApply={onApply} onNav={onNav} user={user} />
      </div>
    </section>

    <style>{`
      .basic-card {
        padding: 24px;
        cursor: pointer;
        transition: transform 0.25s, border-color 0.25s;
      }
      .basic-card:hover { transform: translateY(-4px); border-color: var(--line-2); }
      .basic-card-head { display: flex; justify-content: space-between; align-items: center; }
      .basic-card-num { font-size: 11px; color: var(--text-faint); letter-spacing: 0.12em; }
      .basic-card-foot {
        margin-top: 22px; padding-top: 18px;
        border-top: 1px dashed var(--line);
        display: flex; justify-content: space-between; align-items: center;
      }
      .basic-card-link {
        width: 32px; height: 32px; border-radius: 50%;
        background: rgba(255,255,255,0.06);
        color: var(--text);
        display: grid; place-items: center;
        transition: all 0.2s;
      }
      .basic-card:hover .basic-card-link {
        background: var(--acid); color: #050505;
      }
    `}</style>
  </>
  );
};

Object.assign(window, { BasicsPage });
