/* CambiosPay App UI System v1
   Objetivo: unificar estilos entre Index / Tasas / Calculadora / Instalador
*/

:root{
  --cp:#1d4ed8;
  --cp2:#2563eb;

  --text:#0f172a;
  --muted:#64748b;

  --bg:#ffffff;
  --card:#ffffff;

  --border:#e6edf7;

  --r-lg:20px;
  --r-md:14px;
  --r-sm:12px;

  --shadow-soft: 0 10px 26px rgba(15,23,42,.08);
  --shadow-pill: 0 10px 22px rgba(29,78,216,.16);

  --ring: 0 0 0 4px rgba(29,78,216,.12);
}

*{ box-sizing:border-box; }
html, body{
  margin:0;
  padding:0;
  height:100%;
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  font-variant-numeric: tabular-nums;
}

/* Layout base */
.cp-app{
  height:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.cp-frame{
  flex:1;
  width:100%;
  border:0;
  background: var(--bg);
}

/* Header */
.cp-header{
  flex-shrink:0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: .7rem .95rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15,23,42,.03);
  position:relative;
  z-index:100;
  gap:.75rem;
}

.cp-brand{
  display:flex;
  align-items:center;
  gap:.55rem;
  min-width:0;
}
.cp-brand img{
  height:30px;
  width:auto;
  border-radius:10px;
}
.cp-saludo{
  font-weight:650;
  font-size:15px;
  color:#0b1224;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:48vw;
}

.cp-actions{
  display:flex;
  align-items:center;
  gap:.55rem;
  flex-shrink:0;
}

/* Botón “Descargar” */
.cp-install-btn{
  display:none;
  align-items:center;
  gap:.5rem;
  padding:9px 12px;
  border:0;
  border-radius:999px;
  color:#fff;
  background: linear-gradient(135deg, var(--cp), var(--cp2));
  box-shadow: var(--shadow-pill);
  font-weight:700;
  font-size:13px;
  letter-spacing:.1px;
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.cp-install-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(29,78,216,.20);
  filter: saturate(1.03);
}
.cp-install-btn:active{ transform: translateY(0); }

.cp-install-btn i{
  font-size:16px;
  opacity:.96;
  animation: cpPulse 1.6s ease-in-out infinite;
}
.cp-installed .cp-install-btn i{ animation:none; }

@keyframes cpPulse{
  0%,100%{ transform: translateY(0); opacity:.92; }
  55%{ transform: translateY(1px); opacity:1; }
}

/* Menú */
.cp-menu-btn{
  font-size:1.45rem;
  cursor:pointer;
  color:#0b1224;
  padding:8px;
  border-radius:12px;
  transition: background .12s ease;
}
.cp-menu-btn:hover{ background: rgba(15,23,42,.05); }

.cp-menu{
  display:none;
  position:absolute;
  top: 3.1rem;
  right: .95rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  overflow:hidden;
  z-index:1000;
  min-width:230px;
}
.cp-menu-item{
  padding: .82rem .92rem;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:.65rem;
  color:#0b1224;
  font-weight:650;
  border-bottom: 1px solid rgba(226,232,240,.75);
  transition: background .12s ease;
}
.cp-menu-item:hover{ background: rgba(29,78,216,.05); }
.cp-menu-item i{ font-size:1.12rem; color: var(--cp); }
.cp-menu-item:last-child{ border-bottom:none; }

/* Tabs */
.cp-tabs{
  flex-shrink:0;
  display:flex;
  justify-content:space-around;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(15,23,42,.03);
  height:72px;
  border-radius: 1rem 1rem 0 0;
}
.cp-tab{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  font-size:.80rem;
  cursor:pointer;
  font-weight:600;
}
.cp-tab i{
  font-size:1.35rem;
  margin-bottom:.15rem;
}
.cp-tab.is-active{
  color: var(--cp);
  font-weight:700;
}
.cp-tab.is-active i{ color: var(--cp); }

/* Modal update SW */
.cp-update-modal{
  position:fixed;
  inset:0;
  z-index:6000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background: rgba(15,23,42,.55);
}
.cp-update-card{
  width: min(460px, 92vw);
  background: var(--card);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(2,6,23,.22);
  padding:14px;
}
.cp-update-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.cp-update-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:750;
  font-size:15px;
  color:#0b1224;
}
.cp-update-title i{ color: var(--cp); font-size:20px; }
.cp-update-close{
  border:0;
  background: transparent;
  cursor:pointer;
  color: var(--muted);
  font-size:20px;
  padding:4px 8px;
  border-radius:10px;
}
.cp-update-close:hover{ background: rgba(15,23,42,.05); }

.cp-update-text{
  margin:0 0 12px;
  color:#475569;
  font-weight:600;
  font-size:13px;
  line-height:1.35rem;
}

.cp-update-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.cp-btn{
  border:0;
  cursor:pointer;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-weight:750;
  font-size:13px;
  transition: transform .12s ease;
}
.cp-btn:active{ transform: scale(.98); }
.cp-btn-ghost{
  background: rgba(15,23,42,.05);
  color: var(--text);
}
.cp-btn-primary{
  background: linear-gradient(135deg, var(--cp), var(--cp2));
  color:#fff;
  box-shadow: var(--shadow-pill);
}

/* Responsive */
@media (max-width:420px){
  .cp-hero-grid{ column-gap: 10px; row-gap: 8px; }
  .cp-date{ font-size: 12px; white-space: nowrap; }
  .cp-hero-grid .sub{ margin-top: 0; }
}
  .cp-install-btn{ padding:9px 11px; font-size:12.5px; }
}

@media (prefers-reduced-motion: reduce){
  .cp-install-btn i{ animation:none !important; }
  *{ transition:none !important; }
}





/* ===== Tasas components (compatibles con tasas.js) ===== */
.cp-surface{
  background: linear-gradient(180deg, #f8fafc 0%, #f3f6fd 100%);
  min-height:100vh;
}

/* Fondo muy sutil, sin “colorinche” */
.cp-surface::before{
  content:"";
  position:fixed;
  inset:-60px;
  pointer-events:none;
  opacity:.35;
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(29,78,216,.16), transparent 55%),
    radial-gradient(760px 520px at 85% 0%, rgba(29,78,216,.10), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(15,23,42,.05), transparent 58%);
  filter: blur(10px);
}

.cp-wrap{
  position:relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 18px;
}

/* Header de la vista (hero “pro”, blanco, limpio) */
.cp-hero{
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(230,237,247,.95);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(15,23,42,.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow:hidden;
}

.cp-hero-inner{
  padding: 12px 12px 10px;
}

.cp-hero-grid{
  display:grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 8px;
  align-items:start;
}

.cp-hero-title{
  grid-column: 1;
  grid-row: 1;

  min-width:0;
}
.cp-hero-title .kicker{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  color:#0b1224;
  letter-spacing:.12px;
  font-size: 14.5px;
}
.cp-hero-title .kicker i{
  color: var(--cp);
  font-size:18px;
}
.cp-hero-grid .sub{
  grid-column: 1 / -1;
  margin-top: 2px;
  color: rgba(100,116,139,.92);
  font-weight:650;
  font-size:12.5px;
  line-height: 1.25;
  max-width: none;
}

.cp-date{
  grid-column: 2;
  grid-row: 1;
  justify-content:flex-end;

  display:flex;
  align-items:center;
  gap:8px;
  color: rgba(100,116,139,.92);
  font-weight:700;
  font-size: 12.5px;
  letter-spacing:.14px;
  white-space:nowrap;
}
.cp-date i{ color: var(--cp); }

/* Línea inferior (actualización + refresh) */
.cp-updatebar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(230,237,247,.95);
}

.u-text{
  color: rgba(100,116,139,.92);
  font-weight:650;
  font-size:12.5px;
  font-style: italic;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.u-btn{
  width:34px;
  height:34px;
  border-radius: 999px;
  border: 1px solid rgba(230,237,247,.95);
  background: rgba(29,78,216,.06);
  color: var(--cp);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  flex:0 0 auto;
}
.u-btn:hover{
  background: rgba(29,78,216,.10);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15,23,42,.10);
}
.u-btn:active{ transform: translateY(0); box-shadow:none; }
.u-btn:focus{ outline:none; box-shadow: var(--ring); }
.u-btn i{ font-size:18px; }

/* rate-update ocupa todo el ancho para empujar el botón a la derecha */
#rate-update{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-width:0;
}

/* micro animación del refresh */
@keyframes cpSpinOnce { from{ transform: rotate(0deg);} to{ transform: rotate(360deg);} }
@keyframes cpTapPop { 0%{ transform: scale(1);} 35%{ transform: scale(1.06);} 100%{ transform: scale(1);} }

.u-btn.is-anim{
  box-shadow: 0 14px 24px rgba(29,78,216,.16);
}
.u-btn.is-anim i,
.u-btn i.is-anim{
  animation: cpSpinOnce .62s cubic-bezier(.2,.8,.2,1) 1, cpTapPop .62s cubic-bezier(.2,.8,.2,1) 1;
}

/* En móvil, el bloque superior no debe apretar el texto */
@media (max-width:420px){
  .cp-hero-grid{ column-gap: 10px; row-gap: 8px; }
  .cp-date{ font-size: 12px; white-space: nowrap; }
  .cp-hero-grid .sub{ margin-top: 0; }
}
  .cp-hero-title{
  grid-column: 1;
  grid-row: 1;
 flex: 1 1 auto; min-width: 0; }
  .cp-date{
  grid-column: 2;
  grid-row: 1;
  justify-content:flex-end;

    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: .10px;
    justify-content: flex-end;
  }
  .cp-hero-title .sub{
    max-width: 100%;
    text-wrap: balance;
    margin-top: 6px; /* separación idónea */
  }
}


/* Lista */
#rates-list{
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid rgba(214,225,243,.95);
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(15,23,42,.10);
  overflow: hidden;
  padding: 2px 0;
}


/* Row: más compacto, separadores finos */
.rate-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding: 13px 14px;
  border-top: 1px solid rgba(230,237,247,.90);
  transition: background .12s ease;
}
.rate-row:first-child{ border-top:none; }
.rate-row:hover{ background: rgba(15,23,42,.012); }

.rate-row .label{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  font-weight:800;
  color:#0b1224;
  letter-spacing:.10px;
}
.rate-row .label i{
  width:36px;
  height:36px;
  border-radius: 14px;
  background: rgba(29,78,216,.07);
  border: 1px solid rgba(29,78,216,.10);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color: var(--cp);
  font-size:18px;
  flex:0 0 auto;
}

.rate-row .label span{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 56vw;
  font-size: 14px;
}

.rate-row .value{
  display:flex;
  align-items:baseline;
  gap:6px;
  font-weight:900;
  color:#0b1224;
  white-space:nowrap;
  letter-spacing:.06px;
  font-size: 14.5px;
}
.rate-row .value .unit{
  font-weight:850;
  color: rgba(100,116,139,.92);
  font-size: 12px;
}

/* Delta (si aparece) */
.delta{
  margin-left:8px;
  font-weight:900;
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.delta i{ font-size:14px; }
.delta.up{ color:#16a34a; }
.delta.down{ color:#dc2626; }

/* CTA: menos “bloque azul”, más premium */
.cp-share{
  margin-top: 12px;
  display:flex;
  justify-content:center;
}
.cp-share-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(29,78,216,.14);
  color:#fff;
  background: linear-gradient(135deg, var(--cp), var(--cp2));
  box-shadow: 0 14px 28px rgba(29,78,216,.18);
  font-weight:900;
  font-size:14px;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.cp-share-btn i{ font-size:18px; opacity:.96; }
.cp-share-btn:hover{ transform: translateY(-1px); box-shadow: 0 18px 34px rgba(29,78,216,.22); filter:saturate(1.06); }
.cp-share-btn:active{ transform: translateY(0); }

@media (max-width:420px){
  .cp-hero-grid{ column-gap: 10px; row-gap: 8px; }
  .cp-date{ font-size: 12px; white-space: nowrap; }
  .cp-hero-grid .sub{ margin-top: 0; }
}
  .rate-row{ padding: 11px 12px; }
  .rate-row .label span{ max-width: 60vw; }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce){
  .u-btn, .rate-row, .cp-share-btn{ transition:none !important; }
}

#rates-list::before{
  content:"";
  display:block;
  height:1px;
  background: rgba(255,255,255,.8);
}
