/* ==========================================================================
   Trading tools page tools.css
   Replicated from Figma "DaK Precious Metals / Trading Tools" (624:1959 desktop / 624:3086 mobile).
   Desktop 1081-1920, mobile <1080. Reuse base.css variables and components where possible.
   ========================================================================== */

/* Page-local color variables (this page's dedicated light-gray fill / border / impact label) */
.page-tools {
  --tool-field-bg: #fafafa;
  --tool-field-line: #e1e1e1;
  --tool-chip-line: #cfcfcf;
  --imp-high-bg: #ffecec;
  --imp-high-tx: #c50909;
  --imp-mid-bg: #ffefe0;
  --imp-mid-tx: #d85d00;
}

/* Overall section outer spacing */
.tools-main {
  padding: 0 0 116px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 16px;
  color: var(--t-400);
  font-weight: 400;
  padding-top: 30px;
  padding-bottom: 24px;
}

.breadcrumb .cur {
  color: var(--t-800);
}

/* ====================== Tool card common ====================== */
.tool-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.tcard {
  background: #fff;
  border-radius: var(--r-card);
  padding: 45px 39px 39px;
  display: flex;
  flex-direction: column;
}

.tcard-head {
  margin-bottom: 30px;
}

/* Card head without subtitle (mainstream platform spread reference); spacing managed separately */
.tcard-head--no-sub {
  margin-bottom: 24px;
}

.tcard-title {
  font-weight: 700;
  font-size: 20px;
  color: #111;
}

.tcard-sub {
  font-size: 16px;
  color: var(--t-400);
  margin-top: 9px;
}

/* Uniform flexible card height: keep margin / P&L / currency-exchange form cards equal height */
.tcard.calc {
  min-height: 470px;
}

/* Form field (dropdown / input appearance) */
.field {
  background: var(--tool-field-bg);
  border: 1px solid var(--tool-field-line);
  border-radius: var(--r-sm);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  position: relative;
}

.field+.field {
  margin-top: 16px;
}

.field .lbl {
  font-size: 16px;
  color: #111;
  flex-shrink: 0;
}

.field .v {
  font-size: 16px;
  color: var(--t-600);
}

/* Real form controls reuse the .v look: fill the row, right-aligned, borderless */
select.v, input.v {
  flex: 1; min-width: 0; width: 100%;
  appearance: none; -webkit-appearance: none;
  background: transparent; border: none; outline: none;
  font-family: inherit; font-size: 16px; color: var(--t-600);
  text-align: right;
}
.field.select select.v { padding-right: 22px; cursor: pointer; }   /* clear the ::after arrow */
input.v::-webkit-outer-spin-button,
input.v::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.v[type=number] { -moz-appearance: textfield; }

/* Dropdown arrow */
.field.select::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  width: 14px;
  height: 8px;
  transform: translateY(-50%);
  background: var(--t-400);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform .18s ease, background .15s ease;
}

/* 交互态：悬停/聚焦橙色描边、箭头变橙并翻转、轻微橙色聚焦光环（呼应全站橙色强调） */
.field { transition: border-color .15s ease, box-shadow .15s ease; }
.field:hover { border-color: var(--orange); }
.field.select:hover::after { background: var(--orange); }
.field:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 116, 1, .12); }
.field.select:focus-within::after { background: var(--orange); transform: translateY(-50%) rotate(180deg); }

/* 自定义下拉弹层：替换浏览器原生选项列表，统一站点风格 */
.field.select { cursor: pointer; }
.field.select select.v { pointer-events: none; }   /* 屏蔽原生弹层；select 仍负责取值/显示 */
.field.select.is-open { border-color: var(--orange); }
.field.select.is-open::after { background: var(--orange); transform: translateY(-50%) rotate(180deg); }
.select-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-card);
  padding: 6px;
  max-height: 248px;
  overflow: auto;
  display: none;
}
.field.select.is-open .select-pop { display: block; }
.select-opt {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--t-700);
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.select-opt:hover { background: var(--bg-soft); color: var(--orange); }
.select-opt.is-sel { background: var(--orange); color: #fff; }

/* P&L calculator: two side-by-side columns at top */
.field-row {
  display: flex;
  gap: 14px;
}

.field-row .field {
  flex: 1;
}

.field-row .field+.field {
  margin-top: 0;
}

/* Calculate button (solid orange bar) */
.calc-btn {
  background: var(--orange);
  color: #fff;
  font-family: var(--font-sc);
  font-weight: 700;
  font-size: 20px;
  border-radius: var(--r-pill);
  height: 56px;
  width: 100%;
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .18s ease;
}

.calc-btn:hover {
  filter: brightness(1.06);
}

/* Result bar (light-gray rounded, centered bold result) */
.calc-result {
  background: var(--tool-field-bg);
  border-radius: var(--r-sm);
  height: 70px;
  margin-top: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: var(--t-800);
}

/* ====================== Spread reference / table common ====================== */
.t-table {
  background: var(--tool-field-bg);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-top: 0;
}

.t-table .t-row {
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--line-1);
}

.t-table .t-row:last-child {
  border-bottom: none;
}

.t-table .t-head {
  background: var(--orange);
  height: 54px;
  border-bottom: none;
}

.t-table .t-head span {
  color: #fff;
  font-weight: 500;
  font-size: 16px;
  text-align: center;
}

.t-table .t-row:not(.t-head) {
  height: 50px;
  font-size: 16px;
}

.t-table .t-row:not(.t-head) span {
  text-align: center;
  color: var(--t-800);
}

/* Spread table: 3 columns, vertical separators */
.spread-table .t-row {
  grid-template-columns: repeat(3, 1fr);
}

.spread-table .t-row>span {
  position: relative;
}

.spread-table .t-row>span+span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 100%;
  background: var(--line-1);
}

.spread-table .t-head span+span::before {
  display: none;
}

.spread-table .t-row:not(.t-head) .c-num {
  color: var(--t-600);
}

/* Spread card "view more" button (orange outline, centered) */
.tcard .more-link {
  align-self: center;
  margin-top: 22px;
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: var(--r-pill);
  font-size: 16px;
  padding: 13px 30px;
  transition: all .18s ease;
}

.tcard .more-link:hover {
  background: var(--orange);
  color: #fff;
}

/* ====================== Full-width cards: economic calendar / trading hours ====================== */
.wide-card {
  background: #fff;
  border-radius: var(--r-card);
  padding: 32px 39px 39px 45px;
  margin-top: 18px;
}

.wide-card .tcard-title {
  margin-bottom: 16px;
}

/* Economic calendar table, 3 columns */
/* Calendar "show more": extra rows hidden until the toggle is clicked */
.calendar-table .cal-extra { display: none; }
.calendar-table.show-all .cal-extra { display: grid; }
#calMoreBtn { cursor: pointer; }

.calendar-table .t-row {
  grid-template-columns: 1fr 1.5fr 1fr;
}

/* Trading hours table, 3 columns */
.session-table .t-row {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Impact label */
.imp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  min-width: 43px;
  height: 26px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1;
}

.imp.high {
  background: var(--imp-high-bg);
  color: var(--imp-high-tx);
}

.imp.mid {
  background: var(--imp-mid-bg);
  color: var(--imp-mid-tx);
}

/* Full-width card "view more" button centered */
.wide-card .more-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 22px auto 0;
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: var(--r-pill);
  font-size: 16px;
  padding: 13px 52px;
  width: max-content;
  transition: all .18s ease;
}

.wide-card .more-link:hover {
  background: var(--orange);
  color: #fff;
}

.wide-card .more-wrap {
  display: flex;
  justify-content: center;
}

/* ====================== APPs that integrate these tools ====================== */
.integrate-card {
  background: #fff;
  border-radius: var(--r-card);
  padding: 39px 32px 46px;
  margin-top: 18px;
}

.integrate-card h2 {
  font-weight: 900;
  font-size: 20px;
  color: #111;
  margin-bottom: 24px;
}

.integrate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.int-chip {
  border: 1px solid var(--tool-chip-line);
  color: var(--t-800);
  border-radius: 66px;
  font-family: var(--font-sc);
  font-size: 16px;
  letter-spacing: -0.08px;
  padding: 14px 20px;
  line-height: 1;
  transition: all .18s ease;
}

.int-chip:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ==========================================================================
   Responsive - mobile (<1080) - against Figma's standalone mobile design 624:3086
   ========================================================================== */
@media (max-width: 1080px) {
  .tools-main {
    padding: 0 0 clamp(35px, 9.26vw, 100px);
  }

  .breadcrumb {
    font-size: 14px;
    padding-top: clamp(18px, 4.72vw, 51px);
    padding-bottom: clamp(18px, 4.72vw, 51px);
  }

  /* Tool cards: single-column stack */
  .tool-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tcard {
    padding: 18px 18px 20px;
  }

  .tcard.calc {
    min-height: 0;
  }

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

  .tcard-sub {
    font-size: clamp(10px, 2.59vw, 28px);
    margin-top: clamp(2px, 0.52vw, 5.6px);
  }

  .tcard-head {
    margin-bottom: 12px;
  }

  .tool-cards .tcard:nth-child(3) {
    padding: clamp(27px, 7.15vw, 77.21px) clamp(22px, 5.87vw, 63.38px) clamp(23px, 6.17vw, 66.62px) clamp(23px, 6.1vw, 65.86px);
    border-radius: clamp(14px, 3.79vw, 40.95px);
  }

  .tcard-head--no-sub {
    margin-bottom: clamp(11px, 2.89vw, 31.19px);
  }

  .field {
    height: 40px;
    padding: 0 12px;
  }

  .field+.field {
    margin-top: clamp(7px, 1.85vw, 20px);
  }

  .field .lbl,
  .field .v {
    font-size: 12px;
  }

  .field-row {
    gap: 8px;
  }

  .calc-btn {
    height: clamp(40px, 10.74vw, 116.02px);
    font-size: clamp(13px, 3.33vw, 36px);
    margin-top: clamp(17px, 4.63vw, 50px);
    font-weight: 500;
    border-radius: clamp(36px, 9.48vw, 102.37px);
  }

  .calc-result {
    height: clamp(53px, 14.22vw, 153.56px);
    font-size: clamp(13px, 3.33vw, 36px);
    margin-top: clamp(14px, 3.7vw, 39.98px);
    border-radius: clamp(7px, 1.9vw, 20.47px);
  }

  /* Compress tables */
  .t-table .t-head {
    height: 42px;
  }

  .t-table .t-head span {
    font-size: 11px;
  }

  .t-table .t-row:not(.t-head) {
    height: 38px;
    font-size: clamp(13px, 3.33vw, 36px);
  }

  .tcard .more-link {
    margin-top: 14px;
    padding: 10px 24px;
    font-size: 12px;
  }

  .tool-cards .tcard:nth-child(3) .t-table .t-head {
    height: 45px;
  }

  .tool-cards .tcard:nth-child(3) .t-table .t-row:not(.t-head) {
    height: 42px;
  }

  .tool-cards .tcard:nth-child(3) .more-link {
    margin-top: clamp(21px, 5.52vw, 59.59px);
  }

  /* Full-width cards */
  .wide-card {
    padding: 18px 16px 20px;
    margin-top: 12px;
  }

  .wide-card .tcard-title {
    margin-bottom: clamp(11px, 3.06vw, 33px);
  }

  .tool-cards+.wide-card .tcard-title {
    font-size: 0;
  }

  .tool-cards+.wide-card .tcard-title::after {
    content: "主流平台点差参考";
    font-size: clamp(15px, 3.89vw, 42px);
  }

  .imp {
    min-width: 34px;
    height: 22px;
    font-size: 11px;
    padding: 0 8px;
  }

  .wide-card .more-link {
    margin-top: 14px;
    padding: 10px 36px;
    font-size: 12px;
  }

  /* Integrate APPs */
  .integrate-card {
    padding: clamp(20px, 5.46vw, 59px) clamp(15px, 4.07vw, 44px) clamp(28px, 7.5vw, 81px)clamp(24px, 6.39vw, 69px);
    margin-top: clamp(10px, 2.78vw, 30px);
  }

  .integrate-card h2 {
    font-size: clamp(15px, 3.89vw, 42px);
    margin-bottom: clamp(14px, 3.7vw, 40px);
  }

  .integrate-chips {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(17px, 4.54vw, 49px) clamp(19px, 5.09vw, 55px);
  }

  .int-chip {
    font-size: clamp(10px, 2.59vw, 28px);
    padding: clamp(16px, 4.31vw, 46.5px) 0;
    text-align: center;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .tcard {
    padding: clamp(17px, 4.63vw, 50px) clamp(23px, 6.2vw, 67px) clamp(18px, 4.67vw, 50.44px);
  }

  .wide-card {
    padding: 16px 14px 18px;
  }

  .tool-cards+.wide-card {
    padding: 34px 26px 29px;
  }

  .tool-cards+.wide-card .more-wrap {
    display: none;
  }

  .tool-cards+.wide-card .t-table .t-row:not(.t-head) {
    height: 44px;
  }

  .t-table .t-head span {
    font-size: clamp(13px, 3.33vw, 36px);
    font-weight: bold;
  }

  .t-table .t-row:not(.t-head) {
    font-size: clamp(13px, 3.33vw, 36px);
  }

  /* Integrate-APP labels: keep long copy on a single line, no wrap (matches Figma whitespace-nowrap) */
  .int-chip {
    font-size: clamp(10px, 2.59vw, 28px);
    padding: clamp(16px, 4.31vw, 46.5px) 0;
    letter-spacing: -0.3px;
  }
}

@media (min-width: 1081px) {
  .tools-main {
    padding-bottom: 116px;
  }

  .breadcrumb {
    padding-bottom: 30px;
  }

  .tool-cards>.tcard.calc .calc-btn {
    height: 68px;
    margin-top: 24px;
  }

  .tool-cards>.tcard:nth-child(3) .more-link {
    margin-top: 49px;
  }

  .wide-card {
    margin-top: 24px;
  }

  .tool-cards+.wide-card .more-link {
    margin-top: 29px;
  }

  .integrate-card {
    margin-top: 24px;
  }
}
