/* =========================================================
   style.css — Main stylesheet
   Theme: clean white background, green (#1DB954-ish) accent
   Mobile-first, then scaled up with media queries
   ========================================================= */

:root {
  --green: #16a34a;
  --green-dark: #0f7c39;
  --green-light: #e7f8ee;
  --ink: #14171f;
  --muted: #6b7280;
  --border: #e9ecef;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(18, 38, 24, 0.06);
  --shadow-hover: 0 10px 24px rgba(18, 38, 24, 0.12);
}

[data-bs-theme="dark"] {
  --ink: #f1f3f5;
  --muted: #9aa3af;
  --border: #2a2f3a;
  --bg: #12151c;
  --card-bg: #1a1e27;
  --green-light: #113321;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 10px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden; /* guarantees no horizontal shake/scrollbar from any
                          decorative element that might otherwise bleed
                          past the viewport edge */
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background .25s ease, color .25s ease;
  overflow-x: hidden;
  width: 100%;
}

a { color: inherit; }
a:hover { color: var(--green); }

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

/* ---------- Header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1030;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.brand-logo {
  width: 32px; height: 32px;
  object-fit: contain;
  border-radius: 8px;
  margin-right: 8px;
}

.main-nav a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  position: relative;
}
.main-nav a:hover { color: var(--green); }

.icon-btn, .menu-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover, .menu-toggle:hover { border-color: var(--green); color: var(--green); }

.search-form {
  display: flex;
  align-items: center;
  background: var(--green-light);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  width: 280px;
}
.search-form input {
  border: none; background: transparent; box-shadow: none !important;
  font-size: 0.9rem;
}
.search-form button {
  background: var(--green);
  color: #fff;
  border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.search-form-mobile {
  padding: 10px 0 14px;
  gap: 8px;
  align-items: center;
}
.search-form-mobile input { flex-grow: 1; }
.search-form-mobile button {
  background: var(--green); color: #fff; border: none; border-radius: 10px; padding: 0 16px; height: 38px; flex-shrink: 0;
}

.mobile-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
}
.mobile-nav li a:hover { color: var(--green); }
.mobile-nav li a i { width: 20px; color: var(--green); }

.mobile-nav-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 10px 4px;
  font-weight: 500;
  color: var(--ink);
  background: none; border: none;
}
.mobile-nav-toggle span:first-child { display: flex; align-items: center; gap: 10px; }
.mobile-nav-toggle span:first-child i { width: 20px; color: var(--green); }
.mobile-nav-toggle > i {
  font-size: 0.8rem;
  color: var(--ink);
  transition: transform 0.2s ease;
}
.mobile-nav-toggle[aria-expanded="true"] > i { transform: rotate(180deg); }
.mobile-nav-sub {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border, #e2e5ec);
}

/* ---------- Buttons ---------- */
.btn-brand, .btn-download {
  background: var(--green);
  border-color: var(--green);
  color: #fff !important;
  font-weight: 600;
  border-radius: 10px;
}
.btn-brand:hover, .btn-download:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}
.btn-download-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 0.65rem 1rem;
}
.btn-download-main .dl-icon-text {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.btn-download-main .dl-label {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.btn-download-main .dl-version {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
}
.btn-download-main .dl-size {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
  white-space: nowrap;
}
.btn-download-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff7a45, #ff9d5c);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(255, 122, 69, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-download-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(255, 122, 69, 0.55);
  color: #fff !important;
}
.btn-download-hero .dl-icon-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.btn-download-hero .dl-icon-text i { font-size: 1.3rem; }
.btn-download-hero .dl-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  font-size: 1.05rem;
}
.btn-download-hero .dl-version {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.9;
}
.btn-download-hero .dl-size {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-outline-brand {
  border: 1.5px solid var(--green);
  color: var(--green);
  font-weight: 600;
  border-radius: 10px;
  background: transparent;
}
.btn-outline-brand:hover { background: var(--green); color: #fff; }

/* ---------- Hero / Slider ---------- */
.hero-slider { margin-bottom: 2.5rem; }
.hero-slide {
  background: linear-gradient(120deg, var(--green) 0%, var(--green-dark) 100%);
  border-radius: 20px;
  color: #fff;
  padding: 2.5rem 1.5rem;
  height: 290px; /* FIXED (not min-height) - every slide is identical height,
                    so the auto-rotating carousel never changes page height
                    and nothing below it jumps up/down as slides change */
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}
.hero-slide::after {
  content: "";
  position: absolute; right: -40px; bottom: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
}
.hero-slide h1, .hero-slide h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
  /* Clamp to 1 line so a long app name can never grow the slide taller
     than its neighbors - this is what keeps every slide's height equal */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-slide p {
  opacity: 0.92;
  /* Clamp to 2 lines for the same reason - guarantees identical height
     regardless of how long each app's short_description is */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.carousel-indicators [data-bs-target] { background: var(--green); }

/* ---------- Section headings ---------- */
.section-title {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-head a {
  color: var(--green);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.section-title-icon {
  width: 22px; height: 22px;
  object-fit: contain;
  vertical-align: -4px;
  margin-right: 2px;
}
.category-pill {
  color: var(--green);
  background: var(--green-light);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- App Card ---------- */
.app-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
}
.app-card:hover { border-color: var(--green); box-shadow: var(--shadow-hover); }
.app-card-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 auto 0.75rem auto;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.app-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.app-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-card-meta .rating { color: #f5a623; font-weight: 600; }
.app-card-meta .dot { margin: 0 4px; }
.app-card-desc {
  font-size: 0.83rem;
  color: var(--muted);
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
  margin-bottom: 0.9rem;
}
.btn-download { padding: 0.5rem; font-size: 0.88rem; }

/* ---------- Category chips (home) ---------- */
.cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.5rem;
  height: 100%;
  transition: border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.cat-chip:hover { border-color: var(--green); color: var(--green); box-shadow: var(--shadow-hover); }
.cat-chip .cat-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}
.cat-icon img {
  width: 70%; height: 70%;
  object-fit: contain;
  border-radius: 4px;
}
.cat-chip span.name { font-size: 0.82rem; font-weight: 600; text-align: center; }

/* Category icon in mobile nav */
.mobile-nav .cat-nav-icon {
  width: 20px; height: 20px;
  object-fit: contain;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ---------- App details page ---------- */
/* Breadcrumb styling now lives in assets/css/breadcrumb.css
   (includes/breadcrumb.php reusable component). */
.app-hero {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

/* Top row: icon (left thumbnail container) + info block */
.app-hero-top {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.app-hero-info { min-width: 0; } /* allows text to wrap instead of forcing overflow */

/* Icon thumbnail container: fixed 96x96 box that perfectly centers
   its image both horizontally and vertically, with equal spacing
   on all sides no matter the image's own aspect ratio. */
.app-hero-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  flex-shrink: 0;
  margin: 0; /* no stray left/right offset */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
}
.app-hero-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* preserves aspect ratio - never stretches or crops */
  display: block;
}

.stat-box {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-right: 1px solid var(--border);
}
.stat-box:last-child { border-right: none; }
.stat-box .value { font-weight: 700; font-size: 1rem; }
.stat-box .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.screenshot-gallery img {
  border-radius: 12px;
  height: 320px;
  object-fit: cover;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.feature-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
}
.feature-list li i { color: var(--green); margin-top: 4px; }

.accordion-button:not(.collapsed) { color: var(--green); background: var(--green-light); }
.accordion-button:focus { box-shadow: none; border-color: var(--green); }

/* ---------- Download page ---------- */
.download-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}
.countdown-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  position: relative; /* anchors the ring behind the number below */
}
.countdown-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid var(--green-light);
  border-top-color: var(--green);
  animation: spin 3s linear infinite;
  /* Only this ring rotates - it's a separate layer from the number
     below, so the countdown digit itself always stays perfectly
     still instead of visibly spinning/shaking. */
}
.countdown-number {
  position: relative;
  z-index: 1; /* guarantees the number paints above the ring */
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--green);
  font-variant-numeric: tabular-nums; /* equal digit width so "9" -> "10"
                                          never causes the text to shift */
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- Telegram Join Banner (download page) ----------
   Colors are set via inline style from admin settings (gradient),
   so this only defines layout/shape/hover behavior. The hover
   scale/shadow is a small, self-contained effect on a fixed-size
   link - it can't shift surrounding page content. */
.telegram-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 60px;
  max-height: 70px;
  padding: 0.65rem 1.25rem;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  margin: 0 0 1.5rem;
  box-shadow: 0 4px 14px rgba(29, 140, 216, 0.28);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.telegram-banner:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 26px rgba(29, 140, 216, 0.42);
  color: #fff;
}
.telegram-banner-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.telegram-banner-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}
.telegram-banner-title {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.telegram-banner-subtitle {
  font-size: 0.78rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.telegram-banner-arrow {
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.telegram-banner:hover .telegram-banner-arrow {
  transform: translateX(4px);
}
@media (max-width: 480px) {
  .telegram-banner-subtitle { display: none; } /* keep the banner from feeling cramped on very small phones */
}

/* ---------- Discord Join Banner (download page) ----------
   Same layout/shape/hover behavior as the Telegram banner above,
   just under its own class name so both can render together with
   Discord's own brand-colored shadow (set via admin settings). */
.discord-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 60px;
  max-height: 70px;
  padding: 0.65rem 1.25rem;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  margin: 0 0 1.5rem;
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.28);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.discord-banner:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 26px rgba(88, 101, 242, 0.42);
  color: #fff;
}
.discord-banner-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.discord-banner-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}
.discord-banner-title {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discord-banner-subtitle {
  font-size: 0.78rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discord-banner-arrow {
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.discord-banner:hover .discord-banner-arrow {
  transform: translateX(4px);
}
@media (max-width: 480px) {
  .discord-banner-subtitle { display: none; }
}

.mirror-list .mirror-item {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.mirror-list .mirror-item:hover { border-color: var(--green); }

/* ---------- Footer ---------- */
.site-footer { background: var(--card-bg); border-top: 1px solid var(--border); margin-top: 3rem; }
.footer-heading { font-weight: 700; font-size: 0.95rem; margin-bottom: 1rem; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { text-decoration: none; color: var(--muted); font-size: 0.88rem; }
.footer-links a:hover { color: var(--green); }

.footer-bottom { border-top: 1px solid var(--border); }

/* ---------- Misc / utility ---------- */
.section { padding: 2.5rem 0; }
.badge-soft {
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
  border-radius: 8px;
}
.pagination .page-link { color: var(--ink); border-color: var(--border); }
.pagination .page-item.active .page-link { background: var(--green); border-color: var(--green); }
.pagination .page-link:hover { color: var(--green); }

.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--green-light) 37%, var(--border) 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: 8px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Quick filter pills (home page, below hero banner) ---------- */
.quick-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.25rem 0;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.filter-pill:hover { border-color: var(--green); color: var(--green); }
.filter-pill.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.filter-pill.active:hover { color: #fff; }


/* ---------- Responsive tweaks ---------- */
@media (max-width: 767.98px) {
  .hero-slide { height: 270px; padding: 1.5rem 1.25rem; text-align: center; justify-content: center; }
  .hero-slide .d-flex { justify-content: center; }
  .stat-box { border-right: none; border-bottom: 1px solid var(--border); }

  /* App details hero: stack icon above info, center everything with
     equal spacing - the icon keeps its own self-centering box from
     .app-hero-icon above, this just stacks the row and centers text. */
  .app-hero-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }
  .app-hero-icon { margin: 0 auto; }
  .app-hero-info { width: 100%; }
  .app-hero-actions { justify-content: center; }
}

@media (min-width: 992px) {
  .app-card-icon { width: 72px; height: 72px; }
}
