/* =========================================================
   Shaluq Jewellers L.L.C — Live Rates (Design 2: Royal Navy & Champagne)
   ========================================================= */

:root {
  --navy-900: #071226;
  --navy-800: #0a1a33;
  --navy-700: #112a52;
  --navy-600: #1b3a6b;
  --navy-line: rgba(255, 255, 255, 0.09);

  --champagne: #e3c27a;
  --gold: #f5c02a;
  --gold-deep: #b98524;
  --bronze: #a0582a;

  --bg: #eef1f6;
  --card: #ffffff;
  --text: #0f1b2f;
  --text-soft: #5b6779;
  --row-line: #e6eaf1;

  --gold-grad: linear-gradient(
    120deg,
    #a0582a 0%,
    #d6981f 22%,
    #f7ee7f 48%,
    #f5c02a 68%,
    #a0582a 100%
  );

  --up: #0f9150;
  --down: #d23a2f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* Scales with the smaller of width/height so any TV (HD -> 4K) fits one screen */
  font-size: clamp(12px, min(1.05vw, 1.9vh), 64px);
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(15rem, 22%) 1fr;
  height: 100vh;
}

/* ======================= Sidebar ======================= */
.sidebar {
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, rgba(227, 194, 122, 0.18), transparent 45%),
    linear-gradient(180deg, var(--navy-700) 0%, var(--navy-800) 45%, var(--navy-900) 100%);
  color: #e8edf6;
  padding: 1.4rem 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold-grad);
}

.side-brand {
  text-align: center;
}

.side-brand img {
  height: 8.5rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.side-kicker {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: 0.3rem;
}

.side-clock {
  text-align: center;
  padding: 0.8rem 0.6rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(227, 194, 122, 0.3);
}

.side-time {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.1;
  white-space: nowrap;
}

.side-date {
  display: block;
  font-size: 0.65rem;
  color: #9fb0cc;
  margin-top: 0.25rem;
}

.zones {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.zones li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--navy-line);
  font-size: 0.72rem;
}

.zones li:last-child {
  border-bottom: none;
}

.zones img {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  object-fit: cover;
}

.zones span {
  color: #b8c4d8;
}

.zones b {
  margin-left: auto;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.side-contact {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(227, 194, 122, 0.3);
}

.sc-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  color: #dfe6f2;
  min-width: 0;
  padding: 0.15rem 0;
  transition: color 0.2s;
}

.sc-row:hover {
  color: var(--champagne);
}

.sc-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sc-row small {
  color: #9fb0cc;
  font-size: 0.62rem;
}

.sc-row i {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 7px;
  background: var(--gold-grad);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sc-row svg {
  width: 58%;
  height: 58%;
  fill: var(--navy-800);
}

/* ======================= Main ======================= */
.main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem 1.6rem 1rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar h1 {
  font-family: "Playfair Display", serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1.1;
}

.topbar p {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--navy-800);
  background: var(--card);
  border: 1px solid var(--row-line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  box-shadow: 0 2px 8px rgba(10, 26, 51, 0.06);
}

.status b {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(15, 145, 80, 0.5);
  animation: ping 1.6s infinite;
}

@keyframes ping {
  70% {
    box-shadow: 0 0 0 6px rgba(15, 145, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 145, 80, 0);
  }
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(10, 26, 51, 0.06),
    0 10px 30px rgba(10, 26, 51, 0.08);
  overflow: hidden;
}

/* ---------- Spot board ---------- */
.spot-board {
  flex-shrink: 0;
}

.board-head,
.board-row {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 1.3fr 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0 1.3rem;
}

.board-head {
  background: var(--navy-800);
  color: var(--champagne);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.board-head small {
  color: #8ea0bf;
  font-size: 0.55rem;
  letter-spacing: 1px;
}

.board-head span:nth-child(2),
.board-head span:nth-child(3) {
  text-align: center;
}

.board-head span:nth-child(4) {
  text-align: right;
}

.board-row {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.board-row + .board-row {
  border-top: 1px solid var(--row-line);
}

.metal {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.coin {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(10, 26, 51, 0.15);
}

.coin-gold {
  background: radial-gradient(circle at 35% 30%, #fff6b8, #f5c02a 45%, #a0582a 100%);
  color: #5a3110;
}

.coin-silver {
  background: radial-gradient(circle at 35% 30%, #ffffff, #c9cdd3 50%, #7b818a 100%);
  color: #2d3440;
}

.metal b {
  display: block;
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1.1;
}

.metal small {
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.value-box {
  text-align: center;
  border-radius: 12px;
  background: #f6f8fb;
  border: 1px solid var(--row-line);
  padding: 0.5rem 0.4rem;
  transition: background 0.25s ease;
}

.value-box .price {
  display: block;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--navy-800);
  line-height: 1.15;
}

.value-box[style*="green"] {
  background: linear-gradient(180deg, #17a35c, #0b7a40) !important;
  border-color: #0b7a40;
}

.value-box[style*="red"] {
  background: linear-gradient(180deg, #e04a3f, #b02a21) !important;
  border-color: #b02a21;
}

.value-box[style*="green"] .price,
.value-box[style*="red"] .price {
  color: #fff;
}

.range {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.range span {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  min-width: 7rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.range b {
  font-size: 0.85rem;
}

.range-low {
  background: rgba(210, 58, 47, 0.08);
  color: var(--down);
}

.range-high {
  background: rgba(15, 145, 80, 0.08);
  color: var(--up);
}

/* ---------- Commodity table ---------- */
.commodity-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.commodity-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1.3fr;
  padding: 0.7rem 1.3rem;
  background: linear-gradient(90deg, var(--navy-800), var(--navy-600));
  color: var(--champagne);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.commodity-head span:nth-child(2) {
  text-align: center;
}

.commodity-head span:nth-child(3) {
  text-align: right;
}

.commodity-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.commodity-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
}

.commodity-table tr {
  border-bottom: 1px solid var(--row-line);
}

.commodity-table tr:last-child {
  border-bottom: none;
}

.commodity-table tr:nth-child(even) {
  background: #f8f9fc;
}

.commodity-table td {
  padding: 0.6rem 1.3rem;
  vertical-align: middle;
}

.commodity-table td:nth-child(1) {
  width: 47%;
}

.commodity-table td:nth-child(2) {
  width: 22%;
  text-align: center;
}

.commodity-table td:nth-child(3) {
  width: 31%;
  text-align: right;
}

.commodity-table .name-website {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-800);
}

.commodity-table .name-website::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  transform: rotate(45deg);
  background: var(--gold-grad);
  flex-shrink: 0;
}

.commodity-table .currency {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--navy-700);
  border: 1px solid #cfd7e4;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
}

.commodity-table .sell_rate {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--navy-800);
}

.commodity-table .sell_rate[style*="lime"] {
  color: var(--up) !important;
}

.commodity-table .sell_rate[style*="255, 0, 0"],
.commodity-table .sell_rate[style*="ff0000" i] {
  color: var(--down) !important;
}

.commodity-table .sell_rate[style*="203, 168, 77"],
.commodity-table .sell_rate[style*="cba84d" i] {
  color: var(--navy-800) !important;
}

/* ---------- Address bar ---------- */
.address-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--navy-800);
  border-radius: 14px;
  padding: 0.6rem 0.8rem 0.6rem 0.7rem;
  color: #e8edf6;
  overflow: hidden;
}

.pin {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  background: var(--gold-grad);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin svg {
  width: 55%;
  height: 55%;
  fill: var(--navy-800);
}

.address-bar p {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  flex-shrink: 0;
  max-width: 55%;
}

.address-bar p b {
  font-size: 0.7rem;
  font-weight: 700;
}

.address-bar p span {
  font-size: 0.6rem;
  color: var(--champagne);
}

.address-ticker {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  color: #b8c4d8;
  border-left: 1px solid rgba(227, 194, 122, 0.3);
  padding-left: 0.8rem;
}

/* ======================= Responsive ======================= */
@media (max-width: 1100px) {
  html {
    font-size: 15px;
  }

  body {
    height: auto;
    overflow: auto;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .sidebar {
    order: 2;
  }

  .sidebar::after {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 3px;
  }

  .main {
    overflow: visible;
  }

  .side-brand {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .topbar::before {
    content: "";
    display: block;
    width: 12rem;
    height: 4.2rem;
    background: url("../images/new-logo.png") left center / contain no-repeat;
  }

  .commodity-scroll {
    overflow: visible;
  }

  .address-bar {
    flex-wrap: wrap;
  }

  .address-bar p {
    flex: 1;
    max-width: none;
  }

  .address-ticker {
    flex-basis: 100%;
    border-left: none;
    padding-left: 0;
  }

  .sc-row,
  .zones li {
    font-size: 0.85rem;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  .main {
    padding: 1rem 0.8rem;
  }

  .board-head {
    grid-template-columns: 1fr 1fr;
  }

  .board-head span:nth-child(1),
  .board-head span:nth-child(4) {
    display: none;
  }

  .board-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .metal,
  .range {
    grid-column: 1 / -1;
  }

  .range {
    flex-direction: row;
    justify-content: space-between;
  }

  .range span {
    flex: 1;
    min-width: 0;
  }

  .value-box .price {
    font-size: 1.7rem;
  }

  .commodity-table td {
    padding: 0.6rem 0.7rem;
  }

  .commodity-table .name-website {
    font-size: 0.85rem;
  }

  .commodity-table .sell_rate {
    font-size: 1.15rem;
  }
}

/* ---------------- Auto-fit for TV displays (see assests/js/fit.js) ---------------- */
/* Rows flow into 1-3 columns (top-to-bottom, then across) so every product fits */
@media (min-width: 1101px) {
  [data-fit] {
    overflow: hidden;
  }

  [data-fit-head] {
    display: grid;
    grid-template-columns: repeat(var(--fit-cols, 1), minmax(0, 1fr));
    padding-left: 0;
    padding-right: 0;
  }

  .fit-head-col {
    display: grid;
    grid-template-columns: 2.1fr 0.7fr 1.4fr;
    align-items: center;
    padding: 0 1.3rem;
  }

  .fit-head-col span:nth-child(2) {
    text-align: center;
  }

  .fit-head-col span:nth-child(3) {
    text-align: right;
  }

  .fit-head-col + .fit-head-col {
    border-left: 1px solid rgba(227, 194, 122, 0.3);
  }

  .commodity-table,
  .commodity-table tbody {
    display: block;
    width: 100%;
    height: 100%;
  }

  .commodity-table tbody {
    display: grid;
    grid-template-columns: repeat(var(--fit-cols, 1), minmax(0, 1fr));
    grid-template-rows: repeat(var(--fit-rows, 200), var(--fit-h, auto));
    grid-auto-flow: column;
    align-content: start;
  }

  .commodity-table tr {
    display: grid;
    grid-template-columns: 2.1fr 0.7fr 1.4fr;
    align-items: center;
    min-width: 0;
    padding: 0 1.3rem;
  }

  .commodity-table tr:nth-child(even) {
    background: transparent;
  }

  .commodity-table tr.fit-alt {
    background: #f8f9fc;
  }

  .commodity-table tr.fit-col-next {
    border-left: 1px solid #e6eaf1;
  }

  .commodity-table td {
    width: auto !important;
    min-width: 0;
    padding: 0;
    white-space: nowrap;
  }

  .commodity-table td:nth-child(1) {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .commodity-table td:nth-child(2) {
    text-align: center;
  }

  .commodity-table td:nth-child(3) {
    text-align: right;
  }

  .commodity-table .name-website {
    font-size: min(2.2rem, var(--fit-name, 1.05rem));
  }

  .commodity-table .currency {
    font-size: min(1.2rem, var(--fit-small, 0.62rem));
  }

  .commodity-table .sell_rate {
    font-size: min(3rem, var(--fit-price, 1.6rem));
  }
}
