/* ==========================================================================
   JESS' BOOKS - LAYOUT & MOBILE-FIRST SHELL
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  padding-bottom: 90px; /* Espaço para a barra inferior mobile */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 40px;
  }
}

/* CONTAINER PRINCIPAL */
.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* CABEÇALHO SUPERIOR */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 16px;
  transition: background-color var(--transition-normal);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-gold), #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* NAVEGAÇÃO DESKTOP */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 8px;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
}

.nav-tab-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.nav-tab-btn.active {
  color: var(--accent-gold);
  background: var(--accent-gold-subtle);
}

/* AÇÕES DO CABEÇALHO */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-icon:hover {
  transform: translateY(-2px);
  background: var(--border-subtle);
}

.btn-icon:active {
  transform: scale(0.95);
}

/* BOTÃO INSTALAR PWA */
.btn-pwa-install {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--accent-gold);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* BARRA DE NAVEGAÇÃO INFERIOR MOBILE */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 12px;
  z-index: 100;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.bottom-nav-item.active {
  color: var(--accent-gold);
}

.bottom-nav-item.highlight-btn {
  background: var(--accent-gold);
  color: #fff;
  border-radius: var(--radius-full);
  width: 50px;
  height: 50px;
  padding: 0;
  justify-content: center;
  margin-top: -24px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.bottom-nav-item.highlight-btn svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
}

/* TELA DE BLOQUEIO PRIVADO (QUANDO NÃO AUTENTICADO) */
.private-lock-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 65vh;
  padding: 40px 16px;
  text-align: center;
}

.lock-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease;
}

.lock-icon-badge {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-gold), #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #fff;
  margin: 0 auto 20px auto;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.lock-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.lock-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* BANNER INFORMAL DE COBRANÇA DE LIVROS EMPRESTADOS */
.loan-nudge-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.12));
  border: 1.5px dashed #f59e0b;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  animation: slideToast 0.4s ease;
}

.nudge-text-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 250px;
}

.nudge-emoji {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.nudge-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.nudge-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-nudge-cobrar {
  background: #25d366;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.btn-nudge-cobrar:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* VIEW SECTIONS */
.app-view {
  display: none;
  padding-top: 20px;
  animation: fadeIn 0.3s ease;
}

.app-view.active {
  display: block;
}

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

/* MODAIS GLOBAIS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-bounce);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: var(--bg-surface-elevated);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.2rem;
  transition: background var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

/* TOASTS DE NOTIFICAÇÃO */
.toast-container {
  position: fixed;
  bottom: 84px;
  right: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
  pointer-events: none;
}

@media (min-width: 768px) {
  .toast-container {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 360px;
  }
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }

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