/* ===== Trading Platform Page ===== */
.page-trading {
  background: var(--color-white);
}

/* Hero */
.tp-hero {
  background: var(--color-dark);
  padding: calc(var(--header-height) + 60px) 0 80px;
}

.tp-hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.tp-hero__text h1 {
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-white);
  margin-bottom: 20px;
}

.tp-hero__text h1 .accent {
  color: var(--color-accent);
}

.tp-hero__text p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.tp-hero__image img {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* Section common */
.tp-section {
  padding: 80px 0;
}

.tp-section--white {
  background: var(--color-white);
}

.tp-section--dark {
  background: var(--color-dark);
  color: var(--color-white);
}

.tp-section--gradient {
  background: linear-gradient(135deg, #0070f0 0%, #0050c8 50%, #003d9e 100%);
  color: var(--color-white);
}

.tp-section__title {
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 800;
  text-align: center;
  margin-bottom: 40px;
  line-height: 1.2;
}

/* Tabs */
.tp-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}

.tp-tab {
  padding: 8px 18px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--color-gray-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.tp-tab:hover {
  background: #e2e6ef;
}

.tp-tab.active {
  background: var(--color-accent);
  color: var(--color-text);
  box-shadow: 0 4px 12px rgba(232, 93, 117, 0.35);
}

.tp-section--dark .tp-tab,
.tp-section--gradient .tp-tab {
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-white);
}

.tp-section--dark .tp-tab:hover,
.tp-section--gradient .tp-tab:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tp-section--dark .tp-tab.active,
.tp-section--gradient .tp-tab.active {
  background: var(--color-accent);
  color: var(--color-text);
}

.tp-tab-panel {
  display: none;
}

.tp-tab-panel.active {
  display: block;
}

/* Stock Grid */
.tp-stocks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.tp-stock-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e8ebf2;
  background: var(--color-white);
}

.tp-stock-card__logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.tp-stock-card__info {
  flex: 1;
  min-width: 0;
}

.tp-stock-card__code {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}

.tp-stock-card__name {
  font-size: 13px;
  color: var(--color-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-stock-card__chart {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.tp-stock-card__sparkline {
  width: 48px;
  height: 20px;
}

.tp-stock-card__change {
  font-size: 15px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: var(--color-text);
}

/* Why Trade */
.tp-why__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.tp-why__features {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.tp-why__feature h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.tp-why__feature p {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.tp-why__feature p a {
  color: var(--color-white);
  text-decoration: underline;
}

.tp-why__image img {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* Explore Stocks */
.tp-explore__inner {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 48px;
  align-items: center;
}

.tp-explore__text h3 {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-text);
}

.tp-explore__text p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text-light);
}

.tp-explore__cloud {
  width: 100%;
  min-height: 320px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* ESG */
.tp-esg__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.tp-esg__image img {
  width: 100%;
  max-width: 520px;
}

.tp-esg__text h2 {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 20px;
}

.tp-esg__text p {
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 28px;
}

.tp-esg__logo img {
  height: 36px;
  width: auto;
}

/* Trading Tools */
.tp-tools__inner {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 48px;
  align-items: center;
}

.tp-tools__text h3 {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 700;
  margin-bottom: 16px;
}

.tp-tools__text p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text-light);
}

.tp-tools__image img {
  width: 100%;
  max-width: 630px;
  margin: 0 auto;
}

/* TradingView */
.tp-tradingview__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.tp-tradingview__text h2 {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  margin-bottom: 20px;
}

.tp-tradingview__text p {
  font-size: 16px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
}

.tp-tradingview__image img {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* Learn Cards */
.tp-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.tp-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.tp-card--dark {
  background: var(--color-dark);
}

.tp-card--blue {
  background: var(--color-primary);
}

.tp-card--rose {
  background: var(--color-accent);
}

.tp-card__body {
  padding: 28px 28px 0;
  flex: 1;
}

.tp-card__body h3 {
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.tp-card__body p {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.9);
}

.tp-card__image {
  padding: 20px 28px 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tp-card__image img {
  max-height: 160px;
  width: auto;
  object-fit: contain;
}

.tp-card__link {
  display: inline-block;
  margin-top: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-white);
  text-decoration: underline;
}

.tp-card__link:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* CTA Switch */
.tp-cta {
  padding: 0 0 80px;
  background: var(--color-white);
}

.tp-cta__box {
  background: var(--color-dark);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 32px;
  align-items: center;
  color: var(--color-white);
}

.tp-cta__text h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  margin-bottom: 12px;
}

.tp-cta__text p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}

.tp-cta__visual {
  position: relative;
  width: 170px;
  flex-shrink: 0;
}

.tp-cta__visual-bg,
.tp-cta__visual-finger {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.tp-cta__visual-inner {
  position: relative;
  padding-bottom: 120%;
}

.tp-cta__visual-bg {
  position: absolute;
  top: 1%;
  left: 1%;
  width: 99%;
  padding-bottom: 47%;
  background-image: url('https://assets.cmcinvest.com/invest-sg/image-switch-bg.png');
}

.tp-cta__visual-finger {
  position: absolute;
  top: 0;
  width: 101%;
  padding-bottom: 121%;
  background-image: url('https://assets.cmcinvest.com/invest-sg/image-button-finger.png');
  animation: tp-finger-switch 2.5s ease-in-out infinite;
}

@keyframes tp-finger-switch {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* FAQ */
.tp-faq__subtitle {
  text-align: center;
  font-size: 16px;
  color: var(--color-text-light);
  margin-top: -24px;
  margin-bottom: 40px;
}

.tp-faq__list {
  max-width: 900px;
  margin: 0 auto;
}

.tp-faq__item {
  border-bottom: 1px solid #e0e4ed;
}

.tp-faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 40px 20px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  text-align: left;
  position: relative;
  cursor: pointer;
}

.tp-faq__question img {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.tp-faq__item.is-open .tp-faq__question img {
  transform: translateY(-50%) rotate(180deg);
}

.tp-faq__answer {
  display: none;
  padding: 0 0 20px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--color-text-light);
}

.tp-faq__item.is-open .tp-faq__answer {
  display: block;
}

.tp-faq__answer ul {
  list-style: disc;
  padding-left: 20px;
  margin: 12px 0;
}

.tp-faq__answer li {
  margin-bottom: 6px;
}

.tp-faq__answer h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 16px 0 8px;
}

/* Responsive */
@media (max-width: 1024px) {
  .tp-stocks-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tp-why__inner,
  .tp-esg__inner,
  .tp-tradingview__inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .tp-explore__inner,
  .tp-tools__inner {
    grid-template-columns: 1fr;
  }

  .tp-explore__cloud {
    min-height: 260px;
  }

  .tp-cards {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }

  .tp-cta__box {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 40px 32px;
  }

  .tp-cta__visual {
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .tp-hero__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .tp-hero__image {
    order: -1;
  }

  .tp-stocks-grid {
    grid-template-columns: 1fr;
  }

  .tp-section {
    padding: 60px 0;
  }

  .tp-esg__inner {
    direction: ltr;
  }

  .tp-esg__image {
    order: -1;
  }

  [data-tab-panel="explore"][data-tab="sg"] .tp-explore__cloud {
    background-image: url('https://assets.cmcinvest.com/invest-sg/stock-cloud-sg-mobile.png') !important;
  }

  [data-tab-panel="explore"][data-tab="us"] .tp-explore__cloud {
    background-image: url('https://assets.cmcinvest.com/invest-sg/stock-cloud-us-mobile.png') !important;
  }

  [data-tab-panel="explore"][data-tab="hk"] .tp-explore__cloud {
    background-image: url('https://assets.cmcinvest.com/invest-sg/stock-cloud-hk-mobile.png') !important;
  }
}

@media (max-width: 480px) {
  .tp-cta__box {
    padding: 32px 24px;
  }

  .tp-stock-card__logo {
    width: 44px;
    height: 44px;
  }
}
