/* css/market-hub.css */
/* GOLD EMPEROR MARKET HUB — Fasa 2 hingga Fasa 6 */
/* Interactive Chart, Market Info, Market Coverage Cards, IB Rebate Bar & Responsive Polish */

/* ============================================================================
   FASA 6: PENYELARASAN ALIRAN VISUAL & PENGHAPUSAN RUANG KOSONG BERLEBIHAN
   ============================================================================ */
#home,
#markets {
  overflow-x: clip;
  scroll-margin-top: 84px;
}

#ge-market-hub-chart-root {
  scroll-margin-top: 90px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ============================================================================
   CARTA UTAMA & INSTRUMENT SELECTOR
   ============================================================================ */
.ge-mh-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(24, 26, 32, 0.97) 0%, rgba(12, 13, 17, 0.99) 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 22px 55px -24px rgba(0, 0, 0, 0.88);
  overflow: hidden;
}

.ge-mh-topbar {
  padding: 14px 16px;
  background: rgba(16, 18, 23, 0.96);
  border-bottom: 1px solid rgba(212, 175, 55, 0.16);
}

.ge-mh-selector-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  background: rgba(12, 13, 17, 0.92);
  border-bottom: 1px solid rgba(212, 175, 55, 0.14);
}

.ge-mh-inst-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #14161C;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
  min-width: 0;
}

.ge-mh-inst-btn:hover {
  border-color: rgba(212, 175, 55, 0.45);
  background: #1A1D24;
}

.ge-mh-inst-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(184, 145, 35, 0.08) 100%);
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.ge-mh-inst-sym {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: #FFFFFF;
  line-height: 1.15;
}

.ge-mh-inst-btn.active .ge-mh-inst-sym {
  color: #F5E6B8;
}

.ge-mh-inst-name {
  font-size: 10.5px;
  color: #9A9FA8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ============================================================================
   MARKET INFORMATION PANEL (SINGLE QUOTE + METADATA)
   ============================================================================ */
.ge-mh-info-panel {
  background: #101218;
  border-bottom: 1px solid rgba(212, 175, 55, 0.14);
  padding: 10px 16px 12px;
}

.ge-mh-quote-shell {
  position: relative;
  min-height: 112px;
  border-radius: 12px;
  background: #0B0C10;
  border: 1px solid rgba(212, 175, 55, 0.16);
  overflow: hidden;
}

.ge-mh-quote-host {
  width: 100%;
  min-height: 112px;
}

.ge-mh-quote-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #0B0C10;
}

.ge-mh-quote-overlay.hidden {
  display: none;
}

.ge-mh-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ge-mh-meta-cell {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.ge-mh-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8E939E;
  line-height: 1.2;
}

.ge-mh-meta-val {
  font-size: 11.5px;
  font-weight: 600;
  color: #FFFFFF;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   TIMEFRAME TOOLBAR & CHART STAGE
   ============================================================================ */
.ge-mh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: #0F1116;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ge-mh-tf-group {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: #16181F;
  border: 1px solid rgba(212, 175, 55, 0.18);
  max-width: 100%;
}

.ge-mh-tf-btn {
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #A5A5A5;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ge-mh-tf-btn:hover {
  color: #FFFFFF;
}

.ge-mh-tf-btn.active {
  background: linear-gradient(135deg, #E5C76B 0%, #D4AF37 60%, #B89123 100%);
  color: #0B0C0E;
  font-weight: 700;
}

.ge-mh-stage {
  position: relative;
  width: 100%;
  height: 410px;
  background: #0E1014;
}

.ge-mh-widget-host {
  width: 100%;
  height: 100%;
}

.ge-mh-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: rgba(14, 16, 20, 0.92);
  text-align: center;
  transition: opacity 0.25s ease;
}

.ge-mh-overlay.hidden {
  display: none;
}

.ge-mh-spinner {
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  border: 2.5px solid rgba(212, 175, 55, 0.2);
  border-top-color: #D4AF37;
  animation: geMhSpin 0.8s linear infinite;
}

@keyframes geMhSpin {
  to { transform: rotate(360deg); }
}

.ge-mh-status-bar {
  padding: 10px 16px;
  background: rgba(13, 15, 19, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  font-size: 11px;
  color: #9A9FA8;
}

.ge-mh-disclaimer {
  padding: 11px 16px 13px;
  background: rgba(9, 10, 14, 0.96);
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  font-size: 11px;
  line-height: 1.55;
  color: #8D929E;
}

/* ============================================================================
   BAR KHAS GOLD EMPEROR IB REBATE (TERASING DI BAWAH CARTA)
   ============================================================================ */
.ge-mh-rebate-bar {
  width: 100%;
  max-width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.11) 0%, rgba(18, 20, 26, 0.97) 52%, rgba(12, 13, 17, 0.99) 100%);
  border: 1px solid rgba(212, 175, 55, 0.34);
  box-shadow: 0 14px 34px -20px rgba(0, 0, 0, 0.85);
}

.ge-mh-rebate-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ge-mh-rebate-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 230, 184, 0.2) 0%, rgba(212, 175, 55, 0.08) 100%);
  border: 1px solid rgba(212, 175, 55, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #D4AF37;
  flex-shrink: 0;
}

.ge-mh-rebate-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ge-mh-rebate-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #0B0C0E;
  background: linear-gradient(135deg, #E5C76B 0%, #D4AF37 60%, #B89123 100%);
  transition: filter 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.ge-mh-rebate-link:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.ge-mh-rebate-terms-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #F5E6B8;
  background: rgba(11, 12, 14, 0.72);
  border: 1px solid rgba(212, 175, 55, 0.28);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.ge-mh-rebate-terms-btn:hover {
  border-color: rgba(212, 175, 55, 0.65);
  color: #FFFFFF;
}

.ge-mh-rebate-desc {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(212, 175, 55, 0.14);
  font-size: 11.5px;
  line-height: 1.5;
  color: #9A9FA8;
}

/* ============================================================================
   MARKET COVERAGE CARDS GRID (1440px / 1024px / 768px / 430px / 390px / 375px)
   ============================================================================ */
.ge-mc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.ge-mc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  border-radius: 18px;
  padding: 15px;
  background: linear-gradient(180deg, rgba(24, 26, 32, 0.97) 0%, rgba(14, 15, 19, 0.99) 100%);
  border: 1px solid rgba(212, 175, 55, 0.2);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.24s ease, box-shadow 0.24s ease;
}

.ge-mc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 175, 55, 0.52);
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.85);
}

.ge-mc-card.active {
  border-color: rgba(212, 175, 55, 0.9);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.1) 0%, rgba(16, 18, 23, 0.99) 55%);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.32), 0 18px 38px -16px rgba(212, 175, 55, 0.22);
}

.ge-mc-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ge-mc-badge-gold {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #F5E6B8;
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid rgba(212, 175, 55, 0.4);
  white-space: nowrap;
}

.ge-mc-badge-neutral {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #C9CDD6;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}

.ge-mc-active-tag {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #0B0C0E;
  background: linear-gradient(135deg, #F5E6B8 0%, #D4AF37 100%);
  white-space: nowrap;
}

.ge-mc-card.active .ge-mc-active-tag {
  display: inline-flex;
}

.ge-mc-mini-wrap {
  position: relative;
  width: 100%;
  height: 184px;
  margin-top: 8px;
  border-radius: 12px;
  background: #0B0C10;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.ge-mc-mini-host {
  width: 100%;
  height: 100%;
}

.ge-mc-click-shield {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: transparent;
  cursor: pointer;
}

.ge-mc-mini-status {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: #0B0C10;
  text-align: center;
  font-size: 11px;
  color: #8E939E;
}

.ge-mc-mini-status.hidden {
  display: none;
}

.ge-mc-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ge-mc-view-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #F5E6B8;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ge-mc-view-btn:hover,
.ge-mc-card.active .ge-mc-view-btn {
  background: linear-gradient(135deg, #E5C76B 0%, #D4AF37 60%, #B89123 100%);
  color: #0B0C0E;
  border-color: #F5E6B8;
}

.ge-mc-overview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #B4B8C2;
  background: #14161C;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ge-mc-overview-btn:hover {
  color: #FFFFFF;
  border-color: rgba(212, 175, 55, 0.42);
}

/* ============================================================================
   FULLSCREEN CHART MODAL
   ============================================================================ */
.ge-mh-fs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: none;
  flex-direction: column;
  background: #0B0C0E;
  padding: 12px;
}

.ge-mh-fs-backdrop.open {
  display: flex;
}

.ge-mh-fs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px 14px 0 0;
  background: #14161C;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-bottom: none;
}

.ge-mh-fs-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: #0E1014;
}

/* ============================================================================
   TITIK RESPONSIF TEPAT (1440px -> 1024px -> 768px -> 430px -> 390px -> 375px)
   ============================================================================ */

/* Laptop 1024px: 4 kolum kemas dengan jarak padat */
@media (max-width: 1200px) and (min-width: 1024px) {
  .ge-mh-stage {
    height: 385px;
  }
  .ge-mc-grid {
    gap: 12px;
  }
  .ge-mc-card {
    padding: 13px;
  }
  .ge-mc-card-foot {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Tablet 768px (< 1024px): 2 kolum seimbang & ruang menegak rapat */
@media (max-width: 1023px) {
  .ge-mh-stage {
    height: 375px;
  }
  .ge-mc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

/* Mobile Besar (430px - 640px): 2 kolum kad + carta lebar penuh */
@media (max-width: 640px) {
  .ge-mh-topbar {
    padding: 12px 14px;
  }
  .ge-mh-selector-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px;
    gap: 7px;
  }
  .ge-mh-info-panel {
    padding: 10px 12px;
  }
  .ge-mh-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .ge-mh-toolbar {
    padding: 9px 12px;
  }
  .ge-mh-stage {
    height: 345px;
  }
  .ge-mh-status-bar,
  .ge-mh-disclaimer {
    padding: 10px 12px;
  }
  .ge-mh-rebate-bar {
    padding: 13px;
  }
  .ge-mh-rebate-actions {
    width: 100%;
  }
  .ge-mh-rebate-link,
  .ge-mh-rebate-terms-btn {
    flex: 1;
    justify-content: center;
  }
  .ge-mc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .ge-mc-card {
    padding: 12px;
  }
  .ge-mc-card-head {
    flex-direction: column;
    gap: 6px;
  }
  .ge-mc-card-head > div:last-child {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .ge-mc-mini-wrap {
    height: 162px;
  }
  .ge-mc-card-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
}

/* Skrin Mobile Kecil (390px & 375px): 1 kolum penuh supaya teks & mini chart luas */
@media (max-width: 419px) {
  .ge-mh-tf-btn {
    padding: 6px 9px;
    font-size: 11px;
  }
  .ge-mh-stage {
    height: 330px;
  }
  .ge-mc-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .ge-mc-card {
    padding: 14px;
  }
  .ge-mc-card-head {
    flex-direction: row;
    align-items: flex-start;
  }
  .ge-mc-card-head > div:last-child {
    flex-direction: column;
    align-items: flex-end;
    width: auto;
  }
  .ge-mc-mini-wrap {
    height: 178px;
  }
  .ge-mc-card-foot {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
}

/* Ruang bawah selamat supaya butang terapung WhatsApp tidak menutup kad/footer */
@media (max-width: 640px) {
  #markets {
    padding-bottom: 44px;
  }
  footer {
    padding-bottom: 88px;
  }
}
