/* ================== Variables ================== */
:root {
  --dark-blue-1: #021428;
  --dark-blue-2: #07203a;
  --gold: #d4af37;
  --muted: #bfc9cd;
  --highlight: rgba(212, 175, 55, 0.15);
  --shadow: rgba(2, 18, 36, 0.6);
}

/* ================== Global ================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Times New Roman", Times, serif;
  background: linear-gradient(135deg, var(--dark-blue-1), var(--dark-blue-2));
  color: var(--gold);
  overflow: hidden;
  line-height: 1.5;
}

header {
  height: 80px;
  background: rgba(2, 18, 36, 0.6);
  color: var(--gold);
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px var(--shadow);
  letter-spacing: 0.03em;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

/* ================== TV Layout ================== */
.tv-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - 100px);
  gap: 10px;
  padding: 10px;
}

@media (max-width: 1200px) {
  .tv-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
}

/* ================== Chart ================== */
.chart-section {
  background: linear-gradient(
    180deg,
    rgba(6, 18, 34, 0.6),
    rgba(4, 12, 28, 0.6)
  );
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 8px 30px var(--shadow);
}

#all-drinks-chart {
  width: 100%;
  height: auto;
  max-height: 80vh;
}

/* ================== Table ================== */
.table-section {
  background: rgba(3, 12, 25, 0.6);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-radius: 12px;
}

.table-section h2 {
  color: var(--gold);
  font-size: 2rem;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px; /* ruimte tussen rijen zodat afgeronde hoeken zichtbaar zijn */
  font-size: 1.8rem;
  color: var(--gold);
}

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  background-clip: padding-box;
}

tbody td {
  color: var(--gold);
  opacity: 0.95;
}

/* ================== Table rows ================== */
tbody tr:nth-child(even) {
  background: rgba(2, 16, 32, 0.6); /* donkerder */
  border-radius: 0; /* geen afronding bij donkere rijen */
}

tbody tr:nth-child(odd) {
  background: rgba(4, 28, 56, 0.8); /* iets lichter */
  border-radius: 12px; /* afgeronde hoeken */
  overflow: hidden;
}

/* Rond de hoeken per cel voor lichtere rijen */
tbody tr:nth-child(odd) td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

tbody tr:nth-child(odd) td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Hover effect */
tbody tr:hover {
  background: rgba(212, 175, 55, 0.2); /* geelachtig hover */
  border-radius: 12px;
}

/* Verticaal centreren van kleur-squares in tabel */
td:first-child {
  display: flex;
  align-items: center;
}

/* ================== Trend arrows ================== */
.arrow-up {
  color: #f44336;
  font-weight: bold;
}
.arrow-down {
  color: #4caf50;
  font-weight: bold;
}
.arrow-stable {
  color: var(--muted);
  font-weight: bold;
}

.change-percent {
  margin-left: 8px;
  font-weight: bold;
  font-size: 1.4rem;
  color: var(--gold);
}

/* ================== Scrollbar ================== */
.table-section::-webkit-scrollbar {
  width: 12px;
}

.table-section::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--dark-blue-2), var(--dark-blue-1));
  border-radius: 6px;
  border: 2px solid rgba(2, 12, 24, 0.5);
}

.table-section::-webkit-scrollbar-track {
  background: rgba(2, 12, 24, 0.3);
}

/* ================== Price update pulse ================== */
@keyframes pulse {
  0%,
  100% {
    background-color: transparent;
  }
  50% {
    background-color: var(--highlight);
  }
}

.price-updated {
  animation: pulse 1s ease;
  transition: color 0.3s;
  color: var(--gold);
}

/* ================== Responsive ================== */
@media (max-width: 800px) {
  header {
    font-size: 2.2rem;
    height: 64px;
  }
  table {
    font-size: 1.4rem;
  }
  #ticker-content {
    animation-duration: 40s;
  }
}

/* ================== Countdown Timer ================== */
#refresh-timer-container {
  position: fixed;
  bottom: 50px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 1.4rem;
  color: var(--gold);
  z-index: 10001;
  padding: 6px 0;
}

/* ================== Ticker ================== */
.ticker {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 10px;
  box-sizing: border-box;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

#ticker-content {
  white-space: nowrap;
  display: inline-block;
  padding-left: 100%;
  animation: ticker linear infinite 90s;
  font-size: large;
}

@keyframes ticker {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* ================== Color indicator ================== */
.color-dot {
  display: inline-block;
  width: 40px;
  height: 12px;
  border-radius: 4px;
  margin-right: 20px;
  vertical-align: middle;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* ===================== CRASH MODE ===================== */
#crash-banner {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #2b0000 0%, #000 100%);
  z-index: 99999;
  color: #ff3333;
  font-family: "Impact", "Arial Black", sans-serif;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 3px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}

#crash-banner .content {
  text-shadow: 0 0 15px #ff0000, 0 0 1px #ff4444;
}

#crash-banner h1 {
  letter-spacing: 20px;
  font-size: 12rem;
  margin: 0 0 1rem 0;
  animation: pulse 1.2s infinite alternate;
}

#crash-banner p {
  font-size: 4rem;
  margin: 0 0 2rem 0;
}

#crash-banner .price {
  font-size: 5rem;
  color: #fff;
  border-radius: 0.2em;
}

/* Ticker inside crash banner */
.crash-ticker {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  border-top: 4px solid #ff3333;
  border-bottom: 4px solid #ff3333;
  padding: 0.5rem 0;
}

.ticker-inner {
  display: inline-block;
  white-space: nowrap;
  animation: tickerMove 12s linear infinite;
  font-size: 1.5rem;
  color: #ff5555;
  text-shadow: 0 0 10px #ff2222;
}

@keyframes tickerMove {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes pulse {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.1);
    opacity: 1;
  }
}

.chart-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.chart-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#chart-drink-title {
  text-align: center;
  color: #fff;
  font-size: 4rem;
  font-weight: 600;         /* iets dikker voor duidelijkheid */
  margin: 0 0 15px;
  letter-spacing: 0.5px;    /* meer ruimte tussen letters */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* zorgt voor beter contrast */
}


/* Verberg chart & ticker op mobile */
@media (max-width: 767px) {
  .chart-section {
    display: none;
  }

  .ticker {
    display: none;
  }
}

/* Toon weer op tablet en groter */
@media (min-width: 768px) {
  .chart-section {
    display: flex;
  }

  .ticker {
    display: flex;
  }
}
