/* =============================================
   BIBLE ALIVE — App Styles V2
   by Orzatty Holdings
   ============================================= */

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-text-accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ── Ocultar Scrollbars (Estética iOS/Mac) ── */
::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Splash Screen ── */
.splash-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease-in-out, visibility 0.6s;
}

.splash-screen.hidden { opacity: 0; visibility: hidden; }

.splash-content { text-align: center; animation: pulse 2s infinite ease-in-out; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

.splash-logo { width: 80px; height: 80px; margin: 0 auto var(--space-4); display: block; }
.splash-content h1 { font-family: var(--font-scripture); font-size: var(--text-3xl); font-weight: var(--weight-bold); margin-bottom: 2px; }
.splash-content p { font-size: var(--text-sm); color: var(--color-text-tertiary); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── App Shell ── */
.app-shell { display: flex; flex-direction: column; height: 100dvh; width: 100%; overflow: hidden; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* ── Top Bar ── */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
  z-index: var(--z-sticky);
}

.topbar-version button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
  transition: background var(--duration-fast);
}
.topbar-version button svg { width: 16px; height: 16px; }


.topbar-actions { display: flex; align-items: center; gap: var(--space-1); }
.topbar-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); color: var(--color-text-secondary); transition: background var(--duration-fast); }
.topbar-btn:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.topbar-btn svg { width: 22px; height: 22px; }

/* ── View Container & Animations ── */
.view-container { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: calc(var(--bottomnav-height) + var(--space-4)); scroll-behavior: smooth; position: relative; }
.view { display: none; position: absolute; top: 0; left: 0; width: 100%; min-height: 100%; padding-bottom: calc(var(--bottomnav-height) + var(--space-4)); background: var(--color-bg-primary); z-index: 1; }
.view.active { display: block; z-index: 2; }

/* Animaciones de Transición de Páginas */
.view.slide-in-right { animation: slideInRight 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
.view.slide-in-left { animation: slideInLeft 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0.8; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0.8; } to { transform: translateX(0); opacity: 1; } }

/* ── Dashboard (Home View) ── */
.home-view { padding: var(--space-6) var(--space-4); max-width: 600px; margin: 0 auto; }

.streak-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-radius: var(--radius-full); width: max-content; box-shadow: var(--shadow-sm); }
.streak-icon { font-size: 20px; }
.streak-count { font-size: var(--text-sm); font-weight: var(--weight-bold); display: block; line-height: 1.2; }
.streak-label { font-size: 10px; color: var(--color-text-tertiary); text-transform: uppercase; }

.home-section-title { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text-secondary); margin: var(--space-6) 0 var(--space-3); text-transform: uppercase; letter-spacing: 0.05em; }

.votd-card { position: relative; border-radius: var(--radius-xl); overflow: hidden; min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; padding: var(--space-6); box-shadow: var(--shadow-md); cursor: pointer; }
.votd-bg { position: absolute; inset: 0; background-size: cover; background-position: center; z-index: 1; transition: transform var(--duration-slow); }
.votd-card:hover .votd-bg { transform: scale(1.05); }
.votd-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 100%); z-index: 2; }
.votd-content { position: relative; z-index: 3; color: white; }
.votd-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: var(--space-2); opacity: 0.8; font-weight: var(--weight-bold); }
.votd-text { font-family: var(--font-scripture); font-size: var(--text-xl); line-height: 1.4; margin-bottom: var(--space-3); font-weight: var(--weight-semibold); text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.votd-ref { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-accent-light); }

.continue-reading-card { width: 100%; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); text-align: left; transition: all var(--duration-fast); }
.continue-reading-card:active { transform: scale(0.98); }
.cr-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--color-accent-bg); color: var(--color-accent); border-radius: var(--radius-md); flex-shrink: 0; }
.cr-icon svg { width: 24px; height: 24px; }
.cr-info { flex: 1; }
.cr-book { display: block; font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--color-text-primary); margin-bottom: 2px; }
.cr-version { display: block; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.cr-arrow { color: var(--color-text-tertiary); }
.cr-arrow svg { width: 20px; height: 20px; }

.explore-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.explore-card { padding: var(--space-4); background: var(--color-surface); border-radius: var(--radius-md); font-weight: var(--weight-semibold); text-align: center; border: 1px solid var(--color-border-light); box-shadow: var(--shadow-xs); }

/* ── Reader Top Book Selector ── */
.book-selector-btn { margin: 0 auto var(--space-6); display: flex; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--color-surface); border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text-primary); box-shadow: var(--shadow-sm); width: max-content; transition: background var(--duration-fast); }
.book-selector-btn:hover { background: var(--color-surface-hover); }
.book-selector-btn svg { width: 16px; height: 16px; }

/* ── Fullscreen Modal Base ── */
.fullscreen-modal { position: fixed; inset: 0; background: var(--color-bg-primary); z-index: 999; display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.fullscreen-modal.visible { transform: translateY(0); }
.book-modal { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 600px; margin: 0 auto; background: var(--color-surface); box-shadow: var(--shadow-xl); }
.book-modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); border-bottom: 1px solid var(--color-border-light); }
.book-modal-header h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.book-modal-body { flex: 1; overflow-y: auto; padding: var(--space-4); }

/* ── Book & Chapter Grid ── */
.book-modal-grid { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--color-border-light); border-radius: var(--radius-md); overflow: hidden; }
.book-modal-grid > button { background: var(--color-surface); padding: var(--space-4); text-align: left; font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--color-text-primary); }
.book-modal-grid > button:active { background: var(--color-surface-active); }
.chapter-grid-lg { grid-template-columns: repeat(5, 1fr); text-align: center; }
.chapter-grid-lg > button { text-align: center; padding: var(--space-5) 0; font-size: var(--text-lg); font-weight: var(--weight-bold); }

/* ── Version Selector List ── */
.version-modal-list { display: flex; flex-direction: column; gap: var(--space-3); }
.version-card { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); text-align: left; }
.version-card.active { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.version-info { display: flex; flex-direction: column; }
.version-code { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-accent); }
.version-name { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-text-primary); margin-top: 2px; }
.version-action { color: var(--color-text-tertiary); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-bg-secondary); }

/* ── Ripple Effect ── */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple-element {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  pointer-events: none;
}
[data-theme="dark"] .ripple-element { background: rgba(255, 255, 255, 0.1); }
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Custom Range Slider ── */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
}
input[type=range]::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -7px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform var(--duration-fast);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── Profile Hub (Bookmarks View) ── */
.profile-header { text-align: center; margin-bottom: var(--space-8); }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--color-accent-bg); color: var(--color-accent); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-4); font-size: 32px; box-shadow: var(--shadow-md); border: 2px solid var(--color-surface); }
.profile-name { font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--color-text-primary); margin-bottom: 4px; }
.profile-level { font-size: var(--text-sm); color: var(--color-accent); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.1em; }

.profile-stats { display: flex; gap: var(--space-4); margin-bottom: var(--space-8); }
.stat-box { flex: 1; background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); padding: var(--space-4); text-align: center; box-shadow: var(--shadow-sm); }
.stat-num { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--color-text-primary); display: block; line-height: 1; margin-bottom: var(--space-1); }
.stat-label { font-size: var(--text-xs); color: var(--color-text-tertiary); text-transform: uppercase; font-weight: var(--weight-bold); }

.download-manager-card { background: var(--color-surface); border: 1px solid var(--color-border-light); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-8); box-shadow: var(--shadow-sm); }
.dm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.dm-title { font-size: var(--text-md); font-weight: var(--weight-bold); display: flex; align-items: center; gap: var(--space-2); }
.dm-title svg { color: var(--color-accent); }
.downloaded-item { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border-light); }
.downloaded-item:last-child { border-bottom: none; padding-bottom: 0; }
.downloaded-info { font-weight: var(--weight-semibold); }
.downloaded-size { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 2px; display: block; }
.downloaded-delete { color: #e74c3c; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(231, 76, 60, 0.1); }

.search-view, .bookmarks-view { padding: var(--space-6) var(--space-4); max-width: 600px; margin: 0 auto; }
.search-input-wrapper { position: relative; margin-bottom: var(--space-6); }
.search-input-wrapper svg { position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--color-text-tertiary); pointer-events: none; }
.search-input { width: 100%; padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 20px + var(--space-3)); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-full); font-size: var(--text-md); transition: all var(--duration-fast); }
.search-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-bg); }

.bookmarks-header { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); background: var(--color-bg-secondary); padding: 4px; border-radius: var(--radius-full); }
.bookmarks-tab { flex: 1; padding: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-text-secondary); border-radius: var(--radius-full); transition: all var(--duration-fast); text-align: center; }
.bookmarks-tab.active { background: var(--color-surface); color: var(--color-text-primary); box-shadow: var(--shadow-sm); }
.bookmark-item { padding: var(--space-4); background: var(--color-surface); border-radius: var(--radius-lg); margin-bottom: var(--space-3); box-shadow: var(--shadow-xs); }
.bookmark-item .bookmark-ref { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-accent); margin-bottom: var(--space-2); }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%;
  height: var(--bottomnav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  z-index: var(--z-sticky);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner { display: flex; align-items: center; justify-content: space-around; height: 100%; max-width: 600px; margin: 0 auto; }
.bottom-nav-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; color: var(--color-text-tertiary); font-size: 10px; font-weight: var(--weight-bold); transition: color var(--duration-fast); }
.bottom-nav-btn svg { width: 24px; height: 24px; stroke-width: 2.5; }
.bottom-nav-btn.active { color: var(--color-text-primary); }

/* ── Font Panel ── */
.font-panel { position: fixed; top: calc(var(--topbar-height) + 8px); right: var(--space-4); background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); padding: var(--space-5); z-index: var(--z-dropdown); display: none; width: 300px; border: 1px solid var(--color-border-light); }
.font-panel.visible { display: block; animation: fadeIn var(--duration-fast) var(--ease-out); }

/* ── Note Modal ── */
.modal-overlay { position: fixed; inset: 0; background: var(--color-overlay); z-index: var(--z-modal); display: none; align-items: center; justify-content: center; padding: var(--space-4); }
.modal-overlay.visible { display: flex; }
.modal { background: var(--color-surface); border-radius: var(--radius-xl); width: 100%; max-width: 400px; overflow: hidden; }
.modal-header { padding: var(--space-4); border-bottom: 1px solid var(--color-border-light); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: var(--space-4); }
.modal-body textarea { width: 100%; min-height: 150px; padding: var(--space-3); background: var(--color-bg-secondary); border: none; border-radius: var(--radius-md); resize: none; }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--color-bg-secondary); }
.btn { padding: var(--space-2) var(--space-4); border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.btn-primary { background: var(--color-text-primary); color: var(--color-surface); }
.btn-ghost { color: var(--color-text-secondary); }

/* ── Loading & Empty ── */
.loading-spinner { margin: var(--space-10) auto; width: 40px; height: 40px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: var(--space-10) var(--space-4); color: var(--color-text-tertiary); }
.toast { position: fixed; bottom: calc(var(--bottomnav-height) + var(--space-4)); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--color-text-primary); color: var(--color-surface); padding: var(--space-3) var(--space-6); border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: var(--weight-bold); z-index: 9999; opacity: 0; pointer-events: none; transition: all var(--duration-fast); box-shadow: var(--shadow-lg); }
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
