/* ===== Reset & Variables ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --primary-bg: #f0fdfa;
  --accent: #f59e0b;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --transition: .25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--slate-800);
  background: var(--slate-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--slate-900);
}

.brand-icon { font-size: 1.5rem; display: flex; }

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

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  text-decoration: none;
  color: var(--slate-600);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active { color: var(--primary); background: var(--primary-bg); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--slate-700);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border-color: var(--slate-200);
}

.btn-secondary:hover { border-color: var(--primary); background: var(--primary-bg); }

.btn-lg { padding: 14px 32px; font-size: 1rem; }

.btn-sm { padding: 8px 16px; font-size: .85rem; }

.btn-full { width: 100%; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(13,148,136,.15), transparent),
    radial-gradient(ellipse 40% 50% at 80% 80%, rgba(245,158,11,.08), transparent),
    radial-gradient(ellipse 50% 60% at 20% 90%, rgba(6,182,212,.08), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 60px;
  flex-wrap: wrap;
}

.hero-text { flex: 1; min-width: 300px; }

.hero-text h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--slate-900);
}

.hero-text p {
  font-size: 1.125rem;
  color: var(--slate-500);
  max-width: 540px;
  margin-bottom: 32px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-stats {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 28px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-100);
  min-width: 120px;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label { font-size: .85rem; color: var(--slate-500); font-weight: 500; }

/* ===== Featured Section ===== */
.featured-section {
  padding: 40px 0 60px;
}

.section-header {
  text-align: center;
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 8px;
}

.section-header p { color: var(--slate-500); font-size: .95rem; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.featured-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-100);
  cursor: pointer;
  transition: var(--transition);
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.featured-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.featured-card-info { flex: 1; min-width: 0; }

.featured-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--slate-900);
  margin-bottom: 2px;
}

.featured-card-author {
  font-size: .82rem;
  color: var(--slate-400);
}

.featured-card-rating {
  font-size: .8rem;
  color: var(--accent);
}

/* ===== Apps Section ===== */
.apps-section {
  padding: 40px 0 80px;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-full);
  font-size: .95rem;
  font-family: inherit;
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}

.category-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 18px;
  border: 2px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-600);
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* ===== App Grid ===== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.app-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-100);
  transition: var(--transition);
  cursor: pointer;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.app-card-thumb {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--slate-100);
}

.app-card-thumb-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  transition: var(--transition);
}

.app-card:hover .app-card-thumb-inner { transform: scale(1.05); }

.app-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: rgba(0,0,0,.6);
  color: white;
  backdrop-filter: blur(4px);
}

.app-card-plays {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 500;
  background: rgba(0,0,0,.6);
  color: white;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-card-body {
  padding: 16px 20px 20px;
}

.app-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--slate-900);
}

.app-card-author {
  font-size: .85rem;
  color: var(--slate-400);
  margin-bottom: 8px;
}

.app-card-author span { color: var(--slate-500); font-weight: 500; }

.app-card-desc {
  font-size: .875rem;
  color: var(--slate-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--slate-100);
  font-size: .8rem;
  color: var(--slate-400);
}

.app-card-open {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
  font-size: .8rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.app-card-open:hover { background: var(--primary-dark); }

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--slate-400);
  font-size: 1.1rem;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate-400);
}

.empty-state svg { margin-bottom: 16px; }

.empty-state h3 { color: var(--slate-600); margin-bottom: 8px; }

/* ===== Stars ===== */
.stars {
  display: inline-flex;
  gap: 2px;
}

.star {
  color: var(--slate-300);
  font-size: 1rem;
}

.star.filled { color: var(--accent); }

.star.half { position: relative; }

.star.half::after {
  content: '\2605';
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  overflow: hidden;
  color: var(--accent);
}

/* ===== Detail Page ===== */
.detail-section {
  padding: 120px 0 60px;
  min-height: 80vh;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--slate-500);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 24px;
  transition: var(--transition);
}

.detail-back:hover { color: var(--primary); }

.detail-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.detail-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--slate-100);
}

.detail-icon-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
}

.detail-header-info { flex: 1; min-width: 0; }

.detail-header-info h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.detail-meta {
  font-size: .9rem;
  color: var(--slate-400);
  margin-bottom: 8px;
}

.detail-separator { margin: 0 8px; }

.detail-rating { margin-bottom: 0; }

.detail-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.detail-stat {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 28px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-100);
  flex: 1;
  min-width: 120px;
}

.detail-stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.detail-stat-label { font-size: .8rem; color: var(--slate-500); font-weight: 500; }

.detail-description {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 28px;
  border: 1px solid var(--slate-100);
  margin-bottom: 24px;
}

.detail-description h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 12px;
}

.detail-description p {
  color: var(--slate-600);
  font-size: .95rem;
  line-height: 1.7;
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-actions .btn-lg { flex: 1; min-width: 200px; }

.detail-error { padding: 60px 0; }

/* ===== Footer ===== */
.footer {
  background: var(--slate-900);
  color: var(--slate-400);
  padding: 48px 0 0;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  margin-bottom: 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--white);
}

.footer-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.footer-links a {
  color: var(--slate-400);
  text-decoration: none;
  font-size: .9rem;
  transition: var(--transition);
}

.footer-links a:hover { color: var(--primary-light); }

.footer-bottom {
  border-top: 1px solid var(--slate-700);
  padding: 20px 0;
  text-align: center;
  font-size: .85rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero-content { flex-direction: column; text-align: center; }
  .hero-text p { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-stats { width: 100%; justify-content: center; }
  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-actions { justify-content: center; }
  .detail-actions .btn-lg { min-width: 160px; }
}

@media (max-width: 768px) {
  .navbar-links { display: none; }
  .navbar-links.open {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    padding: 16px 24px;
    gap: 12px;
    box-shadow: var(--shadow);
  }
  .hamburger { display: flex; }
  .hero { min-height: auto; padding: 100px 0 60px; }
  .hero-stats { flex-wrap: wrap; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .featured-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-wrapper { max-width: none; }
}

@media (max-width: 480px) {
  .app-grid { grid-template-columns: 1fr; }
  .stat-card { min-width: 100px; padding: 16px 20px; }
  .stat-number { font-size: 1.5rem; }
  .detail-stat { padding: 16px 20px; }
  .detail-stat-number { font-size: 1.25rem; }
}
