/* === Premium Design System (Mobile First) === */
@import url('../css2');

:root {
  /* Colors */
  --bg-main: #0a0a12;
  --bg-secondary: #13131f;
  --bg-card: #1c1c2e;

  --primary: #6366f1;
  /* Indigo 500 */
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent: #06b6d4;
  /* Cyan 500 */

  --danger: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;

  --text-main: #ffffff;
  --text-muted: #94a3b8;

  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(20, 20, 30, 0.85);
  /* Slightly more opaque for mobile */

  /* Layout */
  --container-width: 1320px;
  --header-height: 60px;
  /* Mobile height default */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Fonts */
  --font-family: 'Outfit', sans-serif;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Ensure content starts below fixed header */
  padding-top: var(--header-height);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
  height: auto;
}

button {
  font-family: inherit;
}

/* === Layout Utilities === */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Add spacing for main content to prevent filter overlap */
main.container {
  padding-top: 1.5rem;
}

.section-gap {
  margin-bottom: 3rem;
}

/* === Header === */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  height: var(--header-height);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.site-header.hidden {
  transform: translateY(-100%);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo i {
  color: var(--primary);
}

/* Search Bar (Hidden on Mobile, block on Desktop) */
.header-search {
  display: none;
  width: 100%;
  max-width: 380px;
  position: relative;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 0.6rem 1.2rem 0.6rem 2.8rem;
  color: #fff;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* === Hero Section (Premium Redesign) === */
.hero-section {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

.hero-card {
  position: relative;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  aspect-ratio: 4/5;
  /* Mobile Default */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Desktop Aspect Ratio */
@media (min-width: 768px) {
  .hero-card {
    aspect-ratio: 21/9;
    flex-direction: row;
    align-items: center;
  }
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  animation: heroZoom 20s infinite alternate linear;
}

@keyframes heroZoom {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.1);
  }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  /* Gradient from bottom (mobile) or left (desktop) */
  background: linear-gradient(0deg, rgba(15, 15, 21, 1) 0%, rgba(15, 15, 21, 0.6) 50%, transparent 100%);
  z-index: 1;
}

@media (min-width: 768px) {
  .hero-overlay {
    background: linear-gradient(90deg, rgba(15, 15, 21, 1) 0%, rgba(15, 15, 21, 0.8) 40%, transparent 100%);
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 2rem;
  margin-top: auto;
  width: 100%;
  text-align: left;
  /* Glass Effect Container for Content (Optional, mainly for text readability) */
}

@media (min-width: 768px) {
  .hero-content {
    margin-top: 0;
    /* Center vertically on desktop */
    padding: 4rem;
    max-width: 60%;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.hero-badge i {
  color: var(--warning);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.1;
  color: #fff;
  /* Gradient Text */
  background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.5rem;
  }
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-meta i {
  color: var(--primary);
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), 0 10px 30px rgba(99, 102, 241, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3), 0 20px 40px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

/* === Filters (Sticky) === */
.filter-wrapper {
  position: sticky;
  top: var(--header-height);
  z-index: 900;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  /* Increased padding */
  margin-bottom: 0;
  /* Let main.container handle spacing */
  box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.5);
}

/* Mobile Search inside Filter Wrapper */
.filter-wrapper .mobile-search {
  display: block;
  position: relative;
  margin-bottom: 1rem;
}

.filter-wrapper .mobile-search .search-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem 0.75rem 2.8rem;
  color: #fff;
  font-size: 0.95rem;
}

.filter-wrapper .mobile-search .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Hide mobile search on desktop */
@media (min-width: 768px) {
  .filter-wrapper .mobile-search {
    display: none;
  }
}

/* Filter Pills Container */
.filter-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

/* Filter Pill Buttons */
.filter-pill {
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.filter-pill i {
  font-size: 0.9rem;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

/* === Grid System === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title i {
  color: var(--primary);
}

.shelf-container {
  display: grid;
  /* Mobile First: 2 Columns by default using minmax logic */
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  align-items: stretch;
  /* Equal height items */
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}

.card-img-container {
  width: 100%;
  aspect-ratio: 1;
  /* Square on mobile usually works best for icons/thumbs */
  background: #2a2a3e;
  position: relative;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  opacity: 0;
}

.card-img.loaded {
  opacity: 1;
}

.card-badge-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-family: var(--font-family);
  z-index: 5;
  background: rgba(80, 80, 80, 0.9);
  /* Default Fallback */
  backdrop-filter: blur(4px);
  letter-spacing: 0.03em;
}

.bg-mod {
  background: var(--success);
}

.bg-hot {
  background: var(--danger);
}

.bg-new {
  background: var(--primary);
}

.bg-sale {
  background: #f59e0b;
}

.bg-updated {
  background: #06b6d4;
}

.bg-premium {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #000;
}

.card-body {
  padding: 0.75rem;
  flex: 1;
  /* Grow to fill space */
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-platform {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.card-cta {
  margin-top: auto;
  /* Push to bottom */
  width: 100%;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

/* === Footer === */
.site-footer {
  margin-top: auto;
  /* Push to bottom of flex body */
  padding: 2.5rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
}

/* === Utilities === */
.hidden {
  display: none !important;
}

.d-block {
  display: block !important;
}

.d-none {
  display: none !important;
}

@media(min-width: 768px) {
  .d-md-block {
    display: block !important;
  }

  .d-md-none {
    display: none !important;
  }
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}


/* ========================================= */
/* === Tablet & Desktop Overrides (Media Queries) === */
/* ========================================= */

@media (min-width: 768px) {
  :root {
    --header-height: 70px;
    --radius-md: 16px;
  }

  /* Container padding relaxed */
  .container {
    padding: 0 2rem;
  }

  /* Header */
  .header-search {
    display: block;
  }

  .brand-logo {
    font-size: 1.5rem;
  }

  /* Hero: Landscape */
  .hero-section {
    padding-top: calc(var(--header-height) + 2rem);
  }

  .hero-card {
    aspect-ratio: 21/9;
    align-items: flex-end;
    /* Text at bottom left */
    justify-content: flex-start;
  }

  .hero-overlay {
    background: linear-gradient(0deg, rgba(10, 10, 18, 0.95) 0%, rgba(10, 10, 18, 0.5) 40%, transparent 100%);
  }

  .hero-content {
    text-align: left;
    margin-top: 0;
    max-width: 600px;
    padding: 3rem;
  }

  .hero-title {
    font-size: 3.5rem;
  }

  .hero-meta {
    justify-content: flex-start;
    font-size: 1.1rem;
  }

  .hero-btn {
    width: auto;
    font-size: 1rem;
    padding: 0.8rem 2.5rem;
  }

  /* Grid: Larger Cards */
  .shelf-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
  }

  .app-card {
    border-radius: var(--radius-md);
  }

  .card-img-container {
    aspect-ratio: 16/9;
  }

  /* Landscape images on desktop */

  .card-body {
    padding: 1.25rem;
  }

  .card-title {
    font-size: 1.1rem;
    line-clamp: 1;
    -webkit-line-clamp: 1;
  }

  .card-platform {
    font-size: 0.85rem;
  }

  .card-cta {
    padding: 0.7rem;
    font-size: 0.9rem;
  }

  /* Hover Effects (Only on desktops) */
  .app-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.5);
  }

  .app-card:hover .card-img {
    transform: scale(1.1);
  }

  .card-cta:hover {
    background: var(--primary);
    color: #fff;
  }

  .filter-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .hero-btn:hover {
    background: #5558e6;
    transform: translateY(-3px);
    box-shadow: 0 12px 25px -8px rgba(99, 102, 241, 0.5);
  }
}

@media (min-width: 1200px) {

  /* Large Screens */
  .hero-title {
    font-size: 4rem;
  }
}