/* =====================================================
   Tutorial Detail Page — Shared Styles
   Matches the leaderboard / indicator / hub design system
   ===================================================== */
:root{
  --bg: #0a0c10;
  --surface: #0d1014;
  --surface2: #11151b;
  --ink: #e9eef6;
  --muted: #8b99ad;
  --glass: rgba(13,16,20,.95);
  --line: rgba(255,255,255,.068);
  --line2: rgba(255,255,255,.055);
  --line-soft: rgba(255,255,255,.042);
  --accentA: #5a8ec7;
  --accentB: #6b8faa;
  --accent: #6ba8cc;
  --accent-glow: rgba(90,142,199,.5);
  --danger: #ff4d4d;
  --shadow1: 0 4px 24px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.25);
  --shadow2: 0 12px 48px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.30);
  --r: clamp(12px, 1.4vw, 16px);
  --r-lg: clamp(14px, 1.5vw, 20px);
  --pad: clamp(1rem, 2vw, 1.5rem);
  --gutter: clamp(16px, 2vw, 24px);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-base: clamp(.8rem, .88vw, .92rem);
  --fs-sm: clamp(.7rem, .78vw, .82rem);
  --fs-xs: clamp(.64rem, .7vw, .74rem);
  --fs-lg: clamp(.9rem, 1vw, 1.02rem);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

*{ box-sizing:border-box; margin:0; }
html,body{ height:100%; margin:0; }
body{
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce){ *{ scroll-behavior:auto !important; transition:none !important; animation:none !important; } }

/* ===== Ambient background ===== */
body::before{
  content:"";
  position:fixed; inset:0;
  pointer-events:none;
  background:
    radial-gradient(1200px 600px at 20% -5%, rgba(90,142,199,.09), transparent 55%),
    radial-gradient(800px 500px at 80% 105%, rgba(107,143,170,.06), transparent 55%),
    radial-gradient(500px 300px at 60% 30%, rgba(90,142,199,.03), transparent 60%);
  z-index:0;
}
body::after{
  content:"";
  position:fixed; inset:0;
  pointer-events:none;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.018) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.010) 0 1px, transparent 1px 42px);
  opacity:.4;
  z-index:0;
}

.sidebar.pre-skel{ pointer-events:none; }
@media (max-width: 768px){ .sidebar.pre-skel{ display:none; } }

#app{ position: relative; z-index: 1; }

/* ===== MINI BANNER (per-tutorial page) ===== */
.tp-banner{
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 5vw, 4rem) var(--pad) clamp(2rem, 4vw, 3.2rem);
  border-bottom: 1px solid var(--line);
}
.tp-banner::before{
  content:"";
  position:absolute;
  width: 700px; height: 700px;
  top: -350px; right: -100px;
  background: radial-gradient(circle, rgba(90,142,199,.14) 0%, transparent 65%);
  animation: tpOrb 12s ease-in-out infinite alternate;
  pointer-events:none;
}
@keyframes tpOrb{
  0%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(-60px,30px) scale(1.15); }
  100%{ transform: translate(20px,-20px) scale(.95); }
}
.tp-banner::after{
  content:"";
  position:absolute;
  width: 500px; height: 500px;
  bottom: -300px; left: -100px;
  background: radial-gradient(circle, rgba(107,143,170,.08) 0%, transparent 60%);
  animation: tpOrb2 15s ease-in-out infinite alternate;
  pointer-events:none;
}
@keyframes tpOrb2{
  0%{ transform: translate(0,0) scale(1); }
  100%{ transform: translate(40px,-30px) scale(1.1); }
}

.tp-banner-inner{
  position: relative;
  z-index: 1;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.tp-banner-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: .6rem;
}

/* Banner hero row — title/subtitle on left, icon on right */
.tp-banner-hero{
  display: flex;
  align-items: flex-start;
  gap: clamp(1.2rem, 3vw, 2.2rem);
}
.tp-banner-text{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.tp-banner-icon{
  flex-shrink: 0;
  width: clamp(72px, 8vw, 100px);
  height: clamp(72px, 8vw, 100px);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(90,142,199,.10), rgba(90,142,199,.03));
  border: 1px solid rgba(90,142,199,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(90,142,199,.06), inset 0 1px 0 rgba(255,255,255,.03);
}
.tp-banner-icon .material-symbols-rounded{
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  color: var(--accentA);
  opacity: .7;
}

/* Accent line under title */
.tp-title-accent{
  width: 48px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accentA), rgba(90,142,199,.15));
  margin-top: .1rem;
}

/* Floating chart decoration in banner */
.tp-banner-visual{
  position: absolute;
  right: clamp(1rem, 4vw, 3rem);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(140px, 18vw, 240px);
  height: clamp(100px, 13vw, 170px);
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
@media (max-width: 900px){ .tp-banner-visual{ display: none; } }
.tp-banner-visual svg{ width: 100%; height: 100%; }
.tp-chart-line{
  fill: none;
  stroke: url(#tpGrad);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(90,142,199,.3));
}
.tp-chart-area{
  fill: url(#tpAreaGrad);
  opacity: .3;
}
.tp-chart-dot{
  fill: var(--accentA);
  filter: drop-shadow(0 0 4px rgba(90,142,199,.6));
  animation: tpDotPulse 2.5s ease-in-out infinite;
}
@keyframes tpDotPulse{
  0%,100%{ r: 3; opacity: 1; }
  50%{ r: 5; opacity: .7; }
}
/* Back link */
.tp-back{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .32rem .75rem;
  font: 600 var(--fs-xs)/1 var(--font-sans);
  color: var(--muted);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  transition: all .18s ease;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tp-back:hover{
  color: var(--ink);
  background: rgba(255,255,255,.06);
  border-color: rgba(90,142,199,.3);
}
.tp-back .material-symbols-rounded{ font-size: .85rem; }

/* Badge */
.tp-badge{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: .28rem .7rem;
  font: 700 .62rem/1 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accentA);
  background: rgba(90,142,199,.08);
  border: 1px solid rgba(90,142,199,.2);
  border-radius: 999px;
}
.tp-badge .material-symbols-rounded{ font-size: .85rem; }

/* Title */
.tp-title{
  font: 900 clamp(1.5rem, 3vw, 2.4rem)/1.1 var(--font-sans);
  letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--ink) 0%, rgba(139,153,173,.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tp-subtitle{
  font: 400 clamp(.85rem, 1.1vw, 1.02rem)/1.7 var(--font-sans);
  color: var(--muted);
  max-width: 560px;
}

/* ===== CONTENT AREA ===== */
.tp-content{
  padding: var(--pad);
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

/* ===== STEP CARDS (auto-trade-import, upload-trades) ===== */
.tp-steps{
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}
.tp-step{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow1);
  transition: border-color .25s ease;
}
.tp-step:hover{
  border-color: rgba(90,142,199,.15);
}
.tp-step-header{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: clamp(.8rem, 1.5vw, 1.1rem) clamp(1rem, 2vw, 1.3rem);
  border-bottom: 1px solid var(--line);
}
.tp-step-num{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(90,142,199,.1);
  border: 1px solid rgba(90,142,199,.2);
  font: 800 .7rem/1 var(--font-sans);
  color: var(--accentA);
  flex-shrink: 0;
}
.tp-step-title{
  font: 700 var(--fs-lg)/1.3 var(--font-sans);
  color: var(--ink);
  letter-spacing: -.01em;
}
.tp-step-body{
  padding: clamp(.8rem, 1.5vw, 1.1rem) clamp(1rem, 2vw, 1.3rem);
}
.tp-step-img{
  width: 100%;
  height: auto;
  display: block;
  max-height: clamp(420px, 60vh, 720px);
  object-fit: contain;
  background: rgba(0,0,0,.15);
  border-radius: var(--r);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.tp-step-img:hover{
  border-color: rgba(90,142,199,.3);
  box-shadow: 0 4px 20px rgba(90,142,199,.1);
}
.tp-step-text{
  margin: clamp(.6rem, 1.2vw, .9rem) 0 0;
  color: var(--muted);
  font: 400 var(--fs-base)/1.6 var(--font-sans);
}
.tp-step-text ul{ margin: 8px 0 0; padding-left: 20px; }
.tp-step-text li{ margin: 5px 0; }
.tp-step-text .hi{ color: var(--ink); font-weight: 650; }
.tp-step-text .accent{ color: var(--accentA); font-weight: 650; }
.tp-step-text .danger{ color: var(--danger); font-weight: 800; }
.tp-step-caption{
  text-align: center;
  color: var(--muted);
  font: 400 var(--fs-xs)/1.5 var(--font-sans);
  margin-top: 6px;
  opacity: .7;
}
.tp-step-part .tp-step-header{
  border-bottom: 1px solid var(--line);
  padding-bottom: .5rem;
  margin-bottom: .2rem;
}
.tp-step code{
  background: rgba(90,142,199,.1);
  color: var(--accentA);
  padding: .15em .45em;
  border-radius: 5px;
  font-size: .92em;
  font-weight: 600;
}

/* ===== PLATFORM SWITCHER (upload-trades) ===== */
.tp-platform-switch{
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: var(--gutter);
  width: fit-content;
}
.tp-platform-tab{
  appearance: none;
  background: transparent;
  border: none;
  padding: .45rem 1rem;
  font: 600 var(--fs-sm)/1 var(--font-sans);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all .18s ease;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tp-platform-tab:hover{ color: var(--ink); }
.tp-platform-tab.is-active{
  color: #fff;
  background: linear-gradient(135deg, rgba(90,142,199,.22), rgba(90,142,199,.12));
  box-shadow: 0 0 12px rgba(90,142,199,.08);
}

/* ===== THUMBNAIL STRIP + PREVIEW (trade-analysis, labeling, etc.) ===== */
.tp-gallery{
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}
.tp-thumbs-strip{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.tp-thumb{
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s ease, transform .2s var(--ease-out), box-shadow .2s ease;
  background: var(--surface);
}
.tp-thumb:hover{
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(90,142,199,.1);
}
.tp-thumb.is-active{
  border-color: var(--accentA);
  box-shadow: 0 0 0 1px rgba(90,142,199,.2), 0 4px 16px rgba(90,142,199,.1);
}
.tp-thumb img{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(.85);
  transition: filter .2s ease;
}
.tp-thumb:hover img,
.tp-thumb.is-active img{
  filter: brightness(1);
}
.tp-thumb-label{
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 6px;
  font: 600 .55rem/1.2 var(--font-sans);
  color: rgba(255,255,255,.85);
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Preview panel */
.tp-preview-panel{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow1);
}
.tp-preview-img-wrap{
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.2);
  padding: clamp(.8rem, 1.5vw, 1.2rem);
}
.tp-preview-img{
  width: 100%;
  max-height: clamp(400px, 55vh, 680px);
  object-fit: contain;
  border-radius: var(--r);
  cursor: pointer;
  transition: box-shadow .2s ease;
}
.tp-preview-img:hover{
  box-shadow: 0 4px 24px rgba(90,142,199,.08);
}
.tp-preview-info{
  padding: clamp(1rem, 2vw, 1.4rem) clamp(1.2rem, 2vw, 1.6rem);
  border-top: 1px solid var(--line);
}
.tp-preview-title{
  font: 700 clamp(1rem, 1.3vw, 1.15rem)/1.3 var(--font-sans);
  color: var(--ink);
  margin-bottom: .4rem;
}
.tp-preview-desc{
  font: 400 var(--fs-base)/1.65 var(--font-sans);
  color: var(--muted);
}
.tp-preview-desc .hi{ color: var(--ink); font-weight: 650; }
.tp-preview-desc .accent{ color: var(--accentA); font-weight: 650; }
.tp-preview-desc .danger{ color: var(--danger); font-weight: 800; }
.tp-preview-desc ul{ margin: 8px 0 0; padding-left: 20px; }
.tp-preview-desc li{ margin: 5px 0; }

/* ===== COMING SOON PLACEHOLDER ===== */
.tp-coming-soon{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 340px;
  padding: 3rem var(--pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow1);
}
.tp-coming-icon{
  font-size: 3rem;
  color: var(--muted);
  opacity: .4;
  margin-bottom: 1rem;
}
.tp-coming-title{
  font: 800 clamp(1.2rem, 1.8vw, 1.5rem)/1.2 var(--font-sans);
  color: var(--muted);
  margin-bottom: .5rem;
}
.tp-coming-desc{
  font: 400 var(--fs-base)/1.5 var(--font-sans);
  color: rgba(139,153,173,.5);
}

/* ===== PREV / NEXT NAVIGATION ===== */
.tp-nav{
  display: flex;
  justify-content: space-between;
  gap: var(--gutter);
  margin-top: calc(var(--gutter) * 1.5);
  padding-top: calc(var(--gutter) * 1.5);
  border-top: 1px solid var(--line);
}
.tp-nav-link{
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: inherit;
  padding: .6rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255,255,255,.02);
  transition: all .2s ease;
  flex: 0 1 280px;
}
.tp-nav-link:hover{
  border-color: rgba(90,142,199,.3);
  background: rgba(90,142,199,.04);
}
.tp-nav-link.is-next{ align-items: flex-end; text-align: right; margin-left: auto; }
.tp-nav-label{
  font: 600 var(--fs-xs)/1 var(--font-sans);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tp-nav-label .material-symbols-rounded{ font-size: .8rem; }
.tp-nav-title{
  font: 600 var(--fs-base)/1.3 var(--font-sans);
  color: var(--ink);
}

/* ===== LIGHTBOX ===== */
.tp-lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.tp-lightbox.is-open{
  opacity: 1;
  visibility: visible;
}
.tp-lightbox-content{
  position: relative;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}
.tp-lightbox-img{
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
  transition: transform .2s ease;
}
.tp-lightbox-img.is-zoomed{
  cursor: grab;
  transform-origin: center center;
}
.tp-lightbox-img.is-zoomed.is-dragging{
  cursor: grabbing;
  transition: none;
}
.tp-lightbox-hint{
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  color: var(--muted);
  font: 500 var(--fs-xs)/1 var(--font-sans);
  background: rgba(0,0,0,.5);
  padding: 6px 14px;
  border-radius: 8px;
  pointer-events: none;
  opacity: .8;
}

/* ===== TUTORIALS SIDEBAR (nav list of all tutorials) ===== */
#app:has(.tp-sidebar){
  display: grid !important;
  grid-template-columns: 220px 1fr;
}
#app > :not(.tp-sidebar){ grid-column: 2; }
.tp-sidebar{
  grid-column: 1;
  grid-row: 1 / span 20;
  position: fixed;
  left: var(--app-left-expanded, 270px);
  top: 0;
  width: 220px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
  z-index: 5;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
  transition: left .4s ease;
}
.tp-sidebar::-webkit-scrollbar{ width: 4px; }
.tp-sidebar::-webkit-scrollbar-track{ background: transparent; }
.tp-sidebar::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.08); border-radius: 4px; }
/* follow main sidebar collapse */
.sidebar.collapsed ~ #app .tp-sidebar{ left: var(--app-left-collapsed, 85px); }

.tp-sidebar-header{
  padding: 1rem .85rem .65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .3rem;
}
.tp-sidebar-hub{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 800 .8rem/1.2 var(--font-sans);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
  transition: color .15s ease;
}
.tp-sidebar-hub:hover{ color: var(--accentA); }
.tp-sidebar-hub .material-symbols-rounded{ font-size: 1.05rem; color: var(--accentA); }

.tp-sidebar-cat{
  padding: .35rem 0 .15rem;
}
.tp-sidebar-cat-head{
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .4rem .85rem;
  font: 700 .55rem/1 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.tp-sidebar-cat-head .material-symbols-rounded{
  font-size: .72rem;
  color: var(--accentA);
}
.tp-sidebar-link{
  display: block;
  padding: .38rem .85rem .38rem 1.8rem;
  font: 500 var(--fs-xs)/1.4 var(--font-sans);
  color: var(--muted);
  text-decoration: none;
  transition: all .15s ease;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-sidebar-link:hover{
  color: var(--ink);
  background: rgba(255,255,255,.025);
}
.tp-sidebar-link.is-current{
  color: var(--accentA);
  background: rgba(90,142,199,.06);
  border-left-color: var(--accentA);
  font-weight: 650;
}

/* Grouped (parent + children) sidebar items */
.tp-sidebar-group{
  margin: 0;
}
.tp-sidebar-group-head{
  display: block;
  padding: .38rem .85rem .38rem 1.8rem;
  font: 600 var(--fs-xs)/1.4 var(--font-sans);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-sidebar-child{
  padding-left: 2.5rem;
  font-size: var(--fs-xs);
}

@media (max-width: 1100px){
  #app:has(.tp-sidebar){ grid-template-columns: 185px 1fr; }
  .tp-sidebar{ width: 185px; }
}
@media (max-width: 1024px){
  .tp-sidebar{ left: var(--app-left-collapsed, 85px); }
}
@media (max-width: 900px){
  .tp-sidebar{ display: none !important; }
  #app:has(.tp-sidebar){ display: flex !important; flex-direction: column !important; }
}
@media (max-width: 768px){
  .tp-sidebar{ left: 0; }
}

/* ===== FOOTER SPACER ===== */
.tp-footer-spacer{ height: 3rem; }
