/* ====================================================
   RASPADITA PETROBAN — Estilos mobile-first
   Paleta: azul Petroban #003087 / gradiente violeta #6c3fd5
   ==================================================== */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --azul:       #003087;
  --azul-med:   #0055b3;
  --violeta:    #6c3fd5;
  --celeste:    #d6eaff;
  --blanco:     #ffffff;
  --gris-txt:   #444;
  --gris-borde: #d0d8e8;
  --error:      #e53e3e;
  --ok:         #2d8a4e;
  --grad-btn:   linear-gradient(135deg, #003087 0%, #0055b3 50%, #6c3fd5 100%);
  --sombra:     0 8px 32px rgba(0, 48, 135, 0.14);
  --radio:      16px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gris-txt);
  min-height: 100vh;
  background-color: #e8f4ff;
  background-image: url('/static/img/confetti_bg.png');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Página contenedora ---------- */
.pagina {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px 12px 40px;
}

/* ---------- Header con logos ---------- */
.header-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.header-logos img {
  height: 56px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}

/* ---------- Card central ---------- */
.card {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.card-header {
  background: var(--grad-btn);
  padding: 24px 24px 20px;
  text-align: center;
}
.card-header h1 {
  color: var(--blanco);
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
}
.card-header p {
  color: rgba(255,255,255,.85);
  font-size: 14px;
  margin-top: 6px;
  font-weight: 500;
}

.card-body { padding: 28px 24px 24px; }

/* ---------- Formulario ---------- */
.form-grupo {
  margin-bottom: 18px;
}
.form-grupo label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 6px;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrapper .icono {
  position: absolute;
  left: 12px;
  font-size: 18px;
  color: var(--azul-med);
  pointer-events: none;
  user-select: none;
}
.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 13px 14px 13px 42px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--gris-txt);
  background: #f7faff;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.input-wrapper input:focus,
.input-wrapper select:focus {
  outline: none;
  border-color: var(--azul-med);
  box-shadow: 0 0 0 3px rgba(0,85,179,.15);
  background: #fff;
}
.input-wrapper input::placeholder { color: #aab; }

/* Prefijo de teléfono: layout especial */
.tel-grupo .input-wrapper {
  gap: 8px;
}
.tel-grupo .select-prefijo {
  width: auto;
  min-width: 110px;
  padding: 13px 10px 13px 12px;
  flex-shrink: 0;
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gris-txt);
  background: #f7faff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%23003087'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.tel-grupo .select-prefijo:focus {
  outline: none;
  border-color: var(--azul-med);
  box-shadow: 0 0 0 3px rgba(0,85,179,.15);
}
.tel-grupo .input-numero {
  flex: 1;
  padding: 13px 14px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--gris-txt);
  background: #f7faff;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.tel-grupo .input-numero:focus {
  outline: none;
  border-color: var(--azul-med);
  box-shadow: 0 0 0 3px rgba(0,85,179,.15);
  background: #fff;
}

/* Campo código: tipografía destacada */
.campo-codigo input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
  padding-left: 14px;
  color: var(--azul);
}
.campo-codigo .icono { left: 10px; }

/* ---------- Botón VAMOS! ---------- */
.btn-vamos {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  background: var(--grad-btn);
  color: var(--blanco);
  border: none;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,48,135,.35);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn-vamos:hover { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(0,48,135,.45); }
.btn-vamos:active { transform: scale(.98); }
.btn-vamos:disabled { opacity: .65; cursor: not-allowed; }

/* ---------- Mensajes de error inline ---------- */
.alerta-error {
  background: #fff5f5;
  border: 1.5px solid #fc8181;
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

/* ---------- Footer ---------- */
.footer-pub {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: rgba(0, 48, 135, .75);   /* azul Petroban — legible sobre el fondo celeste */
}
.footer-pub a { color: var(--azul); text-decoration: underline; font-weight: 600; }

/* ====================================================
   PANTALLA RESULTADO
   ==================================================== */
.resultado-card { text-align: center; }
.resultado-card .card-body { padding: 36px 28px; }

.icono-resultado {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 16px;
  display: block;
}

.resultado-titulo {
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 800;
  color: var(--azul);
  margin-bottom: 10px;
  line-height: 1.2;
}
.resultado-subtitulo {
  font-size: 15px;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Premio box */
.premio-box {
  background: var(--grad-btn);
  border-radius: 14px;
  padding: 24px 20px;
  margin: 0 auto 28px;
  max-width: 360px;
}
.premio-label {
  color: rgba(255,255,255,.8);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin-bottom: 8px;
}
.premio-valor {
  color: var(--blanco);
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  line-height: 1.3;
}

/* Instrucciones */
.instrucciones {
  background: #f0f6ff;
  border-left: 4px solid var(--azul);
  border-radius: 0 10px 10px 0;
  padding: 16px 18px;
  text-align: left;
  margin-bottom: 24px;
}
.instrucciones h3 {
  color: var(--azul);
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 700;
}
.instrucciones ul {
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}

/* Estado ya_usado */
.estado-ya-usado {
  background: #fffbeb;
  border: 1.5px solid #f6e05e;
  border-radius: 12px;
  padding: 20px;
  color: #744210;
  font-size: 15px;
  margin-bottom: 20px;
}

/* Estado inválido */
.estado-invalido {
  background: #fff5f5;
  border: 1.5px solid #fc8181;
  border-radius: 12px;
  padding: 20px;
  color: #742a2a;
  font-size: 15px;
  margin-bottom: 20px;
}

.btn-volver {
  display: inline-block;
  padding: 13px 32px;
  background: var(--grad-btn);
  color: var(--blanco);
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(0,48,135,.3);
  transition: filter .15s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.btn-volver:hover { filter: brightness(1.08); text-decoration: none; }

/* ====================================================
   ADMIN — Login
   ==================================================== */
.admin-login .card { max-width: 380px; }
.admin-login .card-header h1 { font-size: 22px; }

/* ====================================================
   ADMIN — Panel
   ==================================================== */
.admin-pagina {
  min-height: 100vh;
  background: #f0f4f8;
  padding: 0;
}

.admin-nav {
  background: var(--grad-btn);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,48,135,.2);
}
.admin-nav .nav-titulo {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
}
.admin-nav a {
  color: rgba(255,255,255,.85);
  font-size: 14px;
  font-weight: 600;
}
.admin-nav a:hover { color: #fff; }

.admin-contenido { padding: 24px 16px 48px; max-width: 1200px; margin: 0 auto; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,48,135,.08);
}
.stat-valor {
  font-size: 32px;
  font-weight: 800;
  color: var(--azul);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Secciones admin */
.admin-seccion {
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0,48,135,.07);
}
.admin-seccion h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--azul);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8f0fe;
}

/* Tablas admin */
.tabla-wrapper { overflow-x: auto; }
.tabla-admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tabla-admin th {
  background: #e8f0fe;
  color: var(--azul);
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.tabla-admin td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: middle;
}
.tabla-admin tr:hover td { background: #f7faff; }
.tabla-admin .badge-usado {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
}
.badge-si { background: #c6f6d5; color: #22543d; }
.badge-no { background: #e8f0fe; color: var(--azul); }
.badge-email-si { background: #c6f6d5; color: #22543d; }
.badge-email-no { background: #fff5f5; color: #c53030; }

/* Formularios admin */
.form-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.form-admin .campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}
.form-admin label {
  font-size: 12px;
  font-weight: 700;
  color: var(--azul);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-admin input[type="text"],
.form-admin input[type="file"] {
  padding: 9px 12px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #f7faff;
  color: var(--gris-txt);
  transition: border-color .2s;
}
.form-admin input:focus {
  outline: none;
  border-color: var(--azul-med);
  background: #fff;
}

.btn-admin {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s;
}
.btn-primario { background: var(--grad-btn); color: #fff; }
.btn-primario:hover { filter: brightness(1.08); }
.btn-peligro { background: #e53e3e; color: #fff; }
.btn-peligro:hover { filter: brightness(1.1); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Flash admin */
.flash-ok {
  background: #c6f6d5;
  border: 1.5px solid #68d391;
  color: #22543d;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
}
.flash-error {
  background: #fff5f5;
  border: 1.5px solid #fc8181;
  color: #742a2a;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
}

/* Tabla omitidos CSV */
.omitidos { margin-top: 12px; font-size: 12px; }
.omitidos details summary { cursor: pointer; color: var(--azul); font-weight: 600; }

/* Barra de filtros */
.filtros-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.filtros-bar input[type="text"],
.filtros-bar select {
  padding: 9px 12px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #f7faff;
  color: var(--gris-txt);
  transition: border-color .2s;
  min-width: 150px;
}
.filtros-bar input:focus,
.filtros-bar select:focus {
  outline: none;
  border-color: var(--azul-med);
  background: #fff;
}

/* Aviso de tabla topeada al cap */
.aviso-cap {
  font-size: 12px;
  color: #92670a;
  background: #fff8e1;
  border: 1px solid #f6c90e;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

/* Paginador */
.paginador {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.paginador .pg-info { font-size: 13px; color: #666; min-width: 200px; text-align: center; }
.btn-admin:disabled { opacity: .4; cursor: not-allowed; filter: none; }

/* Timeline acumulado */
.timeline-leyenda {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #555;
  margin-bottom: 14px;
}
.timeline-leyenda .tl-lg {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.tl-lg-part   { background: #6c3fd5; }
.tl-lg-canjes { background: #2d8a4e; }

/* Line chart (SVG, escala al ancho vía viewBox) */
.timeline-chart { width: 100%; }
.tl-svg { width: 100%; height: auto; display: block; }
.tl-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tl-line-part   { stroke: #6c3fd5; }
.tl-line-canjes { stroke: #2d8a4e; }
.tl-dot-part   { fill: #6c3fd5; }
.tl-dot-canjes { fill: #2d8a4e; }
.tl-axis { stroke: #d0d8e8; stroke-width: 1; }
.tl-grid { stroke: #eef2f8; stroke-width: 1; }
.tl-ytext { fill: #999; font-size: 10px; text-anchor: end; }
.tl-xtext { fill: #999; font-size: 10px; text-anchor: middle; }
.timeline-pie { font-size: 13px; color: #555; margin-top: 12px; text-align: right; }

/* ====================================================
   BASES Y CONDICIONES
   ==================================================== */
.bases-pagina { background: #f7faff; }
.bases-card { max-width: 700px; }
.bases-card .card-body { padding: 32px 28px; }
.bases-card h2 { color: var(--azul); font-size: 18px; margin: 24px 0 8px; font-weight: 700; }
.bases-card h2:first-child { margin-top: 0; }
.bases-card p { font-size: 14px; line-height: 1.7; color: #444; margin-bottom: 10px; }
.bases-card ul { padding-left: 20px; margin-bottom: 10px; }
.bases-card ul li { font-size: 14px; line-height: 1.7; color: #444; margin-bottom: 4px; }
.bases-placeholder {
  background: #fff8e1;
  border: 2px dashed #f6c90e;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: #7d5a00;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ====================================================
   Responsive > 540px
   ==================================================== */
@media (min-width: 540px) {
  .card { max-width: 500px; }
  .card-header { padding: 28px 32px 22px; }
  .card-body { padding: 32px 36px 28px; }
}
