/* ==========================================================================
   Spac2 App Store (App Center 2.0) - Design System & UI Stylesheet
   Path: /app/css/app-store.css
   ========================================================================== */

:root {
  --primary: #2978FF;
  --primary-hover: #1555df;
  --primary-glow: rgba(41, 120, 255, 0.45);

  --bg-body: #0d0e12;
  --bg-surface: #15171f;
  --bg-surface-hover: #1e212b;
  --bg-capsule: rgba(18, 20, 28, 0.82);
  --bg-btn: #262834;
  --bg-btn-hover: #2978FF;
  
  --border: rgba(255, 255, 255, 0.06);
  --border-capsule: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.16);
  
  --text-primary: #FFFFFF;
  --text-secondary: #9499A8;
  --text-muted: #646877;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Outfit', 'Plus Jakarta Sans', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

/* Ambient Canvas Glow Background */
.ambient-glow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.2;
}

.glow-blue {
  top: -60px;
  left: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #2978FF 0%, transparent 70%);
}

.glow-purple {
  top: 400px;
  right: 15%;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
}

/* ==========================================================================
   Top Suspended / Floating Header (Dạng Treo Như Home)
   ========================================================================== */
.store-floating-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 24px 10px 24px;
}

.store-floating-capsule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-capsule);
  border: 1px solid var(--border-capsule);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  gap: 16px;
  transform-origin: center top;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.25s ease,
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  will-change: transform;
}

.store-floating-capsule.header-scrolling-compact {
  transform: scale(0.97) translateY(-2px);
  background: rgba(14, 16, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

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

.brand-avatar-box {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.brand-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.store-brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.15;
}

.store-brand-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.store-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.store-search-pill {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(180px, 22vw, 260px);
}

.search-lens-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
  pointer-events: none;
}

.store-search-input {
  width: 100%;
  height: 38px;
  background: #181a22;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 34px 0 38px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.store-search-input::placeholder {
  color: var(--text-muted);
}

.store-search-input:focus {
  border-color: var(--primary);
  background: #1c1f2a;
  box-shadow: 0 0 0 3px rgba(41, 120, 255, 0.2);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2.5;
}

.header-action-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: var(--transition);
  flex-shrink: 0;
}

.header-action-circle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.header-action-circle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* ==========================================================================
   Main Content & Categorized Sections
   ========================================================================== */
.store-main-container {
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 60px 24px;
  position: relative;
  z-index: 1;
}

.store-sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

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

.category-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  text-transform: lowercase;
}

.category-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px 14px;
}

@media (min-width: 1200px) {
  .category-tiles-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  }
}

/* ==========================================================================
   App Tile Card (Matching Reference Screenshot)
   ========================================================================== */
.app-tile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 8px 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  user-select: none;
  position: relative;
}

.app-tile-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

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

.app-tile-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 17px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-tile-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.app-tile-card:hover .app-tile-icon-box img {
  transform: scale(1.06);
}

.app-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  line-height: 1.2;
}

.app-tile-get-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-btn);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  transition: var(--transition);
}

.app-tile-card:hover .app-tile-get-btn {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.store-empty-box {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.store-empty-box p {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.store-minimal-footer {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.store-footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.store-footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.store-footer-links a:hover {
  color: #ffffff;
}

@media (max-width: 640px) {
  .store-floating-header {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 6px 14px;
  }

  .store-floating-capsule {
    padding: 6px 14px;
  }

  .store-brand-title {
    font-size: 16px;
  }
  
  .store-main-container {
    padding: 20px 14px 40px 14px;
  }

  .category-tiles-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 14px 10px;
  }

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

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

  .app-tile-get-btn {
    height: 24px;
    padding: 0 12px;
    font-size: 10.5px;
  }

  .store-minimal-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
