﻿/* ===================================================
   BIBLIA EXTENDIDA - UI Moderna v2
   Design: Dark premium - Glassmorphism - Minimal
   =================================================== */

:root {
  --bg:             #080810;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);
  --gold:           #c9a96e;
  --gold-lt:        #e4c28a;
  --gold-dim:       rgba(201,169,110,0.12);
  --gold-border:    rgba(201,169,110,0.22);
  --text:           #f0ebe0;
  --text-2:         #9b9080;
  --text-3:         #5c5650;
  --border:         rgba(255,255,255,0.07);
  --red:            #e07070;
  --radius:         18px;
  --radius-sm:      12px;
  --radius-xs:      8px;
  --shadow-card:    0 8px 40px rgba(0,0,0,0.55);
  --font-serif:     'Playfair Display', Georgia, serif;
  --font-sans:      'Inter', system-ui, sans-serif;
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light theme ─────────────────────────────────── */
[data-theme="light"] {
  --bg:            #f7f2e8;
  --bg-card:       rgba(255,255,255,0.88);
  --bg-card-hover: rgba(255,255,255,0.98);
  --text:          #1c1510;
  --text-2:        #5a4f3e;
  --text-3:        #9a8f7e;
  --border:        rgba(0,0,0,0.08);
  --shadow-card:   0 4px 30px rgba(0,0,0,0.08);
}
[data-theme="light"] .glow-1 { opacity: 0.07; }
[data-theme="light"] .glow-2 { opacity: 0.04; }
[data-theme="light"] .app-header  { background: rgba(247,242,232,0.90); }
[data-theme="light"] .form-input  { background: rgba(0,0,0,0.04); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* FONDO ANIMADO */
.bg-glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: drift 20s ease-in-out infinite alternate;
}

.glow-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #c9a96e, transparent 70%);
  top: -200px; right: -100px;
}

.glow-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #4a6fa5, transparent 70%);
  bottom: 10%; left: -150px;
  opacity: 0.12;
  animation-delay: -10s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.1); }
}

/* HEADER */
.app-header {
  position: relative;
  z-index: 100;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(8,8,16,0.75);
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 0.75rem; }

.logo-symbol {
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(201,169,110,0.65));
}

.logo-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.logo-sub {
  display: block;
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* MAIN */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* SEARCH PANEL */
.search-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

/* TABS */
.tabs-wrapper {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.tab-btn svg { opacity: 0.7; flex-shrink: 0; }

.tab-btn.active {
  background: rgba(201,169,110,0.12);
  color: var(--gold);
  box-shadow: 0 1px 8px rgba(0,0,0,0.2);
}

.tab-btn.active svg { opacity: 1; }
.tab-btn:hover:not(.active) { color: var(--text-2); background: rgba(255,255,255,0.04); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* INPUT */
.input-group { display: flex; flex-direction: column; gap: 0.6rem; }

.input-wrapper { position: relative; display: flex; align-items: center; }

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-3);
  pointer-events: none;
  flex-shrink: 0;
}

input[type="text"] {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  padding: 0.85rem 3.2rem 0.85rem 2.8rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
}

input[type="text"]::placeholder { color: var(--text-3); font-weight: 300; }

input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1), 0 0 20px rgba(201,169,110,0.06);
}

.btn-search {
  position: absolute;
  right: 6px;
  width: 36px; height: 36px;
  background: var(--gold);
  border: none;
  border-radius: 8px;
  color: #080810;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}

.btn-search:hover { background: var(--gold-lt); }
.btn-search:active { transform: scale(0.93); }
.btn-search:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.input-hint { font-size: 0.75rem; color: var(--text-3); padding-left: 0.2rem; }
.input-hint em { color: var(--gold); font-style: normal; font-weight: 500; }

/* PASAJE PANEL */
.pasaje-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeUp 0.4s var(--ease) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pasaje-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.pasaje-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.pasaje-meta { display: flex; flex-direction: column; gap: 0.35rem; }

.version-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201,169,110,0.1);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  width: fit-content;
}

.pasaje-meta h2 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.pasaje-texto {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.95;
  color: rgba(240,235,224,0.88);
  border-left: 2px solid var(--gold-border);
  padding-left: 1.25rem;
  margin: 0;
  white-space: pre-wrap;
}

.pasaje-texto .verso-num {
  font-size: 0.6em;
  color: var(--gold);
  vertical-align: super;
  font-family: var(--font-sans);
  font-weight: 600;
  margin-right: 3px;
  user-select: none;
}

/* ANALISIS SECTION */
.analisis-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.analisis-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.btn-analisis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.btn-analisis {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1rem 0.5rem 0.85rem;
  text-align: center;
  transition: all 0.22s var(--ease);
  position: relative;
  overflow: hidden;
}

.btn-analisis::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,169,110,0.1), transparent);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.btn-analisis:hover {
  border-color: var(--gold-border);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.btn-analisis:hover::before { opacity: 1; }
.btn-analisis:active { transform: translateY(0) scale(0.97); }

.btn-analisis.active-btn {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,169,110,0.1);
}
.btn-analisis.active-btn::before { opacity: 1; }
.btn-analisis.loading { opacity: 0.45; pointer-events: none; }

.ba-icon { font-size: 1.5rem; line-height: 1; position: relative; z-index: 1; }
.ba-label { font-size: 0.71rem; font-weight: 500; line-height: 1.3; position: relative; z-index: 1; }

/* RESULTADO PANEL */
.resultado-panel { animation: fadeUp 0.4s var(--ease) both; }

.resultado-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.resultado-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.resultado-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201,169,110,0.1);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  margin-bottom: 0.35rem;
  width: fit-content;
}

.resultado-header h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.resultado-acciones { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

.resultado-contenido {
  font-size: 0.95rem;
  line-height: 1.82;
  color: rgba(240,235,224,0.83);
}

.resultado-contenido p { margin: 0.6rem 0; }

.resultado-contenido h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-lt);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--gold-border);
}
.resultado-contenido h4:first-child { margin-top: 0; }

.resultado-contenido ul,
.resultado-contenido ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.resultado-contenido li { margin: 0.35rem 0; }
.resultado-contenido strong { color: var(--text); font-weight: 600; }
.resultado-contenido em { color: var(--gold); font-style: italic; }

.ref-cruzada {
  display: inline-block;
  background: rgba(74,111,165,0.14);
  border: 1px solid rgba(74,111,165,0.28);
  border-radius: var(--radius-xs);
  color: #7ea8d8;
  font-size: 0.85em;
  font-weight: 500;
  padding: 0.05rem 0.45rem;
  margin: 0 2px;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.ref-cruzada:hover { background: rgba(74,111,165,0.28); }

.palabra-original {
  font-style: italic;
  color: var(--gold-lt);
  border-bottom: 1px dashed var(--gold-border);
}

/* SKELETON */
.skeleton-loader { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.25rem 0; }

.skeleton-line {
  height: 13px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.6s infinite;
}
.skeleton-line.short { width: 55%; }
.skeleton-line.med   { width: 75%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* HISTORIAL */
.historial-panel { animation: fadeUp 0.4s var(--ease) both; }

.historial-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.historial-lista { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }

.historial-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.87rem;
  padding: 0.65rem 1rem;
  transition: all 0.2s var(--ease);
  color: var(--text-2);
}

.historial-item:hover {
  border-color: var(--gold-border);
  color: var(--text);
  background: var(--bg-card-hover);
}

.hist-tipo {
  font-size: 0.68rem;
  color: var(--text-3);
  background: rgba(0,0,0,0.3);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: auto;
  white-space: nowrap;
}

/* BUTTONS */
.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.btn-chip:hover { border-color: var(--gold-border); color: var(--gold); background: rgba(201,169,110,0.1); }

.btn-icon-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.btn-icon-close:hover {
  background: rgba(224,112,112,0.1);
  border-color: rgba(224,112,112,0.3);
  color: var(--red);
}

.btn-install {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(201,169,110,0.1);
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s var(--ease);
}
.btn-install:hover { background: rgba(201,169,110,0.18); }

.header-right { display: flex; align-items: center; gap: 0.6rem; }

/* Botón de tema en el header */
.app-header .btn-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
  padding: 0;
  line-height: 0;
}
.app-header .btn-theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

/* Usuario en header */
.header-user { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(201,169,110,0.15);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  user-select: none;
  text-transform: uppercase;
}
.user-avatar.has-photo { font-size: 0; }
.user-avatar:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,169,110,0.2);
}
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-logout:hover { color: var(--gold); border-color: var(--gold-border); background: var(--gold-dim); }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 480px) { .modal-overlay { align-items: center; } }

.modal-box {
  background: #0e0e18;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.75);
  animation: slideUp 0.3s var(--ease);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
}

.version-grid { display: flex; flex-direction: column; gap: 0.4rem; }

.btn-version {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.75rem 1rem;
  text-align: left;
  transition: all 0.2s var(--ease);
  width: 100%;
}
.btn-version:hover { border-color: var(--gold-border); background: rgba(201,169,110,0.08); }
.btn-version.active { border-color: var(--gold); background: rgba(201,169,110,0.08); }

.vbtn-code { font-size: 0.8rem; font-weight: 700; color: var(--gold); min-width: 52px; }
.vbtn-name { font-size: 0.84rem; color: var(--text-2); }
.btn-version.active .vbtn-name { color: var(--text); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18,18,26,0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.6rem 1.4rem;
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  max-width: min(90vw, 480px);
  text-align: center;
  animation: toastIn 0.3s var(--ease);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* UTILITIES */
.hidden { display: none !important; }

/* LANGUAGE CYCLING BUTTON */
.btn-lang-cycle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  padding: 0;
}
.btn-lang-cycle:hover {
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

/* VERSION SECTION LABELS IN MODAL */
.modal-box { max-height: 85vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.version-section { margin-bottom: 1.1rem; }
.version-section:last-child { margin-bottom: 0; }
.version-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.45rem;
  padding-left: 0.1rem;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .app-main { padding: 1.25rem 1rem 5rem; }
  .search-panel, .pasaje-card, .analisis-section, .resultado-card { padding: 1.25rem; }
  .btn-analisis-grid { grid-template-columns: repeat(2, 1fr); }
  .pasaje-meta h2 { font-size: 1.35rem; }
  .logo-name { font-size: 0.8rem; }
}
