@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@400;500;600&display=swap');

/* ── Variables ── */
:root {
  --blue-dark:  #1a3a5c;
  --blue-mid:   #2F80ED;
  --blue-light: #56CCF2;
  --accent:     #f5a623;
  --white:      #ffffff;
  --gray-light: #f0f7ff;
  --gray-mid:   #d0e4f7;
  --text:       #1a2e45;
  --radius:     12px;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }

/* Sobreescribir Skeleton 62.5% → 1rem = 16px a zoom 100% */
html { font-size: 16px !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-size: 1rem !important;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 55%, var(--blue-light) 100%);
}

/* ── Layout ── */
.contenido {
  padding: 48px 0 64px;
}

h1 {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  text-align: center;
  font-size: 2.8rem;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

/* ── Form elements ── */
label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-dark);
  margin-bottom: 4px;
  margin-top: 16px;
}
label:first-child { margin-top: 0; }

select,
input[type="number"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--gray-mid);
  border-radius: 8px;
  background: var(--gray-light);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232F80ED' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(47,128,237,0.15);
}

select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Región activa (España seleccionada): llamar la atención con borde destacado */
select.region-activa {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(245,166,35,0.25) !important;
  animation: pulseOnce 0.6s ease;
}
@keyframes pulseOnce {
  0%   { box-shadow: 0 0 0 0px rgba(245,166,35,0.5); }
  60%  { box-shadow: 0 0 0 6px rgba(245,166,35,0.15); }
  100% { box-shadow: 0 0 0 3px rgba(245,166,35,0.25); }
}

input[type="number"] {
  background-image: none;
}

/* ── Badge ── */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  padding: 1px 8px;
  vertical-align: middle;
  margin-left: 6px;
}

/* ── Button ── */
button.button-primary {
  display: block;
  width: 100%;
  margin-top: 24px;
  height: 44px;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-light));
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 16px rgba(47,128,237,0.35);
}
button.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(47,128,237,0.45);
}
button.button-primary:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* ── Resultado panel ── */
#resultado {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--gray-mid);
  text-align: center;
  gap: 10px;
}
.placeholder span { font-size: 3rem; filter: grayscale(1); opacity: 0.4; }
.placeholder p { font-size: 0.9rem; color: #aac4df; margin: 0; }

.resultado-header {
  border-bottom: 2px solid var(--gray-light);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.resultado-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--blue-dark);
  margin: 0 0 2px;
}
.subtitulo {
  font-size: 0.8rem;
  color: var(--blue-mid);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

/* ── Lista de nombres ── */
.lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lista li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-light);
  border-radius: 8px;
  padding: 10px 14px;
  border-left: 4px solid var(--blue-mid);
  animation: slideIn 0.3s ease both;
  margin-bottom: 0;
}
.lista li:nth-child(2) { animation-delay: 0.05s; }
.lista li:nth-child(3) { animation-delay: 0.10s; }
.lista li:nth-child(4) { animation-delay: 0.15s; }
.lista li:nth-child(5) { animation-delay: 0.20s; }
.lista li:nth-child(6) { animation-delay: 0.25s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--blue-mid);
  color: white;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nombre-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nombre-texto {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

/* ── Barra de porcentaje ── */
.pct-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pct-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-light));
  border-radius: 3px;
  min-width: 4px;
  transition: width 0.6s ease;
}
.pct-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue-mid);
  white-space: nowrap;
}

/* ── Fuente badge ── */
.fuente {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
  padding: 2px 10px;
  margin-top: 4px;
}
.fuente.ine      { background: #e8f4fd; color: #2F80ED; }
.fuente.api      { background: #e8fdf0; color: #1a9e5c; }
.fuente.oficial  { background: #f3eeff; color: #7c3aed; }

/* ── Rank label (países internacionales, sin %) ── */
.rank-label {
  font-size: 0.70rem;
  font-weight: 600;
  color: #7c3aed;
  letter-spacing: 0.03em;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 4px solid var(--gray-mid);
  border-top-color: var(--blue-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ── */
.error-msg {
  background: #fff3cd;
  border: 1.5px solid #f5a623;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.9rem;
  color: #7a5500;
  margin-top: 16px;
}

/* ── Divider between columns on small ── */
@media (max-width: 549px) {
  .card { padding: 24px 20px; }
  .six.columns { width: 100%; margin-left: 0; }
  #resultado { margin-top: 24px; padding-top: 24px; border-top: 1.5px solid var(--gray-light); }
}