/* ============================================
   LifeRPG V5.1 — Components
   Buttons, cards, progress bars, modals, forms, toasts, nav
   ============================================ */

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.84rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s ease;
  color: var(--text-primary); background: var(--bg-elevated);
}
.btn:hover { background: #222228; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #8f9aff; box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-small { padding: 5px 10px; font-size: 0.76rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; padding: 12px; }

/* ----- Cards ----- */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px;
  transition: border-color 0.2s ease;
}
.card:hover { border-color: var(--border-visible); }

/* ----- Progress Bars ----- */
.progress-bar {
  width: 100%; height: 4px; background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.body { background: #f97316; }
.progress-fill.mind { background: #7c8aff; }
.progress-fill.will { background: #fbbf24; }

/* ----- Section Label ----- */
.section-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 10px;
}

/* ----- Top Nav ----- */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-height); padding: 0 4px;
  background: rgba(8,8,10,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; }
.nav-brand .brand-icon { font-size: 1.2rem; }

/* ----- Bottom Tab Bar ----- */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: var(--bottom-bar-height);
  background: rgba(8,8,10,0.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 0 8px; padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s ease;
  color: var(--text-tertiary); font-size: 0.7rem; font-weight: 500;
  border: none; background: none; font-family: var(--font);
}
.bottom-tab .bt-icon { font-size: 1.25rem; }
.bottom-tab.active { color: var(--accent); }

/* ----- Modal ----- */
.modal {
  display: flex; align-items: center; justify-content: center;
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  padding: 16px;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 100%; max-width: 420px;
  max-height: 85vh; overflow-y: auto;
  transform: translateY(10px); transition: transform 0.2s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.modal.show .modal-content { transform: translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px 0;
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  background: none; border: none; color: var(--text-tertiary);
  font-size: 1.2rem; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 12px 22px 18px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 0 22px 18px;
}

/* ----- Forms ----- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.78rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font); font-size: 0.88rem;
  transition: border-color 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-group textarea { min-height: 65px; resize: vertical; }
.form-group select option { background: var(--bg-elevated); color: var(--text-primary); }

/* ----- Toast ----- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 9px 18px; border-radius: var(--radius-full);
  background: var(--bg-elevated); color: var(--text-primary);
  font-size: 0.8rem; font-weight: 500; z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(-50%) translateY(0); } to { opacity: 0; transform: translateX(-50%) translateY(-8px); } }

/* ----- Auth Page ----- */
.auth-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-base); z-index: 6000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-container { width: 100%; max-width: 380px; }
.auth-hero { text-align: center; margin-bottom: 28px; }
.auth-hero .hero-icon { font-size: 2.5rem; margin-bottom: 10px; }
.auth-hero h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-hero .hero-subtitle { font-size: 0.82rem; color: var(--accent); font-weight: 500; }
.auth-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 22px;
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-secondary);
  font-family: var(--font); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease;
}
.auth-tab.active { background: var(--accent-dim); color: var(--accent); }

/* ----- Loading ----- */
.loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-base); z-index: 5500;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Level Up Modal ----- */
.level-up-content { text-align: center; padding: 28px 20px !important; }
.level-up-icon {
  font-size: 3rem; animation: bounceIn 0.5s ease; margin-bottom: 12px;
}
@keyframes bounceIn {
  0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); }
}
.level-up-title { font-size: 1.2rem; font-weight: 700; color: var(--warning); margin-bottom: 6px; }
.level-up-info { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; }
.level-up-bonus {
  padding: 10px; background: var(--warning-dim); border: 1px solid rgba(251,191,36,0.15);
  border-radius: var(--radius-md); margin-bottom: 16px; font-size: 0.82rem;
}

/* ----- Title Unlock Modal ----- */
.title-unlock-content { text-align: center; padding: 28px 20px !important; }
.title-unlock-icon { font-size: 3rem; animation: bounceIn 0.5s ease; margin-bottom: 12px; }
