/**
 * Janosci Mobile App — PWA splash & standalone experience
 */

/* ── Splash Screen ── */
.app-splash-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0d1b4b;
  -webkit-tap-highlight-color: transparent;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #0d1b4b 0%, #1a2f6e 45%, #0a2540 100%);
  color: #fff;
  transition: opacity 0.5s ease, transform 0.5s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app-splash.is-exiting {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.app-splash-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  animation: splashOrb 8s ease-in-out infinite;
}

.app-splash-orb--1 {
  width: 280px;
  height: 280px;
  background: #d4a017;
  top: -80px;
  right: -60px;
}

.app-splash-orb--2 {
  width: 220px;
  height: 220px;
  background: #10b981;
  bottom: 10%;
  left: -70px;
  animation-delay: -3s;
}

.app-splash-orb--3 {
  width: 160px;
  height: 160px;
  background: #3b82f6;
  top: 40%;
  right: 10%;
  animation-delay: -5s;
  opacity: 0.2;
}

@keyframes splashOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.08); }
}

.app-splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  animation: splashFadeUp 0.8s ease both;
}

@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-splash-logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
}

.app-splash-logo-ring {
  position: absolute;
  inset: -8px;
  border-radius: 28px;
  border: 2px solid rgba(212, 160, 23, 0.4);
  animation: splashRing 2s ease-in-out infinite;
}

@keyframes splashRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 1; }
}

.app-splash-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  object-fit: contain;
  background: #fff;
  padding: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}

.app-splash-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.2rem;
  background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-splash-tagline {
  font-size: 0.95rem;
  font-weight: 600;
  color: #d4a017;
  margin: 0 0 0.35rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-splash-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 2.5rem;
}

.app-splash-loader {
  width: min(240px, 70vw);
  margin: 0 auto;
}

.app-splash-loader-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.app-splash-loader-bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #d4a017, #10b981);
  border-radius: 4px;
  animation: splashLoad 1.4s ease-in-out infinite;
}

@keyframes splashLoad {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.app-splash-loader-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
}

.app-splash-footer {
  position: absolute;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.app-splash-dot {
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* ── Standalone / installed app mode ── */
@media (display-mode: standalone) {
  body.app-body {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.app-body .site-navbar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  body.app-body .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.app-body #installPopup {
    display: none !important;
  }
}

body.is-pwa-standalone .site-header-top-bar {
  display: none;
}

/* Auth pages in app mode */
body.auth-page.auth-from-app {
  background: linear-gradient(165deg, #0d1b4b 0%, #1a2f6e 50%, #0a2540 100%) !important;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}

body.auth-page.auth-from-app .auth-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

body.auth-page .auth-welcome-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(212, 160, 23, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #065f46;
  text-align: center;
}

body.auth-page.auth-from-app .auth-welcome-banner {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

body.auth-page .auth-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(13, 27, 75, 0.08);
  color: #0d1b4b;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.auth-page.auth-from-app .auth-app-badge {
  background: rgba(212, 160, 23, 0.2);
  color: #fbbf24;
}
