/* ===================================================
   AppHub — Design Tokens
   =================================================== */
:root{
  --bg:            #FAFBFE;
  --surface:       #FFFFFF;
  --border:        #ECEBED;
  --text:          #242F6C;
  --text-muted:    #6C6C6C;
  --accent:        #00A7D5;
  --accent-2:      #00DED8;
  --accent-grad:   linear-gradient(90deg, var(--accent), var(--accent-2));
  --accent-soft:   #E3F7FB;
  --accent-dark:   #057A9C;
  --radius-lg:     18px;
  --radius-md:     12px;
  --radius-sm:     8px;
  --shadow-card:   0 1px 2px rgba(20,22,43,0.04), 0 8px 24px -12px rgba(20,22,43,0.10);
  --shadow-card-hover: 0 4px 10px rgba(20,22,43,0.06), 0 16px 32px -14px rgba(0,167,213,0.22);
  --font-display:  "Space Grotesk", "Segoe UI", sans-serif;
  --font-body:     "Inter", "Segoe UI", sans-serif;
}

/* Catatan: warna kategori sekarang dipetakan langsung di script.js (CATEGORY_COLORS),
   bukan lagi lewat variabel CSS --cat-0..5, karena hanya ada 3 kategori tetap. */

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

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

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

h1, h2, h3{
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
}

a{ color: inherit; }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===================================================
   Header
   =================================================== */
.site-header{
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
}
.logo{
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  min-width: 0;
}
.logo-mark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-img{
  display: block;
  width: auto;
  height: auto;
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}
@media (max-width: 480px){
  .header-inner{ padding: 10px 16px; }
  .logo-img{ max-height: 30px; }
  .header-cta{ font-size: 0.78rem; padding: 7px 14px; }
}
.header-meta{
  font-size: 0.85rem;
  color: var(--text-muted);
}
.header-cta{
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--accent-grad);
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.header-cta:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(0,167,213,0.45);
}

/* ===================================================
   Hero
   =================================================== */
.hero{
  padding: 56px 0 40px;
  background: linear-gradient(120deg, #EAFAFF 0%, #F3F0FF 100%);
  position: relative;
  overflow: hidden;
}
.hero::after{
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C968FF, #6168F3);
  opacity: 0.12;
  pointer-events: none;
}
.hero-inner{position: relative; z-index: 1; }
.hero-eyebrow{
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
}
.hero-title{
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
}
.hero-subtitle{
  margin: 14px 0 28px;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 560px;
}

.search-bar{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  max-width: 560px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-bar:focus-within{
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-icon{ color: var(--text-muted); flex-shrink: 0; }
#search-input{
  border: none;
  outline: none;
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  background: transparent;
  color: var(--text);
}
#search-input::placeholder{ color: #9C9FB8; }

.hero-stats{
  display: flex;
  gap: 36px;
  margin: 32px 0 0;
}
.stat dt{
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.stat dd{
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-dark);
}

/* ===================================================
   Toolbar & Filter Chips
   =================================================== */
.catalog{ padding-top: 20px; padding-bottom: 80px; }

.catalog-toolbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}
.chip:hover{ border-color: var(--accent); color: var(--text); }
.chip.is-active{
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
}
.chip .chip-count{
  opacity: 0.65;
  margin-left: 4px;
}

.result-count{
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

/* ===================================================
   App Grid & Card
   =================================================== */
.app-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 900px){
  .app-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px){
  .app-grid{ grid-template-columns: 1fr; }
}

.app-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.app-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: #BEE9F2;
}

/* --- Area logo di atas kartu: background putih, garis pemisah di bawahnya --- */
.card-top{
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.app-logo{
/*  width: 52px; */
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: var(--bg);
  color: var(--text);
}
.app-logo img{
  width: auto; 
  height: 48px;
  object-fit: contain;
}

/* --- Badge kategori melayang di pojok kanan-atas, gaya badge "Trending" Edefy --- */
.app-category{
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 6px;
  text-transform: capitalize;
}

/* --- Konten di bawah area logo --- */
.card-body{
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.app-name{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 6px;
}

.app-desc{
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 8px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.more-btn{
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 16px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.more-btn:hover{ color: var(--accent-dark); }

/* ---------------------------------------------------------------------
   Modal detail aplikasi (muncul saat tombol "Lihat Detail" diklik)
   --------------------------------------------------------------------- */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 43, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden]{ display: none; }

.modal-card{
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px -10px rgba(20,22,43,0.35);
}

.modal-close{
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover{ background: var(--border); color: var(--text); }

.modal-top{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-right: 20px;
}
.modal-logo{
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  flex-shrink: 0;
  overflow: hidden;
}
.modal-logo img{ width: 100%; height: 100%; object-fit: contain; }

.modal-title{
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.modal-desc{
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 22px;
}

.app-link{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  border: none;
  background: var(--accent-grad);
  padding: 10px 14px;
  border-radius: 999px;
  margin-top: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.app-link:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(0,167,213,0.45);
}
.app-link svg{ transition: transform 0.15s ease; }
.app-link:hover svg{ transform: translate(2px, -2px); }

/* ===================================================
   Empty state
   =================================================== */
.empty-state{
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-state svg{ color: #C7CAE2; margin-bottom: 14px; }
.empty-state h3{
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 6px;
}
.empty-state p{ margin: 0 0 18px; font-size: 0.9rem; }
.btn-reset{
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.btn-reset:hover{ border-color: var(--accent); color: var(--accent); }

/* ===================================================
   Footer
   =================================================== */
.site-footer{
  border-top: 1px solid var(--border);
  padding: 22px 0;
}
.footer-inner{
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}
.footer-inner code{
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ===================================================
   Reduced motion
   =================================================== */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
  html{ scroll-behavior: auto; }
}
