/* ========================================
   AppCentral — Main Stylesheet
   Clean, modern app directory design
   ======================================== */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #10b981;
  --accent-dark: #059669;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* --- Header --- */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.main-nav { display: flex; align-items: center; gap: 4px; }

.main-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-light);
  transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 50%, #db2777 100%);
  color: white;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 32px;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  background: rgba(255,255,255,0.95);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  outline: none;
}

.search-box input::placeholder { color: var(--text-lighter); }

.search-box .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

/* --- Tag Navigation --- */
.tag-nav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  overflow-x: auto;
}

.tag-nav-inner {
  display: flex;
  gap: 8px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.tag-pill {
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--border-light);
  color: var(--text-light);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.tag-pill:hover,
.tag-pill.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* --- Section Titles --- */
.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .icon { font-size: 1.4rem; }

.section-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-top: -16px;
  margin-bottom: 24px;
}

/* --- App Card Grid --- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.app-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

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

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.app-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.app-card-header .developer {
  font-size: 0.8rem;
  color: var(--text-light);
}

.app-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
}

.app-rating .star { color: #f59e0b; }

.app-card-desc {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-top: 8px;
  flex-grow: 1;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.app-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--border-light);
  color: var(--text-lighter);
  border-radius: 50px;
  font-weight: 600;
}

/* --- Category Grid --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

.category-card {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.category-card .cat-icon { font-size: 2rem; margin-bottom: 8px; }
.category-card .cat-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }

/* --- Trust Badges --- */
.trust-section {
  padding: 48px 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  text-align: center;
}

.trust-item .trust-icon { font-size: 2.5rem; margin-bottom: 12px; }
.trust-item h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.trust-item p { font-size: 0.9rem; color: var(--text-light); line-height: 1.5; }

/* --- Best App For Section --- */
.best-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.best-app-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
}

.best-app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.best-app-card .baf-icon { font-size: 2.2rem; flex-shrink: 0; }
.best-app-card h3 { font-size: 1rem; font-weight: 700; }
.best-app-card p { font-size: 0.82rem; color: var(--text-light); margin-top: 4px; }

/* --- App Detail Page --- */
.app-detail-hero {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
}

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

.app-detail-icon {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.app-detail-info h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.app-detail-info .developer {
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
}

.app-meta-row {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.app-meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
}

.app-meta-item .meta-val { font-weight: 700; font-size: 1rem; }
.app-meta-item .meta-label { font-size: 0.75rem; color: var(--text-light); }

.download-btns {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-google { background: #1a73e8; color: white; }
.btn-google:hover { background: #1557b0; color: white; }
.btn-apple { background: #000; color: white; }
.btn-apple:hover { background: #333; color: white; }

/* --- Content Layout --- */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  padding: 40px 0;
}

.main-content section { margin-bottom: 36px; }

.main-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.main-content .description {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}

.main-content .description p { margin-bottom: 16px; }

/* Features List */
.features-list { list-style: none; }

.features-list li {
  padding: 10px 0 10px 28px;
  position: relative;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-light);
}

.features-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* Pros / Cons */
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.pros-box, .cons-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
}

.pros-box { border-left: 4px solid var(--accent); }
.cons-box { border-left: 4px solid #ef4444; }

.pros-box h3 { color: var(--accent-dark); margin-bottom: 12px; font-size: 1rem; }
.cons-box h3 { color: #dc2626; margin-bottom: 12px; font-size: 1rem; }

.pros-box li, .cons-box li {
  font-size: 0.9rem;
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
  list-style: none;
}

.pros-box li::before { content: "👍"; position: absolute; left: 0; font-size: 0.8rem; }
.cons-box li::before { content: "👎"; position: absolute; left: 0; font-size: 0.8rem; }

/* Reviews */
.review-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.review-user {
  font-weight: 700;
  font-size: 0.95rem;
}

.review-date {
  font-size: 0.8rem;
  color: var(--text-lighter);
}

.review-stars {
  color: #f59e0b;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.review-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

/* Sidebar */
.sidebar .widget {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.sidebar .widget h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar .app-info-table { width: 100%; font-size: 0.88rem; }

.sidebar .app-info-table tr { border-bottom: 1px solid var(--border-light); }

.sidebar .app-info-table td {
  padding: 8px 0;
}

.sidebar .app-info-table td:first-child {
  color: var(--text-light);
  font-weight: 600;
  width: 100px;
}

/* Similar Apps (sidebar) */
.similar-app-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.similar-app-item:last-child { border-bottom: none; }

.similar-app-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.similar-app-item h4 { font-size: 0.88rem; font-weight: 600; }
.similar-app-item .rating { font-size: 0.78rem; color: var(--text-lighter); }

/* --- Ad Placeholder --- */
.ad-placeholder {
  background: var(--border-light);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  color: var(--text-lighter);
  font-size: 0.85rem;
  margin: 20px 0;
}

.ad-placeholder.ad-banner { min-height: 90px; }
.ad-placeholder.ad-rectangle { min-height: 250px; }
.ad-placeholder.ad-leaderboard { min-height: 90px; }

/* --- Best App For Detail Page --- */
.baf-hero {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: white;
  padding: 48px 0;
  text-align: center;
}

.baf-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.baf-hero p {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 700px;
  margin: 0 auto;
}

.baf-hero .updated {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 12px;
}

.ranking-list { max-width: 800px; margin: 0 auto; }

.ranking-item {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  gap: 20px;
  transition: all 0.2s;
}

.ranking-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.rank-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
  color: white;
}

.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.rank-2 { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.rank-3 { background: linear-gradient(135deg, #d97706, #92400e); }
.rank-default { background: var(--primary); }

.ranking-content { flex-grow: 1; }
.ranking-content h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }

.ranking-content .rank-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f59e0b;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.ranking-content .rank-desc {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
}

.ranking-content .rank-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.rank-link {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
  background: var(--border-light);
  color: var(--text-light);
  transition: all 0.2s;
}

.rank-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* --- Category Page --- */
.category-hero {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
}

.category-hero h1 {
  font-size: 2rem;
  font-weight: 800;
}

.category-hero .app-count {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* --- Footer --- */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand .logo {
  color: white;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.footer-brand .logo span { color: #60a5fa; }

.footer-brand p {
  font-size: 0.88rem;
  line-height: 1.6;
}

.footer-links h4 {
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links ul { list-style: none; }

.footer-links li { margin-bottom: 8px; }

.footer-links a {
  color: #94a3b8;
  font-size: 0.88rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.footer-bottom .ssl-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 12px 0;
  font-size: 0.85rem;
  color: var(--text-lighter);
}

.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { margin: 0 8px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .content-layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .hero { padding: 40px 0; }

  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    box-shadow: var(--shadow-md);
  }
  .mobile-menu-btn { display: block; }

  .trust-grid { grid-template-columns: 1fr; gap: 24px; }
  .pros-cons { grid-template-columns: 1fr; }
  .app-detail-header { flex-direction: column; }
  .app-meta-row { gap: 10px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }

  .ranking-item { flex-direction: column; align-items: flex-start; }
  .baf-hero h1 { font-size: 1.8rem; }

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

@media (max-width: 480px) {
  .app-grid { grid-template-columns: 1fr; }
  .best-app-grid { grid-template-columns: 1fr; }
  .download-btns { flex-direction: column; }
  .btn-download { justify-content: center; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }
.pt-40 { padding-top: 40px; }
.pb-40 { padding-bottom: 40px; }

.btn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 28px;
  border-radius: 50px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-more:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); }

.view-all-link {
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
