/* App Pricing Lab — App Store Intelligence | Powered by Monetai */

/* Prevent CLS from font loading — use system fonts as fallback with matching metrics */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: local('Inter');
  size-adjust: 100%;
}

:root {
  --bg: #08080d;
  --bg-card: #0f0f18;
  --bg-card-hover: #14142a;
  --bg-surface: #111120;
  --border: #1e1e35;
  --border-bright: #2d2d55;
  --text: #eaeaf0;
  --text-muted: #7e7ea0;
  --text-dim: #5a5a78;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-glow: rgba(124,58,237,0.25);
  --accent-soft: rgba(124,58,237,0.08);
  --green: #10b981;
  --green-soft: rgba(16,185,129,0.12);
  --red: #f43f5e;
  --red-soft: rgba(244,63,94,0.12);
  --yellow: #f59e0b;
  --yellow-soft: rgba(245,158,11,0.12);
  --blue: #3b82f6;
  --blue-soft: rgba(59,130,246,0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Accessibility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; padding: 8px 16px; background: var(--accent); color: white; border-radius: var(--radius); z-index: 200; font-weight: 600; }

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

a { color: var(--accent-hover); text-decoration: none; transition: color 0.15s; }
a:hover { color: #a78bfa; }

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

/* --- Nav --- */
.nav { background: rgba(15,15,24,0.85); border-bottom: 1px solid var(--border); padding: 14px 0; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.25rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; }
.logo-icon { color: var(--accent); font-size: 1.4rem; filter: drop-shadow(0 0 6px var(--accent-glow)); }
.nav-links { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; padding: 6px 14px; border-radius: 6px; transition: all 0.15s; }
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }
.nav-links a.active { color: white; background: var(--accent); }

/* --- Main --- */
.main { padding: 32px 0 80px; min-height: 80vh; }

/* --- Footer --- */
.footer { border-top: 1px solid var(--border); padding: 40px 0; text-align: center; }
.footer-brand { color: var(--accent-hover); font-weight: 700; font-size: 1rem; }
.footer-brand:hover { color: #a78bfa; }
.footer p { color: var(--text-muted); font-size: 0.85rem; }
.footer-sub { font-size: 0.75rem; margin-top: 6px; color: var(--text-dim); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-top: 12px; }
.footer-links a { color: var(--text-dim); font-size: 0.8rem; }
.footer-links a:hover { color: var(--accent-hover); }

/* --- Hero --- */
.hero { text-align: center; padding: 56px 0 40px; position: relative; }
.hero::before { content: ''; position: absolute; top: -60px; left: 50%; transform: translateX(-50%); width: 600px; height: 400px; background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%); pointer-events: none; opacity: 0.5; }
.hero h1 { font-size: 3rem; font-weight: 900; letter-spacing: -0.03em; background: linear-gradient(135deg, #a78bfa, var(--accent), #60a5fa, #a78bfa); background-size: 300% 300%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 16px; animation: gradient-shift 8s ease infinite; line-height: 1.15; position: relative; }
@keyframes gradient-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero-sub { font-size: 1.15rem; color: var(--text-muted); max-width: 620px; margin: 0 auto 28px; line-height: 1.7; }
.hero-sub strong { color: var(--text); font-weight: 600; }

/* --- Search --- */
.search-form { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; position: relative; }
.search-input { flex: 1; padding: 14px 18px; border: 1px solid var(--border-bright); border-radius: var(--radius); background: var(--bg-card); color: var(--text); font-size: 0.95rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--text-dim); }
.search-meta { color: var(--text-muted); margin: 20px 0 8px; font-size: 0.9rem; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 22px; background: var(--accent); color: white; border-radius: var(--radius); font-weight: 600; border: none; cursor: pointer; font-size: 0.9rem; transition: all 0.15s; box-shadow: 0 2px 8px var(--accent-glow); }
.btn:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); box-shadow: none; }
.btn-sm:hover { background: var(--bg-card-hover); color: var(--text); border-color: var(--border-bright); transform: none; }
.btn-sm.active { background: var(--accent); color: white; border-color: var(--accent); }

/* --- Stats Grid --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 32px 0; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 24px; text-align: center; transition: border-color 0.2s; }
.stat-card:hover { border-color: var(--border-bright); }
.stat-number { font-size: 2.2rem; font-weight: 900; color: var(--accent-hover); letter-spacing: -0.02em; text-shadow: 0 0 30px var(--accent-glow); }
.stat-label { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

/* --- Feature Grid --- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 32px 0; }
.feature-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: all 0.2s; position: relative; overflow: hidden; }
.feature-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0; transition: opacity 0.3s; }
.feature-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.feature-card:hover::before { opacity: 1; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); font-weight: 700; }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }

/* --- Two Column --- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 40px 0; }
.two-col h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* --- Category Links --- */
.category-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.category-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 20px; font-size: 0.82rem; color: var(--text-muted); transition: all 0.15s; }
.category-link:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-soft); }
.category-link .count { color: var(--text-dim); font-size: 0.72rem; font-weight: 500; }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-bright); color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.table tr { transition: background 0.1s; }
.table tr:hover td { background: var(--bg-card); }

/* --- App Card --- */
.app-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); transition: background 0.1s; border-radius: var(--radius); margin-bottom: 2px; }
.app-card:hover { background: var(--bg-card); }
.rank { font-size: 0.85rem; font-weight: 800; color: var(--text-dim); min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.app-card-icon img { border-radius: 14px; display: block; box-shadow: var(--shadow-sm); }
.icon-placeholder { width: 48px; height: 48px; background: var(--bg-surface); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.app-card-info { flex: 1; min-width: 0; }
.app-title { font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.app-title:hover { color: var(--accent-hover); }
.app-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.app-meta span { font-size: 0.78rem; color: var(--text-dim); }
.store-badge { font-size: 0.85rem !important; }
.app-stats { display: flex; gap: 10px; margin-top: 4px; align-items: center; }
.app-stats span { font-size: 0.78rem; color: var(--text-muted); }
.stars { color: var(--yellow) !important; letter-spacing: -1px; }
.iap-badge { background: var(--yellow-soft); color: var(--yellow); padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 0.68rem !important; letter-spacing: 0.03em; }
.price-badge { background: var(--blue-soft); color: var(--blue); padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 0.68rem !important; }

/* --- Badges --- */
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; background: var(--bg-surface); border: 1px solid var(--border); margin: 2px; }
.badge-green { background: var(--green-soft); color: var(--green); border-color: rgba(16,185,129,0.25); }
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(59,130,246,0.25); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); border-color: rgba(245,158,11,0.25); }
.badge-gray { background: var(--bg-surface); color: var(--text-dim); }

/* --- Change Badges --- */
.change-badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.change-badge.price_increased { background: var(--red-soft); color: var(--red); }
.change-badge.price_decreased { background: var(--green-soft); color: var(--green); }
.change-badge.added { background: var(--blue-soft); color: var(--blue); }
.change-badge.removed { background: rgba(90,90,120,0.15); color: var(--text-dim); }

/* --- Rankings Layout --- */
.rankings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-top: 24px; }
@media (max-width: 768px) { .rankings-layout { grid-template-columns: 1fr; } }
.sidebar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; height: fit-content; position: sticky; top: 76px; max-height: 80vh; overflow-y: auto; }
.sidebar h3 { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 12px; }
.category-nav { display: flex; flex-direction: column; gap: 2px; }
.category-nav a { padding: 7px 12px; border-radius: 6px; font-size: 0.83rem; color: var(--text-muted); transition: all 0.1s; }
.category-nav a:hover { background: var(--bg-card-hover); color: var(--text); }
.category-nav a.active { background: var(--accent); color: white; font-weight: 600; }

/* --- Filters --- */
.filters { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; }
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 0.82rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* --- Page Header --- */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* --- App Detail --- */
.app-detail-header { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.app-icon-large img { border-radius: 22px; display: block; box-shadow: var(--shadow-md); }
.icon-placeholder-lg { width: 96px; height: 96px; background: var(--bg-surface); border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.app-detail-info h1 { font-size: 1.8rem; margin-bottom: 4px; font-weight: 800; letter-spacing: -0.02em; }
.developer-name { color: var(--text-muted); margin-bottom: 10px; }
.app-badges { display: flex; flex-wrap: wrap; gap: 4px; }

.app-stats-row { display: flex; gap: 12px; margin: 24px 0; }
.stat-box { flex: 1; text-align: center; padding: 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.stat-big { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.stat-sub { font-size: 0.72rem; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 640px) { .app-stats-row { flex-wrap: wrap; } .stat-box { flex: 1 1 45%; } }

/* --- Sections --- */
.section { margin: 36px 0; }
.section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* --- Screenshots --- */
.screenshots-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }
.screenshot { height: 400px; border-radius: var(--radius-lg); border: 1px solid var(--border); scroll-snap-align: start; }

/* --- Description --- */
.description { color: var(--text-muted); white-space: pre-wrap; line-height: 1.7; font-size: 0.9rem; max-height: 400px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

/* --- Developer Info --- */
.dev-info { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.dev-info p { margin: 6px 0; font-size: 0.9rem; }

/* --- IAP Grid --- */
.iap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.iap-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; justify-content: space-between; align-items: center; transition: border-color 0.15s; }
.iap-card:hover { border-color: var(--border-bright); }
.iap-name { font-size: 0.88rem; font-weight: 500; }
.iap-price { font-family: var(--mono); font-weight: 700; color: var(--accent-hover); font-size: 0.95rem; }

/* --- Timeline --- */
.timeline { border-left: 2px solid var(--border); padding-left: 24px; }
.timeline-item { margin-bottom: 20px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -29px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-bright); border: 2px solid var(--bg); }
.timeline-item.price_increased::before { background: var(--red); box-shadow: 0 0 8px var(--red-soft); }
.timeline-item.price_decreased::before { background: var(--green); box-shadow: 0 0 8px var(--green-soft); }
.timeline-item.added::before { background: var(--blue); box-shadow: 0 0 8px var(--blue-soft); }
.timeline-date { font-size: 0.72rem; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
.timeline-content { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.price-change { font-family: var(--mono); color: var(--text-muted); font-size: 0.88rem; }

/* --- CTA Box --- */
.cta-box { background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(96,165,250,0.06)); border: 1px solid rgba(124,58,237,0.2); border-radius: var(--radius-lg); padding: 32px; text-align: center; }
.cta-box h3 { color: var(--accent-hover); font-size: 1.15rem; font-weight: 700; }
.cta-box p { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state h1, .empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }
.empty { text-align: center; color: var(--text-muted); padding: 48px 0; }

/* --- App Mini --- */
.app-mini { display: flex; gap: 16px; align-items: center; }
.app-mini img { border-radius: 14px; box-shadow: var(--shadow-sm); }
.app-mini h1 { font-size: 1.5rem; font-weight: 800; }
.app-mini p { color: var(--text-muted); }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 32px 0; }
.page-info { color: var(--text-muted); font-size: 0.88rem; }

/* --- Utilities --- */
.categories-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font-family: var(--mono); font-weight: 700; }

/* --- Related Apps --- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.related-app { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.15s; color: var(--text); }
.related-app:hover { border-color: var(--accent); background: var(--bg-card-hover); color: var(--text); }
.related-app img { border-radius: 10px; flex-shrink: 0; }
.related-title { font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.related-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* --- Breadcrumb --- */
.breadcrumb { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-hover); }
.bc-sep { margin: 0 6px; color: var(--text-dim); opacity: 0.5; }

/* --- FAQ --- */
.faq h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); margin: 20px 0 6px; }
.faq h3:first-child { margin-top: 0; }
.faq p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; }

/* --- Comparison Page --- */
.compare-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.compare-table th { text-align: left; padding: 12px 16px; color: var(--text-dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; border-bottom: 1px solid var(--border-bright); }
.compare-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: top; }
.compare-table .winner { color: var(--green); font-weight: 700; }
.compare-vs { font-size: 1.5rem; font-weight: 900; color: var(--text-dim); background: var(--bg-card); border: 1px solid var(--border); border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Compare links */
.compare-links { display: flex; flex-wrap: wrap; gap: 8px; }
.compare-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; color: var(--text-muted); transition: all 0.15s; }
.compare-link:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-soft); }
.compare-link img { border-radius: 6px; flex-shrink: 0; }

/* Report Stats */
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 24px 0; }

/* --- Alert Form --- */
.alert-form .search-input { font-size: 0.9rem; }

/* --- Success Banner --- */
.success-banner { background: var(--green-soft); border: 1px solid rgba(16,185,129,0.3); color: var(--green); padding: 12px 20px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; text-align: center; margin-bottom: 24px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { gap: 2px; }
  .nav-links a { padding: 6px 10px; font-size: 0.8rem; }
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }
  .search-form { flex-direction: column; }
  .app-detail-header { flex-direction: column; align-items: center; text-align: center; }
  .sidebar { display: none; }
  .rankings-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 1.6rem; }
  .stat-number { font-size: 1.6rem; }
  .nav-links a { padding: 6px 8px; font-size: 0.75rem; }
}
