@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ================= THEME VARIABLES ================= */
:root {
  --bg: #0f172a;
  --card-bg: #1e293b;

  --text: #e2e8f0;
  --muted: #e2e8f0;
  --neutral: #e2e8f0;

  --btn-bg: #334155;
  --btn-hover: #475569;
  --profit-bg: #273449;

  --green: #22c55e;
  --red: #ef4444;
}

/* ================= LIGHT MODE ================= */
body.light {
  --bg: #eae7df;
  --card-bg: #f8f6f1;

  --text: #1f2937;
  --muted: #1f2937;
  --neutral: #1f2937;

  --btn-bg: #ddd8cd;
  --btn-hover: #cfc9bb;
  --profit-bg: #ece8df;

  --green: #166534;
  --red: #991b1b;
}

/* ================= BODY ================= */
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 20px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ================= CARD ================= */
.card {
  background-color: var(--card-bg);
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

/* ================= TITLE ================= */
h1 {
  font-size: 1.5em;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 600;
}

/* ================= CLOCK ================= */
.time {
  text-align: center;
  font-size: 1.1em;
  margin-bottom: 15px;
}

.last-update {
  margin-left: 6px;
  font-size: 0.9em;
  color: var(--muted);
}

.api-status {
  margin-left: 8px;
  font-size: 0.85em;
  font-weight: 600;
}

.api-status.live { 
  color: var(--green); 
}

.api-status.delay { 
  color: #f59e0b; 
}

.api-status.neutral { 
  color: var(--text); 
}

/* ================= TRADING ROW ================= */
.row {
  display: grid;
  grid-template-columns: 140px 1fr 70px;
  align-items: center;
  column-gap: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.label {
  font-weight: 600;
  text-align: left;
  min-width: 0;
}

.value {
  text-align: center;

  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";

  font-weight: 600;
  min-width: 0;
}

.diff {
  text-align: right;

  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";

  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
}

.diff.green { 
  color: var(--green); 
}

.diff.red {   
  color: var(--red); 
}

.diff.neutral { 
  color: var(--text); 
}

/* ================= SPREAD / PROFIT ================= */
#spread,
#profit {
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
}

/* ================= CHART ================= */
#chartContainer {
  padding-bottom: 10px;
}

#tvChart {
  width: 100%;
  height: 450px;
  border-radius: 8px;
  overflow: hidden;
}

/* ================= BUTTON ================= */
.btn {
  margin: 4px 2px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background-color: var(--btn-bg);
  color: var(--text);
  transition: 0.2s;
  font-weight: 500;
}

.btn:hover {
  background-color: var(--btn-hover);
  transform: translateY(-1px);
}

/* ================= MODAL CENTER TITLE ================= */
.modal-toggle {
  margin-top: 15px;
  text-align: center;
  font-weight: 600;
}

/* ================= MODAL GRID ================= */
.modal-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;

  max-width: 420px;
  margin: 10px auto 0 auto;
}

.modal-options .btn {
  width: 100%;
  text-align: center;
}

/* ================= PROFIT BLOCK ================= */
.profit-block.highlight {
  background: var(--profit-bg);
  padding: 10px;
  border-radius: 8px;
  margin-top: 8px;
  border-left: 4px solid transparent;
}

.profit-block.highlight.green {
  border-left-color: var(--green);
}

.profit-block.highlight.red {
  border-left-color: var(--red);
}

.profit-block.highlight.neutral {
  border-left-color: var(--muted);
}

.profit-block {
  white-space: nowrap;
}

/* ================= MOBILE ================= */
@media (max-width: 600px) {

  body {
    padding: 12px;
  }

  .card {
    padding: 14px;
  }

  .row {
    grid-template-columns: 105px 1fr 55px;
    column-gap: 6px;
  }

  .label {
    font-size: 0.88em;
  }

  .value {
    font-size: 0.95em;
    text-align: center;
  }

  .diff {
    font-size: 0.82em;
    text-align: right;
  }

  #tvChart {
    height: 300px;
  }

  .modal-options {
    max-width: 100%;
  }

  .profit-block {
    white-space: normal;
  }
}

.api-status.error {
  color: var(--red);
}

.api-status.wait,
.api-status.neutral {
  color: var(--text);
}

#highlow {
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
}

/* ================= GOLD HEADER / VOICE ================= */
.gold-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gold-header h1 {
  margin: 0;
  text-align: left;
}

.btn-voice {
  white-space: nowrap;
  flex-shrink: 0;
}