/* ==========================================================================
   Spac2 - Single Page Application (SPA) Views & Mobile App Navigation
   File: page/page.css
   Aesthetic: Obsidian Dark Minimalist • Native App Touch Physics
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SPA Views Container & GPU-Accelerated Fluid Animations
   -------------------------------------------------------------------------- */
.spa-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spa-view.spa-enter-active {
  animation: spaEnterSpring 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

@keyframes spaEnterSpring {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   2. SPA Under-Upgrade Container & Glassmorphism Hero
   -------------------------------------------------------------------------- */
.spa-upgrade-wrapper {
  width: 100%;
  max-width: 860px;
  margin: 16px auto 40px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
}

.spa-upgrade-card {
  width: 100%;
  position: relative;
  background: rgba(14, 16, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  padding: clamp(28px, 6vw, 44px) clamp(20px, 5vw, 40px);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

/* Ambient Subtle Dark Aura inside card */
.spa-card-ambient-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  height: 200px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.22;
  z-index: 0;
}

.theme-app .spa-card-ambient-glow {
  background: radial-gradient(circle, #38bdf8 0%, #6366f1 70%, transparent 90%);
}

.theme-chat .spa-card-ambient-glow {
  background: radial-gradient(circle, #10b981 0%, #3b82f6 70%, transparent 90%);
}

.theme-you .spa-card-ambient-glow {
  background: radial-gradient(circle, #f59e0b 0%, #ec4899 70%, transparent 90%);
}

.spa-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 620px;
  width: 100%;
}

/* --------------------------------------------------------------------------
   3. Animated Icon Orb Container
   -------------------------------------------------------------------------- */
.spa-icon-orb-wrap {
  position: relative;
  width: 86px;
  height: 86px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spa-radar-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  animation: rotateRadar 20s linear infinite;
}

@keyframes rotateRadar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spa-pulse-core {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: floatingOrb 4s ease-in-out infinite;
}

@keyframes floatingOrb {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.spa-pulse-core svg {
  width: 34px;
  height: 34px;
}

/* Status Pill Badge */
.spa-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #e2e8f0;
}

.status-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Typography */
.spa-upgrade-title {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.6px;
  line-height: 1.22;
  margin: 0;
}

.spa-upgrade-desc {
  font-size: clamp(13.5px, 2vw, 15px);
  color: #94a3b8;
  line-height: 1.6;
  margin: 0;
  font-weight: 400;
  max-width: 540px;
}

/* Progress Bar Visualizer */
.spa-progress-box {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.spa-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}

.spa-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.spa-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
}

/* --------------------------------------------------------------------------
   4. Action Buttons & Navigation Touch Elements
   -------------------------------------------------------------------------- */
.spa-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.spa-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 9999px;
  background: #ffffff;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.22);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.spa-btn-primary:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 255, 255, 0.35);
}

.spa-btn-primary:active {
  transform: scale(0.94);
}

.spa-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
}

.spa-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.spa-btn-secondary:active {
  transform: scale(0.94);
}

/* Feature Preview Cards Grid */
.spa-feature-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.spa-feature-item {
  background: rgba(18, 20, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 20px 22px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease;
}

.spa-feature-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-3px);
}

.spa-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.spa-feature-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.spa-feature-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.spa-feature-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   5. Profile Card Specifics for "You" View
   -------------------------------------------------------------------------- */
.spa-profile-banner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
  gap: 12px;
}

.spa-profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spa-profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.spa-profile-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 2px;
}

.spa-profile-name {
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
}

.spa-profile-status {
  font-size: 11.5px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spa-profile-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

/* --------------------------------------------------------------------------
   6. SPA View: App Store (Live Catalog & Filter Engine)
   -------------------------------------------------------------------------- */
.spa-appstore-wrapper {
  width: 100%;
  max-width: 1080px;
  margin: 8px auto 40px auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0 16px;
}

.spa-appstore-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.spa-appstore-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.spa-appstore-title {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.6px;
  color: #ffffff;
  line-height: 1.2;
}

.spa-store-search-bar {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.spa-search-icon {
  position: absolute;
  left: 18px;
  width: 18px;
  height: 18px;
  stroke: #94a3b8;
  pointer-events: none;
}

.spa-store-search-input {
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  padding: 0 44px 0 48px;
  color: #ffffff;
  font-size: 16px; /* 16px prevents mobile iOS Safari auto-zoom */
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  touch-action: manipulation;
}

.spa-store-search-input:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.26);
}

.spa-store-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), 0 12px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.09);
}

.spa-store-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14.5px;
}

.spa-search-clear-btn {
  position: absolute;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.spa-search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.spa-search-clear-btn:active {
  transform: scale(0.92);
}

.spa-search-clear-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.4;
}

/* Categorized Sections Container */
.spa-store-sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 4px;
}

.store-category-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-heading {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #ffffff;
  text-transform: lowercase;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

/* Category App Tiles Grid */
.category-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 16px 12px;
}

/* Modern App Tile Card */
.app-tile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 12px 6px;
  border-radius: 20px;
  background: transparent;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
  position: relative;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-tile-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.04);
}

.app-tile-card:active {
  transform: scale(0.93);
}

.app-tile-icon-box {
  width: 66px;
  height: 66px;
  border-radius: 17px;
  overflow: hidden;
  background: #141720;
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  margin-bottom: 9px;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease, border-color 0.24s ease;
}

.app-tile-card:hover .app-tile-icon-box {
  transform: scale(1.05);
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.3);
  border-color: rgba(56, 189, 248, 0.45);
}

.app-tile-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.app-tile-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  max-width: 110px;
}

.app-tile-get-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 14px;
  height: 25px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.app-tile-card:hover .app-tile-get-btn {
  background: #38bdf8;
  color: #000000;
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

/* Empty Box */
.store-empty-box {
  text-align: center;
  padding: 50px 20px;
  color: #94a3b8;
}

.store-empty-box p {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.store-empty-box span {
  font-size: 13.5px;
  color: #64748b;
}

.spa-store-bottom-actions {
  display: flex;
  justify-content: center;
  padding: 12px 0 6px 0;
  width: 100%;
}

.spa-store-open-full-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.spa-store-open-full-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.55);
}

.spa-store-open-full-btn:active {
  transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   7. Mobile & Touch Screen Ergonomics (<640px)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .spa-upgrade-wrapper {
    margin: 10px auto 32px auto;
    padding: 0 12px;
    gap: 20px;
  }

  .spa-upgrade-card {
    padding: 24px 16px;
    border-radius: 24px;
  }

  .spa-icon-orb-wrap {
    width: 76px;
    height: 76px;
  }

  .spa-pulse-core {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .spa-pulse-core svg {
    width: 30px;
    height: 30px;
  }

  .spa-actions-row {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .spa-btn-primary,
  .spa-btn-secondary {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .spa-feature-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .spa-feature-item {
    padding: 16px 18px;
    border-radius: 18px;
  }

  .spa-appstore-wrapper {
    margin: 6px auto 32px auto;
    padding: 0 12px;
    gap: 20px;
  }

  .category-tiles-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 8px;
  }

  .app-tile-icon-box {
    width: 58px;
    height: 58px;
    border-radius: 15px;
  }

  .app-tile-title {
    font-size: 12px;
    max-width: 90px;
  }

  .spa-store-open-full-btn {
    width: 100%;
  }

  .spa-profile-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .spa-profile-banner .spa-btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .category-tiles-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 6px;
  }

  .app-tile-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .app-tile-title {
    font-size: 11.5px;
  }

  .app-tile-get-btn {
    padding: 2px 10px;
    font-size: 10px;
    height: 22px;
  }
}
