/* ==========================================================================
   Nexa Messenger - Universal Mobile App Installer Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --bg-dark: #060913;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --border-glow: rgba(99, 102, 241, 0.25);
  --border-cyan: rgba(6, 182, 212, 0.3);
  
  --primary-indigo: #6366f1;
  --primary-cyan: #06b6d4;
  --primary-purple: #a855f7;
  --primary-emerald: #10b981;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --gradient-main: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --gradient-accent: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --gradient-card: linear-gradient(180deg, rgba(15, 23, 42, 0.8) 0%, rgba(10, 15, 29, 0.9) 100%);
  --gradient-glow: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.25) 0%, rgba(6, 9, 19, 0) 70%);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.35);
  --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  background-image: var(--gradient-glow);
  background-repeat: no-repeat;
  background-size: 100% 600px;
}

h1, h2, h3, h4, .brand-title {
  font-family: 'Outfit', sans-serif;
}

/* Page Background Effects */
.ambient-blur-1 {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(6, 182, 212, 0.1) 40%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(50px);
}

.ambient-blur-2 {
  position: fixed;
  bottom: -150px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}

.app-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 1;
}

/* Header & Nav */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.logo-img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  transition: var(--transition-fast);
}

.brand-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid var(--border-glow);
  font-size: 0.85rem;
  font-weight: 500;
  color: #a5b4fc;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 36px;
}

.hero-icon-wrapper {
  margin-bottom: 20px;
  display: inline-block;
}

.hero-app-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.5), 0 0 70px rgba(6, 182, 212, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
}

.hero-app-icon:hover {
  transform: scale(1.05) rotate(2deg);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.8px;
}

.hero-title span {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Main Install Action Card */
.installer-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  backdrop-filter: blur(16px);
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 44px;
}

.installer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-main);
}

.install-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
}

.mini-status-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.status-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: left;
}

.status-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: left;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 440px;
  margin: 0 auto 16px;
}

.btn-primary-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 28px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--gradient-main);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.5);
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary-install:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 15px 40px -5px rgba(99, 102, 241, 0.7);
}

.btn-primary-install:active {
  transform: translateY(1px) scale(0.99);
}

.btn-secondary-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.btn-secondary-launch:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-cyan);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.25);
}

.btn-secondary-launch:active {
  transform: translateY(1px);
}

.btn-apk-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  backdrop-filter: blur(8px);
}

.btn-apk-download:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-apk-download:active {
  transform: translateY(1px);
}

.btn-icon {
  font-size: 1.25rem;
}

.install-note {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Fullscreen Standalone App Container */
.fullscreen-app-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 5000;
  background: #0b0f19;
  overflow: hidden;
}

#nexaAppFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #0b0f19;
}

/* Standalone Instant Splash */
.standalone-splash {
  display: none;
  position: fixed;
  inset: 0;
  background: #060913;
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.standalone-splash.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* When in Standalone / Installed App Mode */
html.is-standalone-app,
html.is-standalone-app body {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: #0b0f19 !important;
}

html.is-standalone-app .app-container,
html.is-standalone-app .ambient-blur-1,
html.is-standalone-app .ambient-blur-2,
html.is-standalone-app .web-app-frame-modal {
  display: none !important;
}

html.is-standalone-app .fullscreen-app-container {
  display: block !important;
}

html.is-standalone-app .standalone-splash {
  display: flex !important;
}

@media all and (display-mode: standalone), all and (display-mode: fullscreen) {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .app-container, .ambient-blur-1, .ambient-blur-2 {
    display: none !important;
  }
  .fullscreen-app-container {
    display: block !important;
  }
  .standalone-splash {
    display: flex !important;
  }
}

.splash-icon-wrapper {
  margin-bottom: 8px;
}

.splash-logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  box-shadow: 0 0 45px rgba(99, 102, 241, 0.6), 0 0 70px rgba(6, 182, 212, 0.3);
  animation: splashPulse 1.4s infinite ease-in-out;
}

.splash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.splash-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: -6px;
}

.splash-loader {
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}

.splash-loader-bar {
  width: 50%;
  height: 100%;
  background: var(--gradient-main);
  border-radius: 4px;
  animation: splashLoaderAnim 1.2s infinite ease-in-out;
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 35px rgba(6, 182, 212, 0.7)); }
}

@keyframes splashLoaderAnim {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* Secondary Download Grid */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-bottom: 44px;
}

.option-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.recommended-card {
  border: 1.5px solid var(--primary-cyan);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.12) 0%, rgba(15, 23, 42, 0.85) 100%);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.2);
}

.card-tag {
  position: absolute;
  top: -12px;
  right: 16px;
  background: var(--gradient-main);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-apk-primary {
  background: var(--gradient-main) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
}

.btn-apk-primary:hover {
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
}

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-3px);
}

.option-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.option-icon-box {
  position: relative;
  width: 44px;
  height: 44px;
}

.card-nexa-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.os-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 0.9rem;
  background: #0f172a;
  border-radius: 50%;
  padding: 1px;
}

.option-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.option-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.option-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  flex-grow: 1;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  width: 100%;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary-indigo);
  color: #ffffff;
}

/* Features Showcase */
.features-section {
  margin-bottom: 50px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.feature-item {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-icon {
  font-size: 1.5rem;
  background: rgba(99, 102, 241, 0.1);
  padding: 8px;
  border-radius: var(--radius-sm);
}

.feature-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.feature-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Live Standalone App Modal & View */
.web-app-frame-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 6, 23, 0.95);
  z-index: 1000;
  flex-direction: column;
}

.web-app-frame-modal.active {
  display: flex;
}

.frame-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.frame-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-frame {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.app-iframe {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  border: none;
}

/* Footer */
.footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .hero-title {
    font-size: 2rem;
  }
  .hero-app-icon {
    width: 80px;
    height: 80px;
  }
  .installer-card {
    padding: 24px 16px;
  }
  .btn-primary-install {
    font-size: 1.1rem;
    padding: 15px 20px;
  }
}
