/* ══════════════════════════════════════════════
   FOREX.CSS  –  TZ Marketplace Exchange Rates
   Light theme: white bg · cream panels · rich ink
   ══════════════════════════════════════════════ */

:root {
  --bg:           #ffffff;          /* page background — pure white     */
  --panel:        #faf7f2;          /* card background — warm cream      */
  --panel-border: #e8e0d4;          /* subtle warm border                */
  --panel-hover:  #f4ede3;          /* row hover — slightly deeper cream */

  --ink:          #1a1200;          /* near-black for headings           */
  --text:         #3b3120;          /* body text — dark warm brown       */
  --text-2:       #6b5e45;          /* secondary label                   */
  --text-3:       #9c8c76;          /* muted / placeholder               */

  --accent:       #c0392b;          /* deep crimson — primary accent     */
  --accent-2:     #e67e22;          /* amber — secondary accent          */
  --green:        #1a7a4a;          /* forest green for rate values      */
  --blue:         #2453a8;          /* rich navy for code chips          */

  --shadow:       0 4px 24px rgba(120, 80, 20, 0.1),
                  0 1px 4px  rgba(120, 80, 20, 0.06);
  --shadow-lg:    0 12px 40px rgba(120, 80, 20, 0.14);
}

/* ── Reset ─────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  /* Use the image path here */
  background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('forex.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 48px 28px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
}

/* ══════════════════════════════════════════════
   RATES TABLE PANEL
   ══════════════════════════════════════════════ */
.exchange-container {
  flex: 1;
  min-width: 280px;
  max-width: 520px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow);
}

.exchange-container h2 {
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 24px;
  position: relative;
}

.exchange-container h2::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  margin: 8px auto 0;
}

/* ── Table ─────────────────────────────────────── */
#currency-table { width: 100%; border-collapse: collapse; }

thead tr {
  border-bottom: 2px solid var(--panel-border);
}

thead th {
  padding: 9px 10px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid var(--panel-border);
  transition: background 0.18s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--panel-hover); }

tbody td {
  padding: 11px 10px;
  font-size: 0.88rem;
  color: var(--text);
  vertical-align: middle;
}

.flag         { font-size: 1.2rem; margin-right: 8px; vertical-align: middle; }
.currency-name{ vertical-align: middle; color: var(--text); font-weight: 500; }

/* Code chip */
tbody td strong {
  display: inline-block;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: rgba(36, 83, 168, 0.09);
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid rgba(36, 83, 168, 0.15);
}

/* Rate value */
.rate-value {
  text-align: right !important;
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}

/* ── Loader dots ───────────────────────────────── */
.loader-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 0;
}

.loader-wrapper span {
  font-size: 0.76rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  animation: sineBounce 1.1s ease-in-out infinite;
}
.dot-red    { background: #e63946; animation-delay: 0s;   }
.dot-blue   { background: #4361ee; animation-delay: 0.2s; }
.dot-green  { background: #2dc653; animation-delay: 0.4s; }
.dot-yellow { background: #f59e0b; animation-delay: 0.6s; }

@keyframes sineBounce {
  0%,100% { transform: translateY(0);     opacity: 1;   }
  25%      { transform: translateY(-13px); opacity: 1;   }
  50%      { transform: translateY(0);     opacity: 0.5; }
  75%      { transform: translateY(5px);   opacity: 0.7; }
}

/* ── Timestamp & signature ─────────────────────── */
#update-time {
  margin-top: 18px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.signature {
  margin-top: 14px;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ══════════════════════════════════════════════
   CALCULATOR PANEL
   ══════════════════════════════════════════════ */
.calculator {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 48px;
  animation: slideUp 0.4s ease both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Heading */
.calculator h3 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  padding-bottom: 16px;
  margin-bottom: 2px;
  position: relative;
}

.calculator h3::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 2px;
  margin: 10px auto 0;
}

/* ── Shared field styles ───────────────────────── */
.calculator select,
.calculator input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--panel-border);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.calculator select,
.calculator input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

/* Dropdown arrow */
.calculator select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e45' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
}

.calculator select option {
  background: #fff;
  color: var(--ink);
}

/* Amount input */
.calculator input#amount {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.calculator input#amount::placeholder {
  color: var(--text-3);
  font-weight: 400;
  font-size: 0.88rem;
}

/* Result field — read-only */
.calculator input#conversion-result {
  background: rgba(26, 122, 74, 0.06);
  border-color: rgba(26, 122, 74, 0.25);
  color: var(--green);
  font-weight: 700;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  cursor: default;
  caret-color: transparent;
}

.calculator input#conversion-result:focus {
  border-color: rgba(26, 122, 74, 0.4);
  box-shadow: 0 0 0 3px rgba(26, 122, 74, 0.1);
}

.calculator input#conversion-result::placeholder {
  color: rgba(26, 122, 74, 0.4);
  font-weight: 400;
  font-size: 0.82rem;
  font-style: italic;
}

/* ── TZS suffix wrapper ────────────────────────── */
.amount-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-field-wrap input#amount {
  width: 100%;
  padding-right: 56px;
}

.tzs-suffix {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(192, 57, 43, 0.07);
  border-left: 1.5px solid rgba(192, 57, 43, 0.18);
  border-radius: 0 10px 10px 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  pointer-events: none;
  user-select: none;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 680px) {
  body { flex-direction: column; align-items: center; padding: 24px 16px; }
  .calculator { width: 100%; max-width: 520px; position: static; }
  .exchange-container { max-width: 100%; }
}