/* ─── Howe2Train Custom Styles ─── */

/* Smooth scroll & overscroll */
html {
  scroll-behavior: smooth;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Barlow', sans-serif;
  background: #0A0A0A;
  color: #FFFFFF;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Screen Transitions ─── */
#app-content {
  animation: screenIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.screen-enter {
  animation: screenIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-in {
  animation: slideInRight 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-up {
  animation: slideInUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Gold Shimmer Effect ─── */
@keyframes goldShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.gold-shimmer {
  background: linear-gradient(90deg, #C5A55A 0%, #E8D5A0 25%, #C5A55A 50%, #E8D5A0 75%, #C5A55A 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShimmer 3s linear infinite;
}

/* ─── Badge Pulse ─── */
@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(197, 165, 90, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(197, 165, 90, 0); }
}

.badge-pulse {
  animation: badgePulse 2s ease-in-out infinite;
}

/* ─── Notification Dot ─── */
@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.notif-dot {
  animation: notifPulse 2s ease-in-out infinite;
}

/* ─── Progress Bar ─── */
.progress-bar {
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes progressGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(197, 165, 90, 0.3); }
  50% { box-shadow: 0 0 12px rgba(197, 165, 90, 0.6); }
}

.progress-glow {
  animation: progressGlow 2s ease-in-out infinite;
}

/* ─── Cards ─── */
.card-tap {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.card-tap:active {
  transform: scale(0.97);
}

/* ─── Bottom Sheet / Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  z-index: 51;
  animation: slideInUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  margin: 12px auto;
}

/* ─── Toast Notification ─── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.toast {
  animation: toastIn 0.3s ease;
}

.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

/* ─── Bottom Navigation ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(197, 165, 90, 0.15);
}

.nav-item {
  transition: color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
  transform: scale(0.9);
}

.nav-item.active {
  color: #C5A55A;
}

.nav-item.active svg {
  stroke: #C5A55A;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2A2A2A;
  border-radius: 2px;
}

/* ─── Safe Area Spacing ─── */
.safe-top {
  padding-top: max(16px, env(safe-area-inset-top));
}

.safe-bottom {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ─── Image Cover Fallback ─── */
.img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* ─── Category Pills ─── */
.pill {
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.pill:active {
  transform: scale(0.95);
}

.pill.active {
  background: #C5A55A;
  color: #0A0A0A;
  border-color: #C5A55A;
}

/* ─── Floating Action Button ─── */
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(197, 165, 90, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(197, 165, 90, 0.5); }
}

.fab {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  right: 20px;
  z-index: 35;
  animation: fabPulse 3s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.fab:active {
  transform: scale(0.9);
}

/* ─── Splash Screen ─── */
@keyframes logoReveal {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes shieldGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(197, 165, 90, 0.2)); }
  50% { filter: drop-shadow(0 0 30px rgba(197, 165, 90, 0.5)); }
}

.logo-reveal {
  animation: logoReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1), shieldGlow 3s ease-in-out infinite;
}

/* ─── Stat Counter ─── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-reveal {
  animation: countUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  opacity: 0;
}

.stat-reveal:nth-child(1) { animation-delay: 0.1s; }
.stat-reveal:nth-child(2) { animation-delay: 0.2s; }
.stat-reveal:nth-child(3) { animation-delay: 0.3s; }
.stat-reveal:nth-child(4) { animation-delay: 0.4s; }

/* ─── Checkbox toggle ─── */
.drill-check {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border: 2px solid #C5A55A;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.drill-check:checked {
  background: #C5A55A;
  border-color: #C5A55A;
}

.drill-check:checked::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 9px;
  width: 6px;
  height: 12px;
  border: solid #0A0A0A;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Desktop Scaling ─── */
@media (min-width: 768px) {
  #app {
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    min-height: 100dvh;
    box-shadow: 0 0 80px rgba(197, 165, 90, 0.08);
  }

  .bottom-nav {
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
  }

  .fab {
    right: calc(50% - 195px);
  }

  .modal-sheet {
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
  }

  .toast-container {
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
  }
}
