/* =====================================================================
   RECAUDAZ - components.css
   Componentes de UI reutilizables: botones, cards, forms, badges, etc.
   ===================================================================== */

/* Botones ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--rz-space-2);
  padding: 13px 20px;
  border-radius: var(--rz-radius-pill);
  border: none;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--rz-primary); color: var(--rz-ink-on-primary); box-shadow: var(--rz-shadow-sm); }
.btn-primary:hover { background: var(--rz-primary-hover); }
.btn-secondary { background: var(--rz-primary-light); color: var(--rz-primary-dark); }
.btn-outline { background: transparent; color: var(--rz-text); border: 1.5px solid var(--rz-border); }
.btn-outline:hover { border-color: var(--rz-primary-dark); color: var(--rz-primary-dark); }
.btn-ghost { background: transparent; color: var(--rz-text-muted); padding: 8px 12px; }
.btn-danger { background: var(--rz-danger-light); color: var(--rz-danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards ---------------------------------------------------------------- */
.card {
  background: var(--rz-surface);
  border-radius: var(--rz-radius-lg);
  padding: var(--rz-space-5);
  box-shadow: var(--rz-shadow-sm);
  border: 1px solid var(--rz-border);
}
.card-flat { box-shadow: none; }
.card-link { display: block; }
.card-link:hover { text-decoration: none; box-shadow: var(--rz-shadow-md); }
.card + .card { margin-top: var(--rz-space-4); }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--rz-space-3); }
.card-title h3 { margin: 0; }

/* Hero / saldo grande ---------------------------------------------------
   Tarjeta oscura con el numero grande en el lima de marca: el lima es
   demasiado claro para usarlo como fondo detras de texto blanco, asi que
   el brillo de marca lo lleva el numero, no la superficie. */
.hero-balance {
  background: linear-gradient(135deg, #20222E 0%, #0E0F16 100%);
  color: #fff;
  border-radius: var(--rz-radius-lg);
  padding: var(--rz-space-6) var(--rz-space-5);
  box-shadow: var(--rz-shadow-lg);
}
.hero-balance .label { opacity: .75; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hero-balance .amount { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 4px; color: var(--rz-primary); }
.hero-balance .sub { opacity: .85; font-size: 13.5px; }

/* Stat tiles (numeros grandes) ------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--rz-space-3); }
.stat-grid.cols-1 { grid-template-columns: 1fr; }
.stat-tile {
  background: var(--rz-surface);
  border: 1px solid var(--rz-border);
  border-radius: var(--rz-radius-md);
  padding: var(--rz-space-4);
}
.stat-tile .stat-label { font-size: 12.5px; color: var(--rz-text-muted); font-weight: 600; margin-bottom: 4px; }
.stat-tile .stat-value { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.stat-tile .stat-value.accent { color: var(--rz-accent); }
.stat-tile .stat-value.warning { color: var(--rz-warning); }
.stat-tile .stat-note { font-size: 12px; color: var(--rz-text-faint); margin-top: 2px; }

/* Badges ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--rz-radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-success { background: var(--rz-accent-light); color: var(--rz-accent); }
.badge-warning { background: var(--rz-warning-light); color: #B45309; }
.badge-danger { background: var(--rz-danger-light); color: var(--rz-danger); }
.badge-neutral { background: var(--rz-primary-light); color: var(--rz-primary-dark); }
.badge-muted { background: var(--rz-bg); color: var(--rz-text-muted); }

/* Avatares ---------------------------------------------------------------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--rz-primary-light); color: var(--rz-primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}
.avatar-lg { width: 84px; height: 84px; font-size: 24px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

/* Forms ---------------------------------------------------------------- */
.field { margin-bottom: var(--rz-space-4); }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--rz-text); }
.field .hint { font-size: 12px; color: var(--rz-text-faint); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--rz-radius-sm);
  border: 1.5px solid var(--rz-border);
  background: var(--rz-surface-alt);
  color: var(--rz-text);
  outline: none;
  transition: border-color .15s ease;
}
.input:focus { border-color: var(--rz-primary); background: #fff; }
textarea.input { resize: vertical; min-height: 90px; }
.input-prefix-group { position: relative; }
.input-prefix-group .prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--rz-text-faint); font-weight: 600;
}
.input-prefix-group .input { padding-left: 30px; }
.field-row { display: flex; gap: var(--rz-space-3); }
.field-row .field { flex: 1; }

/* Alertas / flash -------------------------------------------------------- */
.alert {
  padding: 13px 16px;
  border-radius: var(--rz-radius-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: var(--rz-space-4);
}
.alert-success { background: var(--rz-accent-light); color: #14622F; }
.alert-error { background: var(--rz-danger-light); color: #8F1D1D; }
.alert-info { background: var(--rz-primary-light); color: var(--rz-primary-dark); }

/* Listas tipo fila (movimientos, pagos) ----------------------------------- */
.list-row {
  display: flex; align-items: center; gap: var(--rz-space-3);
  padding: 14px 0;
  border-bottom: 1px solid var(--rz-border);
}
.list-row:last-child { border-bottom: none; }
.list-row .icon-box {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--rz-primary-light); color: var(--rz-primary-dark); font-size: 18px;
}
.list-row .icon-box.accent { background: var(--rz-accent-light); color: var(--rz-accent); }
.list-row .icon-box.danger { background: var(--rz-danger-light); color: var(--rz-danger); }
.list-row .icon-box.warning { background: var(--rz-warning-light); color: #B45309; }
.list-row .row-main, .buyer-row-head .row-main { flex: 1; min-width: 0; }
.list-row .row-title, .buyer-row-head .row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .row-sub, .buyer-row-head .row-sub { font-size: 12.5px; color: var(--rz-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .row-amount, .buyer-row-head .row-amount { font-weight: 700; font-size: 14.5px; white-space: nowrap; flex-shrink: 0; }
.list-row .row-amount.positive { color: var(--rz-accent); }
.list-row .row-amount.negative { color: var(--rz-danger); }

/* Fila de comprador (Mis compradores) -----------------------------------
   Igual que .list-row pero con una franja de stats abajo, para separar
   claramente "quien es" de "cuanto le vendiste" en el mismo golpe de vista. */
.buyer-row { display: block; padding: 14px 0; border-bottom: 1px solid var(--rz-border); }
.buyer-row:last-child { border-bottom: none; }
.buyer-row-head { display: flex; align-items: center; gap: var(--rz-space-3); }
.buyer-row-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--rz-space-2);
  margin-top: var(--rz-space-3); padding-top: var(--rz-space-3);
  border-top: 1px dashed var(--rz-border);
}
.buyer-row-stats .stat-mini-label { font-size: 11px; color: var(--rz-text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 2px; }
.buyer-row-stats .stat-mini-value { font-size: 14.5px; font-weight: 700; }

/* Empty state -------------------------------------------------------- */
.empty-state { text-align: center; padding: var(--rz-space-6) var(--rz-space-4); color: var(--rz-text-muted); }
.empty-state .emoji { font-size: 36px; margin-bottom: var(--rz-space-2); }

/* Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: var(--rz-space-2); overflow-x: auto; padding-bottom: 2px; }
.tabs a {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--rz-radius-pill);
  background: var(--rz-surface);
  border: 1px solid var(--rz-border);
  color: var(--rz-text-muted);
  font-weight: 600;
  font-size: 13.5px;
}
.tabs a.active { background: var(--rz-primary); border-color: var(--rz-primary); color: var(--rz-ink-on-primary); }
.tabs a:hover { text-decoration: none; }

/* Graficos (SVG inline, sin libreria) ------------------------------------ */
.chart-figure { margin: 0; color: var(--rz-text); }
.bar-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: var(--rz-space-4); flex-wrap: wrap; margin-top: var(--rz-space-2); font-size: 12.5px; }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.chart-legend .dot.past { background: var(--rz-accent); }
.chart-legend .dot.projected { background: var(--rz-warning); opacity: .55; }
.status-legend { display: flex; gap: var(--rz-space-4); flex-wrap: wrap; margin-top: var(--rz-space-3); font-size: 12.5px; }
.status-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* Tablas (admin/responsable en desktop) --------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--rz-radius-md); border: 1px solid var(--rz-border); }
table.rz-table { width: 100%; border-collapse: collapse; background: var(--rz-surface); font-size: 13.5px; }
table.rz-table th {
  text-align: left; padding: 12px 16px; background: var(--rz-surface-alt);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--rz-text-muted);
  border-bottom: 1px solid var(--rz-border);
}
table.rz-table td { padding: 12px 16px; border-bottom: 1px solid var(--rz-border); vertical-align: middle; }
table.rz-table tr:last-child td { border-bottom: none; }
table.rz-table tr:hover td { background: var(--rz-surface-alt); }

/* Progreso ---------------------------------------------------------------- */
.progress-bar { height: 8px; border-radius: var(--rz-radius-pill); background: var(--rz-border); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--rz-accent); border-radius: var(--rz-radius-pill); }

/* Copiar link / codigo -------------------------------------------------- */
.copy-box {
  display: flex; align-items: center; gap: var(--rz-space-2);
  background: var(--rz-surface-alt); border: 1.5px dashed var(--rz-border);
  border-radius: var(--rz-radius-md); padding: 12px 14px;
}
.copy-box code { flex: 1; font-family: 'SF Mono', Consolas, monospace; font-size: 13px; overflow-x: auto; white-space: nowrap; }

/* Modal simple (calculadora comercio) ------------------------------------ */
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--rz-text-faint); margin: var(--rz-space-5) 0 var(--rz-space-2); }
