/* ==========================================================================
   Market center market.css
   Recreated from Figma "Market Center" 624:1666 (desktop) / 624:2827 (mobile)
   ========================================================================== */

.market {padding: 30px 0 0;}

/* Breadcrumb */
.crumb { font-size: 16px; color: var(--t-400); margin-bottom: 30px; }
.crumb b { font-weight: 400; color: var(--t-800); }

/* Generic card */
.card {
  background: var(--bg-white); border-radius: var(--r-card);
}
.card-title {
  font-weight: 700; font-size: 20px; color: #111; line-height: 1.2;
}

/* Main grid: left 246 + right main area */
.market-grid {
  display: grid; grid-template-columns: 246px 1fr; gap: 21px;
  align-items: start;
}
.market-main { display: flex; flex-direction: column; gap: 16px; }

/* ====================== Left: species categories ====================== */
.species-card {padding: 35px 19px;height: 100%;}
.species-card .card-title { padding-left: 4px; }

.species-group {
  font-size: 12px;
  color: var(--rank-x);
  margin-top: 21px;
  padding-top: 19px;
  padding-left: 9px;
  border-top: 1px solid rgba(112, 112, 112, .1);
}
.species-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.species-item {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px; padding: 0 9px; border-radius: 6px;
  cursor: pointer; transition: background .15s;
}
.species-item:hover { background: #f9f9f9; }
.species-item.active { background: #f6f6f6; }
.sp-name { font-size: 14px; color: var(--t-800); }
.species-item.active .sp-name { font-weight: 700; }
.sp-chg { font-size: 14px; font-weight: 700; }
.sp-chg.up { color: #3a9c44; }
.sp-chg.down { color: var(--down); }
.species-item:not(.active) .sp-chg { font-weight: 400; }

/* ====================== Quote chart ====================== */
.chart-card { padding: 22px 21px 18px; }
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; padding: 0 1px;
}
.chart-name { font-weight: 700; font-size: 20px; color: #111; }
.chart-code {font-weight: 300;font-size: 12px;color: var(--t-400);margin-left: 8px;}
.chart-price { font-weight: 700; font-size: 16px; color: var(--t-900); margin-top: 11px; }
.chart-delta { font-weight: 400; color: var(--up); }

.time-tabs {display: flex;gap: 10px;flex-shrink: 0;}
.t-tab {
  border: 1px solid #cfcfcf; color: var(--t-600); font-size: 16px;
  border-radius: 66px; height: 38px; padding: 0 20px; line-height: 1;
  white-space: nowrap; transition: all .15s;
}
.t-tab:hover { border-color: var(--orange); color: var(--orange); }
.t-tab.active { background: var(--orange); color: #fff; border-color: var(--orange); }

.chart-area {
  position: relative;
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  margin-top: 19px;
  height: 190px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-area img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.chart-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-weight: 300; font-size: 12px; color: var(--t-400); pointer-events: none;
}
/* Live K-line canvas overlays the static fallback image; shown once data loads */
.chart-area .chart-canvas { position: absolute; inset: 0; background: #fff; display: none; }
.chart-area .chart-canvas.ready { display: block; }

/* Buy / sell */
.bidask {display: grid;grid-template-columns: 1fr 1fr;gap: 16px;margin-top: 19px;}
.ba {
  border-radius: var(--r-sm);
  border: 1px solid;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px 0 19px;
}
.ba-ask { background: #f6fff3; border-color: #1d8e26; }
.ba-bid { background: #fff7f7; border-color: #cb4848; }
.ba-label { font-weight: 300; font-size: 14px; color: var(--t-400); }
.ba-price { font-weight: 700; font-size: 24px; }
.ba-price.up { color: var(--up); }
.ba-price.down { color: var(--down); }

/* ====================== Technical indicator overview ====================== */
.tech-card {padding: 22px 21px 23px;}
.tech-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 17px;
  margin-top: 16px;
}
.tech-box {
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 19px 0 14px;
}
.tech-label { font-weight: 300; font-size: 14px; color: var(--t-400); }
.tech-val { font-weight: 700; font-size: 20px; color: var(--t-800); }
.tech-tag { font-size: 12px; }
.tech-tag.up { color: var(--up); }
.tech-tag.down { color: var(--down); }

/* ====================== Market depth + today's economic events ====================== */
.lower-grid {display: grid;grid-template-columns: 1fr 1fr;gap: 22px;align-items: start;}

.depth-card {padding: 24px 23px 21px 23px;}
.depth-group {display: block;background: #FAFAFA;padding: 15px 26px 14px 18px;border-radius: 12px;flex: 1;}
.depth-side {font-size: 16px;color: var(--t-800);}
.depth-card .card-title + .depth-side { margin-top: 20px; }
.depth-list {margin-top: 12px;display: flex;flex-direction: column;gap: 10px;}
.depth-row { display: flex; align-items: center; gap: 14px; }
.d-price { font-size: 16px; color: var(--t-600); width: 60px; flex-shrink: 0; }
.d-bar { flex: 1; height: 6px; background: var(--line-1); border-radius: 6px; overflow: hidden; }
.d-bar i { display: block; height: 100%; background: var(--orange); border-radius: 6px; }
.d-vol { font-size: 16px; width: 44px; text-align: right; flex-shrink: 0; }
.d-vol.up { color: #3a9c44; }
.d-vol.down { color: var(--down); }

/* Today's economic events */
.event-card {padding: 24px 25px 39px 24px;display: flex;flex-direction: column;}
.event-list {margin-top: 9px;}
.event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-1);
}
.event-row:last-child { border-bottom: none; }
.ev-text { font-size: 16px; color: var(--t-800); }
.ev-tag {
  font-size: 14px;
  border-radius: 19px;
  line-height: 1;
  height: 26px;
  width: 42.72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ev-tag.high { background: #ffecec; color: #c50909; }
.ev-tag.mid { background: #ffefe0; color: #d85d00; }
.event-more {
  align-self: center;
  margin-top: 98px;
  border: 1px solid var(--orange);
  color: var(--orange);
  font-size: 16px;
  border-radius: 80px;
  padding: 12px 28px;
  white-space: nowrap;
  transition: all .15s;
  height: 54px;
  display: flex;
  align-items: center;
}
.event-more:hover { background: var(--orange); color: #fff; }

/* ====================== Related recommendations ====================== */
.related-card { margin-top: 14px; padding: 20px 28px 5px; }
.related-tags {display: flex;flex-wrap: wrap;gap: 24px;margin-top: 24px;}
.rel-tag {
  border: 1px solid #cfcfcf; color: var(--t-800); font-size: 16px;
  border-radius: 66px; height: 50px; padding: 0 30px;
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; transition: all .15s;
}
.rel-tag:hover { border-color: var(--orange); color: var(--orange); }
.rel-empty { margin-top: 24px; color: var(--t-400); font-size: 15px; }

/* ==========================================================================
   Responsive — mobile (<1080) — matching Figma mobile 624:2827
   ========================================================================== */
@media (max-width: 1080px) {
  .market {padding: clamp(18px, 4.72vw, 51px) 0 clamp(34px, 8.98vw, 97px);}
  .crumb { font-size: 12px; margin-bottom: 12px; }

  .card-title {font-size: clamp(15px, 3.89vw, 42px);}

  /* Single-column stack: each card independent */
  .market-grid {grid-template-columns: 1fr;gap: clamp(10px, 2.78vw, 30px);}
  .market-grid > *, .market-main, .market-main > *, .lower-grid > * { min-width: 0; }
  .market-main { gap: 12px; }

  /* Species categories: 2-column grid */
  .species-card {padding: clamp(16px, 4.17vw, 45px) clamp(10px, 2.59vw, 28px) clamp(15px, 3.89vw, 42px) clamp(11px, 2.96vw, 32px);border-radius: clamp(8px, 2.22vw, 24px);}
  .species-card .card-title { padding-left: 0; }
  .species-group {margin-top: clamp(9px, 2.41vw, 26px);padding-left: 0;font-size: clamp(10px, 2.59vw, 28px);border-top: none;padding-top: 0px;}
  .species-list + .species-group {margin-top: clamp(14px, 3.61vw, 39px);}
  .species-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(10px, 2.59vw, 28px) clamp(7px, 1.85vw, 20px);
    border-top: none;
    padding-top: clamp(6px, 1.57vw, 17px);
    margin-top: 0;
  }
  .species-item {
    background: #fff; border: 1px solid #cfcfcf;
    height: 36px; padding: 0 10px; border-radius: 6px;
  }
  .species-item.active {
    background: #090909; border-color: #090909;
  }
  .species-item.active .sp-name { color: #fff; }
  .sp-name {font-size: clamp(13px, 3.33vw, 36px);color: var(--t-800);}
  .sp-chg {font-size: clamp(13px, 3.33vw, 36px);}
  .sp-chg.up { color: #3a9c44; }
  .sp-chg.down { color: var(--down); }

  /* Chart card */
  .chart-card {padding: clamp(14px, 3.8vw, 41px) clamp(8px, 2.13vw, 23px) clamp(11px, 2.96vw, 32px);border-radius: clamp(8px, 2.22vw, 24px);}
  .chart-head { flex-direction: row; align-items: flex-start; gap: 8px; }
  .chart-head > div:first-child { min-width: 96px; flex-shrink: 0; }
  .chart-name {font-size: clamp(15px, 3.89vw, 42px);}
  .chart-code {font-size: clamp(7px, 1.85vw, 20px);margin-left: clamp(3px, 0.83vw, 9px);}
  .chart-price {font-size: clamp(8px, 2.22vw, 24px);margin-top: clamp(8px, 2.04vw, 22px);}
  /* Time frames: shrink so all 6 fit on one row (matching the design, no horizontal scroll) */
  .time-tabs {
    flex: 1;
    flex-wrap: nowrap;
    gap: clamp(3px, 0.83vw, 9px);
    justify-content: space-between;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .time-tabs::-webkit-scrollbar { display: none; }
  .t-tab {width: clamp(35px, 9.35vw, 101px);padding: clamp(6px, 1.57vw, 17px) 0;font-size: clamp(10px, 2.59vw, 28px);border-radius: clamp(23px, 6.11vw, 66px);}
  .chart-area {height: clamp(157px, 41.85vw, 452px);margin-top: clamp(10px, 2.59vw, 28px);border-radius: clamp(4px, 1.11vw, 12px);}
  .bidask {gap: clamp(7px, 1.76vw, 19px);margin-top: clamp(10px, 2.78vw, 30px);}
  .ba {gap: 4px;border-radius: clamp(4px, 1.11vw, 12px);padding: clamp(10px, 2.78vw, 30px) 0 clamp(11px, 3.06vw, 33px);}
  .ba-label {font-size: clamp(8px, 2.22vw, 24px);}
  .ba-price {font-size: clamp(15px, 3.89vw, 42px);}

  /* Technical indicators: 2 columns */
  .tech-card {padding: clamp(16px, 4.26vw, 46px) clamp(11px, 2.96vw, 32px) clamp(15px, 3.92vw, 42.36px);border-radius: clamp(8px, 2.22vw, 24px);}
  .tech-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .tech-box {padding: clamp(14px, 3.61vw, 39px) 0 clamp(12px, 3.3vw, 35.67px);}

  /* Market depth / economic events single column */
  .lower-grid { grid-template-columns: 1fr; gap: 12px; }
  .depth-card, .event-card {padding: clamp(19px, 4.99vw, 53.84px) clamp(18px, 4.72vw, 51.02px) clamp(17px, 4.64vw, 50.11px) clamp(18px, 4.78vw, 51.6px);}
  .depth-card {border-radius: clamp(8px, 2.22vw, 24px);}
  .event-card {border-radius: clamp(8px, 2.22vw, 24px);padding-bottom: clamp(31px, 8.15vw, 88px);}
  .depth-group {
    display: block;
    background: var(--bg-soft);
    border-radius: clamp(4px, 1.11vw, 12px);
    padding: clamp(12px, 3.12vw, 33.65px) clamp(20px, 5.4vw, 58.33px) clamp(11px, 2.91vw, 31.41px) clamp(14px, 3.74vw, 40.38px);
    margin-top: clamp(10px, 2.64vw, 28.5px);
  }
  .depth-group .depth-side {margin-top: 0;font-size: clamp(11px, 2.96vw, 32px);}
  .depth-card .card-title + .depth-group {margin-top: clamp(11px, 2.91vw, 31.41px);}
  .depth-list { gap: 5px; }
  .d-price, .d-vol {font-size: clamp(13px, 3.33vw, 36px);}
  .d-vol { width: 44px; }
  .event-list { margin-top: 10px; }
  .event-row {padding: clamp(13px, 3.45vw, 37.22px) 0 clamp(11px, 3.03vw, 32.69px);}
  .ev-text {font-size: clamp(13px, 3.33vw, 36px);}
  .event-more {margin-top: clamp(76px, 20.35vw, 219.81px);padding: clamp(14px, 3.8vw, 41px) clamp(28px, 7.5vw, 81px);}

  /* Related recommendations: 2 columns */
  .related-card {margin-top: clamp(10px, 2.78vw, 30px);padding: clamp(18px, 4.81vw, 52px) clamp(22px, 5.74vw, 62px) clamp(29px, 7.69vw, 83px) clamp(18px, 4.72vw, 51px);border-radius: clamp(8px, 2.22vw, 24px);}
  .related-tags {display: grid;grid-template-columns: 1fr 1fr;gap: clamp(17px, 4.54vw, 49px) clamp(19px, 5.09vw, 55px);margin-top: clamp(16px, 4.17vw, 45px);}
  .rel-tag {padding: clamp(16px, 4.31vw, 46.5px) 0px;font-size: clamp(10px, 2.59vw, 28px);border-radius: clamp(23px, 6.11vw, 66px);}
}

@media (min-width: 1081px) {
  .market {padding-bottom: 116px;}
  .market-main {gap: 24px;}
  .chart-area {height: 248px;}
  .lower-grid {align-items: stretch;}
  .lower-grid > .card {gap: 14px;display: flex;flex-direction: column;}
  .related-card {margin-top: 24px;padding: 39px 32px 46px;}
}

@media (max-width: 560px) {
  .species-list {gap: clamp(7px, 1.85vw, 20px) clamp(10px, 2.59vw, 28px);}

  .tech-label {font-size: clamp(10px, 2.59vw, 28px);}
  .tech-val {font-size: clamp(15px, 3.89vw, 42px);}
  .tech-tag {font-size: clamp(13px, 3.33vw, 36px);}

}
