/* Zinley App Share — giao diện kiểu Play Store, mobile-first */

:root {
  --bg: #ffffff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #e8eaed;
  --line-strong: #dadce0;
  --green: #01875f;
  --green-press: #016b4c;
  --green-tint: #e6f4ee;
  --chip-new: #1a73e8;
  --chip-new-bg: #e8f0fe;
  --chip-fix: #c5221f;
  --chip-fix-bg: #fce8e6;
  --chip-imp: #01875f;
  --chip-imp-bg: #e6f4ee;
  --danger: #c5221f;

  --font: "Google Sans", "Google Sans Text", Roboto, system-ui, -apple-system, sans-serif;
  --mono: Roboto Mono, ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314;
    --ink: #e8eaed;
    --muted: #9aa0a6;
    --line: #2d2f31;
    --line-strong: #3c4043;
    --green: #00a173;
    --green-press: #00875f;
    --green-tint: #10281f;
    --chip-new: #8ab4f8;
    --chip-new-bg: #1c2a3d;
    --chip-fix: #f28b82;
    --chip-fix-bg: #3a2220;
    --chip-imp: #4ecca3;
    --chip-imp-bg: #10281f;
    --danger: #f28b82;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 24px 110px;
  flex: 1;
}

.state-msg {
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
  font-size: 0.9rem;
}

.state-msg.error { color: var(--danger); }

/* ---------- Header: icon + tên app ---------- */

.store-header {
  display: flex;
  gap: 20px;
  align-items: center;
}

.app-icon {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.store-header h1 {
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
}

.store-header .dev {
  color: var(--green);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 2px;
}

.store-header .pkg {
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--mono);
  margin-top: 4px;
  word-break: break-all;
}

/* ---------- Dải thông số ---------- */

.stats-strip {
  display: flex;
  align-items: stretch;
  margin: 24px 0 20px;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 2px 8px;
  border-right: 1px solid var(--line-strong);
}

.stat:last-child { border-right: none; }

.stat .value {
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
}

.stat .label {
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 2px;
}

/* ---------- Nút cài đặt ---------- */

.btn-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  background: var(--green);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-install:hover { background: var(--green-press); }
.btn-install:active { transform: scale(0.99); }

.btn-install:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn-install .size { font-weight: 400; opacity: 0.85; font-size: 0.88rem; }

.btn-install.disabled {
  background: var(--line);
  color: var(--muted);
  pointer-events: none;
}

/* ---------- Hàng nút phụ (chia sẻ / phiên bản khác) ---------- */

.quick-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 4px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.text-btn:hover { background: var(--green-tint); }

.text-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

/* ---------- Dòng thông báo (không phải Android) ---------- */

.info-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 14px 2px 2px;
}

.info-row svg { flex: none; margin-top: 2px; }

.info-row strong { color: var(--ink); font-weight: 500; }

/* ---------- Screenshots ---------- */

.shots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 22px -24px 0;
  padding: 2px 24px 8px;
  scrollbar-width: none;
}

.shots::-webkit-scrollbar { display: none; }

.shots img {
  height: 320px;
  width: auto;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  flex: none;
}

/* ---------- Section ---------- */

.sect {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 500;
  margin: 34px 0 12px;
}

.sect .when {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
}

.desc { color: var(--muted); max-width: 60ch; }

/* ---------- Có gì mới / ghi chú ---------- */

.notes { display: grid; gap: 8px; }

.note-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 0.92rem;
  color: var(--muted);
}

.note-tag {
  flex: none;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  transform: translateY(-1px);
  white-space: nowrap;
}

.note-tag.new { color: var(--chip-new); background: var(--chip-new-bg); }
.note-tag.fixed { color: var(--chip-fix); background: var(--chip-fix-bg); }
.note-tag.improved { color: var(--chip-imp); background: var(--chip-imp-bg); }

/* ---------- Thông tin ứng dụng ---------- */

.info-table { border-top: 1px solid var(--line); }

.info-table .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.info-table .row .k { color: var(--muted); flex: none; }

.info-table .row .v {
  text-align: right;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.info-table .row .v.plain { font-family: var(--font); font-size: 0.88rem; }

.info-table .row .v button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  border-bottom: 1px dotted var(--muted);
  cursor: pointer;
  padding: 0;
  word-break: break-all;
  text-align: right;
}

.info-table .row .v button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Các phiên bản trước ---------- */

.history { display: grid; gap: 10px; }

.history-item {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
}

.history-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-head .ver { font-weight: 500; font-size: 1rem; }

.history-head .sub {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 1px;
}

.history-head .spacer { flex: 1; }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-tint);
  color: var(--green);
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 9px 16px;
  min-height: 38px;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-mini:hover { filter: brightness(0.96); }
.btn-mini:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

.history-item .notes { margin-top: 10px; }
.history-item .note-item { font-size: 0.86rem; }
.history-item .unavailable { color: var(--muted); font-size: 0.78rem; }

/* ---------- Hướng dẫn cài đặt ---------- */

.guide { display: grid; gap: 12px; }

.guide-step { display: flex; gap: 14px; align-items: baseline; }

.guide-step .num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(5px);
}

.guide-step p { font-size: 0.9rem; color: var(--muted); }
.guide-step p strong { color: var(--ink); font-weight: 500; }

/* ---------- Thanh cài đặt dính đáy (mobile) ---------- */

.sticky-install {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(0);
  transition: transform 0.25s ease;
  z-index: 10;
}

.sticky-install[hidden] { display: none; }
.sticky-install.off { transform: translateY(110%); }

.sticky-install .mini-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex: none;
}

.sticky-install .btn-install { flex: 1; min-height: 44px; }

@media (min-width: 720px) {
  .sticky-install { display: none; }
  main { padding-bottom: 56px; }
}

/* ---------- Footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  text-align: center;
}

.foot p { font-size: 0.72rem; color: var(--muted); }

/* ---------- Khác ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
