:root {
  --primary: #7A7CFF;
  --secondary: #EDBF00;

  --background: #FFFFFF;
  --background-soft: #F8F1C1;

  --text-primary: #090909;
  --text-secondary: #69727D;

  --border: #D9D9D9;

  --brand-turquoise: #0A98A3;

  /* Tokens derivados de la paleta anterior, usados en toda la hoja de estilos */
  --bg: #F1F1F3;
  --surface: var(--background);
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);
  --primary-hover: #6567EE;
  --primary-soft: #EEEEFF;
  --success: #15803D;
  --success-soft: #DCFCE7;
  --warning: #8A6D00;
  --warning-soft: #FBF0C6;
  --whatsapp: var(--primary);
  --email: var(--primary);
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background-soft);
  color: var(--text);
}

.app {
  min-height: 100vh;
  display: none;
  position: relative;
}

.btn-logout {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover { border-color: var(--primary); color: var(--primary); }

/* Login (mock) */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-logo { max-width: 160px; width: 100%; height: auto; margin: 0 auto 4px; }
.login-card h1 { font-size: 19px; color: var(--primary); margin: 0 0 4px; }
.login-card .field { text-align: left; }

/* Pantalla de inicio */
.home-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 40px 20px;
  text-align: center;
}

.home-title {
  font-size: 26px;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--primary);
}

.home-logo {
  max-width: 440px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, 140px);
  gap: 20px;
}

.home-tile {
  width: 140px;
  height: 140px;
  border: 1px solid var(--primary);
  border-radius: 16px;
  background: var(--background);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.home-tile:hover { background: var(--primary); color: #fff; }
.home-tile svg { width: 34px; height: 34px; }

/* Content */
.content {
  padding: 28px 36px;
  max-width: 1100px;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.view-header h1 {
  font-size: 22px;
  margin: 0;
}

.view-actions { display: flex; gap: 10px; }

.btn-back {
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 28px auto 0;
}

.btn-back:hover { background: var(--primary-hover); }

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-email { background: var(--email); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-refund { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-refund:hover { background: var(--danger); color: #fff; }

/* Cards grid (cursos) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-curso { cursor: pointer; }
.card-curso:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(122,124,255,.18); }

.card h3 { margin: 0 0 8px; font-size: 16px; }
.card .meta { font-size: 13px; color: var(--text-muted); margin: 2px 0; }

.card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  background: var(--primary-soft);
  border: 2px dashed var(--primary);
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.card-add:hover { background: var(--primary); color: #fff; }
.card-add-icon { font-size: 30px; line-height: 1; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-activo, .badge-pagado, .badge-al_dia { background: var(--success-soft); color: var(--success); }
.badge-finalizado { background: #e5e7eb; color: var(--text-muted); }
.badge-pendiente { background: var(--warning-soft); color: var(--warning); }
.badge-atrasado { background: #fee2e2; color: var(--danger); }

.chip { font-size: 11px; padding: 2px 7px; margin: 2px 4px 2px 0; display: inline-block; }

.modulos-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filters-bar-violet {
  background: var(--primary);
  padding: 14px;
  border-radius: var(--radius);
  align-items: center;
}

.input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

/* Sin flechas incrementadoras en ningun input numerico */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

/* Campo de dinero: el $ queda pegado al input sin importar la altura del label */
.money-input { position: relative; display: flex; align-items: center; }
.money-input .money-prefix {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.money-input .input { padding-left: 24px; width: 100%; }

.input-search {
  flex: 1 1 240px;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 14px;
  border: 2px solid var(--secondary);
}

.input-search:focus { outline: 2px solid #fff; }

/* Alumnos grid */
.alumnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.alumno-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.alumno-card:hover { border-color: var(--primary); }

.alumno-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alumno-info strong { display: block; font-size: 14px; }
.alumno-info span { display: block; font-size: 12px; color: var(--text-muted); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

/* Pagos list */
.pagos-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pagos-scroll {
  max-height: 480px;
  overflow-y: auto;
  border-radius: var(--radius);
}

.pago-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.7fr 1fr 170px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.pago-row > span { min-width: 0; overflow-wrap: break-word; }
.pago-row:last-child { border-bottom: none; }
.pago-row .alumno-nombre { font-weight: 600; }
.pago-row .curso-modulo { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.pago-row .acciones { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.pago-row .acciones .btn { justify-content: center; white-space: nowrap; }

.btn-disabled-link { opacity: .4; pointer-events: none; }

.pagos-header {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.7fr 1fr 170px;
  padding: 12px 18px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #fff;
  background: var(--primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Historial de pagos: sin columna de clase/fecha, un botón de acción */
.pagos-header--historial,
.pago-row--historial {
  grid-template-columns: 1.3fr 1.7fr 1.3fr 140px;
}

/* Tabs de la vista de Pagos */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 720px;
}

.form-grid.form-1col { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field .input { width: 100%; }
.field-span2 { grid-column: span 2; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 760px;
  margin: 0 auto;
}

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 10px;
  color: var(--text);
}

.modulos-editor { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.modulo-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; }
.hint-text { color: var(--text-muted); font-size: 12px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0 24px 24px;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -24px 18px;
  padding: 18px 24px;
  background: var(--primary);
  color: #fff;
}

.modal-header h2 { margin: 0; font-size: 18px; color: #fff; }

.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  line-height: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-row span:first-child { color: var(--text-muted); }
.detail-row span:last-child { font-weight: 600; }

/* Confirmación inscripción */
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  text-align: center;
}

.link-copy-row {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.link-copy-row input { flex: 1; }

canvas.qr-canvas {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 12px auto;
  display: block;
}

.confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 720px) {
  .home-grid { grid-template-columns: repeat(2, 140px); }
  .form-grid { grid-template-columns: 1fr; }
  .field-span2 { grid-column: span 1; }
  .pago-row, .pagos-header { grid-template-columns: 1fr 1fr; }
}

/* Portal de pago (pago.html): apariencia inspirada en un checkout de Mercado Pago, solo visual. */
:root {
  --mp-blue: #009ee3;
  --mp-blue-dark: #2d3277;
  --mp-bg: #ebf1f5;
}

body.mp-page { background: var(--mp-bg); }

.mp-topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8ee;
  padding: 16px 24px;
}

.mp-logo { font-size: 19px; font-weight: 400; color: var(--mp-blue-dark); }
.mp-logo b { color: var(--mp-blue); font-weight: 800; }

.mp-wrapper {
  display: flex;
  justify-content: center;
  padding: 40px 16px 60px;
}

.mp-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(20, 40, 70, 0.12);
  max-width: 460px;
  width: 100%;
  overflow: hidden;
}

.mp-summary {
  background: var(--mp-blue-dark);
  color: #fff;
  padding: 22px 24px;
  text-align: center;
}

.mp-summary .mp-alumno { font-size: 13px; opacity: .85; margin: 0 0 6px; }
.mp-summary .mp-monto { font-size: 34px; font-weight: 800; margin: 0; }
.mp-summary .mp-curso { font-size: 13px; opacity: .85; margin: 6px 0 0; }

.mp-body { padding: 22px 24px 26px; }

.mp-cardart {
  border-radius: 12px;
  padding: 18px 20px;
  color: #fff;
  background: linear-gradient(135deg, #3f4bfa, #2d3277);
  margin-bottom: 18px;
  font-family: monospace;
}

.mp-cardart .mp-cardart-number { font-size: 18px; letter-spacing: 2px; margin-bottom: 18px; }
.mp-cardart .mp-cardart-row { display: flex; justify-content: space-between; font-size: 11px; opacity: .85; text-transform: uppercase; }
.mp-cardart .mp-cardart-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.mp-cardart .mp-cardart-dots span { width: 20px; height: 14px; border-radius: 3px; background: rgba(255,255,255,.35); }

.mp-methods {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.mp-section-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin: 16px 0 8px; }

.mp-method-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.mp-method-icon { font-size: 15px; }

.mp-method-btn.active { background: var(--mp-blue); color: #fff; }

.mp-field { margin-bottom: 12px; }
.mp-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.mp-field input, .mp-field select {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.mp-field input:focus, .mp-field select:focus { outline: none; border-color: var(--mp-blue); box-shadow: 0 0 0 3px rgba(0,158,227,.15); }
.mp-field-row { display: flex; gap: 10px; }
.mp-field-row .mp-field { flex: 1; }

.mp-pay-btn {
  width: 100%;
  background: var(--mp-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
}

.mp-pay-btn:hover { background: #0087c4; }
.mp-pay-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Cupón de pago en efectivo (Rapipago / Pago Fácil), como en la integración real de MP */
.mp-voucher {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  margin-bottom: 12px;
}

.mp-voucher-title { font-weight: 700; margin: 0 0 12px; }

.mp-barcode {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  height: 44px;
  margin-bottom: 10px;
}

.mp-barcode span { width: 4px; background: #111; }
.mp-barcode span:nth-child(odd) { height: 100%; }
.mp-barcode span:nth-child(3n) { height: 65%; }
.mp-barcode span:nth-child(4n) { height: 80%; }

.mp-voucher-code { font-family: monospace; font-size: 15px; letter-spacing: 1px; margin: 0 0 12px; }

.mp-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 14px;
}

.mp-footer-link { text-align: center; margin-top: 16px; }
.mp-footer-link a { color: var(--text-muted); font-size: 13px; }

.mp-success { text-align: center; padding: 40px 24px; }
.mp-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 16px;
}
