/* ============================================================
   TABLA DE CAMBIO — v3.0 Clean
   ============================================================ */

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(184,137,42,0.06), transparent),
    radial-gradient(ellipse 50% 30% at 80% 100%, rgba(184,137,42,0.04), transparent);
}

.container { max-width: 1080px; margin: auto; animation: fadeIn 0.5s var(--ease) both; }

.glass {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 40px;
  border: 1px solid var(--border);
  animation: fadeUp 0.5s var(--ease) 0.1s both;
}

/* ── Controls ────────────────────────────────────────────────── */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.table-controls label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.87rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
}
.table-controls input[type="number"] {
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 700;
  font-family: var(--font-display);
  outline: none;
  width: 110px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.table-controls input[type="number"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

.table-controls select {
  padding: 10px 36px 10px 13px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-body);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg fill='none' height='18' viewBox='0 0 20 20' width='18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7l5 5 5-5' stroke='%238c8680' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  outline: none;
  min-width: 200px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.table-controls select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.table-controls select:hover,
.table-controls input:hover { border-color: var(--gold); }

.table-controls button {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border-md);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.87rem;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: none;
}
.table-controls button:hover { border-color: var(--gold); background: var(--gold-soft); }

#downloadPDF {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  border: none;
  font-weight: 700;
  box-shadow: 0 3px 12px var(--gold-glow);
}
#downloadPDF:hover { box-shadow: 0 6px 18px var(--gold-glow); transform: translateY(-1px); }

/* ── Table wrapper ───────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  table-layout: fixed;
  animation: fadeUp 0.5s var(--ease) 0.2s both;
}

/* ── Header ─────────────────────────────────────────────────── */
thead th {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #000;
  position: sticky;
  top: 0;
  z-index: 3;
  text-align: center;
  vertical-align: middle;
  padding: 13px 14px;
  font-weight: 700;
  font-size: 0.83rem;
}

th, td {
  padding: 12px 14px;
  font-weight: 500;
  text-align: center;
  vertical-align: middle;
  position: relative;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

/* Sticky first col */
.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  border-right: 1px solid var(--border-md);
}
thead .sticky-col {
  z-index: 4;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
}

/* Remove btn */
.remove-btn {
  position: absolute;
  top: 4px; right: 4px;
  background: transparent;
  color: #dc2626;
  width: 18px; height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  border: none;
  border-radius: 4px;
  box-shadow: none;
  padding: 0;
  transition: opacity var(--t-fast), background var(--t-fast);
}
th:hover .remove-btn { opacity: 1; }
.remove-btn:hover { background: rgba(220,38,38,0.1); transform: none; box-shadow: none; }

/* Rows */
tbody tr:nth-child(even) { background: var(--surface-2); }
tbody tr:hover td,
tbody tr:hover th.sticky-col { background: var(--gold-soft) !important; }

td .value {
  font-family: var(--font-display);
  font-weight: 600;
  display: inline-block;
  min-width: 50px;
  font-size: 0.9rem;
}

/* Currency header in th */
.currency-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 2px 0;
}
.currency-header .flag { font-size: 1.1rem; }
.currency-header .code { font-size: 0.8rem; font-weight: 800; }
.currency-header .name { font-size: 0.67rem; font-weight: 500; opacity: 0.8; }

/* Row header */
.row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.row-header .flag { font-size: 1rem; }
.row-header .code { font-size: 0.86rem; font-weight: 700; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .table-controls { flex-direction: column; align-items: stretch; }
  .table-controls select { min-width: 100%; }
  .currency-header .name { display: none; }
}
@media (max-width: 768px) {
  body { padding: 20px 12px; }
  .glass { padding: 20px 14px; }
  table { font-size: 0.8rem; }
  th, td { padding: 9px 7px; }
}