/* ===== ESTILOS-INDEX.CSS — Camino Templario · Cuartel General ===== */

:root {
  --parchment: #f5eccc;
  --ink: #3a2810;
  --ink-soft: #6b4e2a;
  --red: #8b2e1a;
  --red-dark: #6b1f10;
  --gold: #d4a520;
  --gold-light: #e8c040;
  --leather: #4a392a;
  --shadow: rgba(58,40,16,0.18);
  --tab-h: 64px;
  --header-h: 82px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--parchment);
  background-image: url('img/fondo.png');
  background-size: cover;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== CABECERA FIJA ===== */
.idx-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(74,57,42,0.97);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 16px 6px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
  border-bottom: 2px solid var(--gold);
}

.idx-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.idx-hero-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
}
.idx-hero-name img {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.idx-nivel {
  font-family: 'Cinzel Decorative', serif;
  font-size: 9px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(212,165,32,0.15);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.idx-nivel img {
  width: 22px; height: 22px;
  object-fit: contain;
}

.idx-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Cinzel Decorative', serif;
  font-size: 8px;
  color: rgba(245,236,204,0.75);
}

.idx-progress-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.idx-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ===== NAVEGACIÓN INFERIOR ===== */
.idx-tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tab-h);
  background: rgba(74,57,42,0.97);
  backdrop-filter: blur(6px);
  display: flex;
  border-top: 2px solid var(--gold);
  z-index: 100;
  box-shadow: 0 -3px 12px rgba(0,0,0,0.3);
}

.idx-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: background .15s;
  border: none;
  background: transparent;
  padding: 0;
}
.idx-tab:active { background: rgba(212,165,32,0.1); }
.idx-tab.active { background: rgba(212,165,32,0.15); }
.idx-tab.active .idx-tab-icon { opacity: 1; filter: drop-shadow(0 0 4px var(--gold-light)); }
.idx-tab.active .idx-tab-label { color: var(--gold-light); }

.idx-tab-icon {
  width: 28px; height: 28px;
  object-fit: contain;
  opacity: 0.55;
  transition: opacity .15s, filter .15s;
}
.idx-tab-label {
  font-family: 'Cinzel Decorative', serif;
  font-size: 8px;
  font-weight: 400;
  color: rgba(245,236,204,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== CONTENIDO GENERAL ===== */
.idx-content {
  padding-top: var(--header-h);
  padding-bottom: var(--tab-h);
  min-height: 100vh;
}

.idx-section {
  display: none;
  height: calc(100vh - var(--header-h) - var(--tab-h));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.idx-section.active { display: block; }

/* ===== TAB MAPA ===== */
.idx-mapa-wrap {
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  background: #c8a96b;
  scrollbar-width: none;
}
.idx-mapa-wrap::-webkit-scrollbar { display: none; }

.idx-mapa-inner {
  position: relative;
  height: 100%;
  display: inline-block;
}

.idx-mapa-img {
  height: 100%;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.idx-mapa-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
  width: 44px; height: 44px;
  transition: transform .15s;
}
.idx-mapa-marker:active { transform: translate(-50%, -50%) scale(0.85); }

.idx-mapa-marker img.nodo-img {
  width: 44px; height: 44px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.idx-mapa-marker.completa img.nodo-img {
  filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.idx-mapa-marker.pendiente img.nodo-img { opacity: 0.5; filter: grayscale(0.7); }

/* Anillo de pulso */
.idx-mapa-marker::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  border-radius: 50%;
  animation: markerPulso 2.2s ease-out infinite;
  z-index: 1;
}
.idx-mapa-marker.completa::before { background: rgba(212,165,32,0.45); }
.idx-mapa-marker.parcial::before  { background: rgba(139,46,26,0.45); }
.idx-mapa-marker.pendiente::before { background: rgba(100,100,100,0.25); }

@keyframes markerPulso {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 0.9; }
  100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0; }
}

.idx-mapa-julen {
  position: absolute;
  transform: translate(-50%, -90%);
  z-index: 10;
  width: 40px;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.5));
  transition: left 0.8s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}

.idx-mapa-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Baloo 2', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: rgba(58,40,16,0.6);
  background: rgba(245,236,204,0.8);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}

/* ===== TAB CREDENCIAL — SELLOS DE ETAPA ===== */
.idx-credencial-wrap {
  padding: 16px 12px;
}

.idx-credencial-titulo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--red-dark);
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(58,40,16,0.15);
  margin-bottom: 16px;
}

.idx-sellos-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.idx-sello-etapa {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s;
}
.idx-sello-etapa:active { transform: scale(0.92); }

.idx-sello-etapa img {
  width: 100%;
  max-width: 70px;
  aspect-ratio: 1;
  object-fit: contain;
}
.idx-sello-etapa.bloqueada img { opacity: 0.3; filter: grayscale(1); }
.idx-sello-etapa.completa img { animation: selloIn .4s cubic-bezier(.34,1.56,.64,1); }

.idx-sello-etapa-num {
  font-family: 'Cinzel Decorative', serif;
  font-size: 7px;
  font-weight: 400;
  color: var(--ink-soft);
  text-align: center;
}

/* ===== TAB LOGROS ===== */
.idx-logros-wrap {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.idx-logros-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--red-dark);
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(58,40,16,0.15);
  margin-bottom: 4px;
}

.idx-logro {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(58,40,16,0.1);
  transition: transform .1s;
}
.idx-logro.bloqueado { opacity: 0.45; filter: grayscale(0.6); }
.idx-logro:active:not(.bloqueado) { transform: scale(0.98); }
.idx-logro img { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.idx-logro-info { flex: 1; }
.idx-logro-nombre {
  font-family: 'Cinzel Decorative', serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--red-dark);
  margin-bottom: 3px;
}
.idx-logro-desc { font-size: 12px; line-height: 1.4; color: var(--ink-soft); font-weight: 600; }
.idx-logro-badge { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }

/* ===== TAB CÓDICE ===== */
.idx-codice-wrap { padding: 16px 12px; }

.idx-codice-cats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.idx-codice-cats::-webkit-scrollbar { display: none; }

.idx-cat-btn {
  flex-shrink: 0;
  font-family: 'Cinzel Decorative', serif;
  font-size: 9px;
  font-weight: 400;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--gold);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.idx-cat-btn img { width: 20px; height: 20px; object-fit: contain; }
.idx-cat-btn.active { background: var(--gold); color: var(--ink); font-weight: 700; }

.idx-fichas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.idx-ficha {
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: transform .1s;
  position: relative;
  min-height: 100px;
  border-bottom: 1px solid rgba(58,40,16,0.08);
}
.idx-ficha:active:not(.bloqueada) { transform: scale(0.97); }
.idx-ficha.bloqueada { opacity: 0.4; }
.idx-ficha-icon { width: 44px; height: 44px; object-fit: contain; margin-bottom: 6px; display: block; }
.idx-ficha-titulo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--red-dark);
  line-height: 1.3;
  margin-bottom: 4px;
}
.idx-ficha-preview {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.idx-ficha-lock {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 48px; height: 48px;
  object-fit: contain;
}

/* ===== MODAL CÓDICE ===== */
.idx-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,28,12,0.6);
  z-index: 200;
  align-items: flex-end;
}
.idx-modal-bg.open { display: flex; }

.idx-modal {
  width: 100%;
  max-height: 80vh;
  background: var(--parchment);
  background-image: url('img/fondo.png');
  background-size: cover;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 40px;
  overflow-y: auto;
  animation: modalUp .3s ease;
}
@keyframes modalUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.idx-modal-close {
  float: right;
  background: rgba(58,40,16,0.1);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.idx-modal-icon { width: 64px; height: 64px; object-fit: contain; display: block; margin: 12px auto 8px; }
.idx-modal-titulo {
  font-family: 'Cinzel Decorative', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--red-dark);
  text-align: center;
  margin-bottom: 14px;
}
.idx-modal-texto { font-size: 14px; line-height: 1.65; color: var(--ink); font-weight: 600; }

@media (min-width: 600px) {
  .idx-fichas { grid-template-columns: repeat(3, 1fr); }
}
