/* appDetail.css */

/* ── page wrapper ── */
.app-detail-page { padding-top: 32px; padding-bottom: 64px; }

/* ── two-column layout ── */
.ad-layout {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}
.ad-main {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.ad-sidebar {
  width: 300px;
  flex-shrink: 0;
}

/* ── section headings ── */
.ad-section-title {
  font-family: var(--FontTitle);
  font-size: 20px;
  font-weight: 700;
  color: var(--TextPrimary);
  margin: 0 0 16px;
  padding: 8px 0 0;
  line-height: 1.3;
}
.ad-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.ad-section-hd .ad-section-title { margin-bottom: 0; }
.ad-section-more {
  font-size: 13px;
  color: var(--Theme);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.ad-section-more:hover { text-decoration: underline; }

/* ── hero card ── */
.ad-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 24px;
}
.ad-hero__safe {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #2563EB;
  border: 1px solid #2563EB;
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}
.ad-hero__icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--BgAlt);
}
.ad-hero__info {
  flex: 1;
  min-width: 0;
}
.ad-hero__name {
  font-family: var(--FontTitle);
  font-size: 24px;
  font-weight: 800;
  color: var(--TextPrimary);
  line-height: 1.2;
  margin: 0 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-hero__dev {
  font-size: 14px;
  color: var(--TextSecondary);
  margin: 0 0 12px;
}
.ad-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ad-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--TextSecondary);
  background: var(--BgAlt);
  border: 1px solid var(--BorderMid);
  border-radius: 20px;
  padding: 3px 10px;
}
.ad-hero__badge--star {
  color: #92400E;
  background: #FEF3C7;
  border-color: #FDE68A;
}
.ad-hero__badge--safe {
  color: #065F46;
  background: #ECFDF5;
  border-color: #A7F3D0;
}

/* ── download ── */
.ad-download { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.ad-download__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
}
.ad-download__btn--disabled {
  background: var(--BorderMid) !important;
  color: var(--TextMuted) !important;
  box-shadow: none !important;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── store buttons ── */
.ad-store-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ad-store-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 140px;
  padding: 11px 20px;
  background: #1A202C;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.ad-store-btn:hover { opacity: 0.85; }
.ad-store-btn--ios { background: #1a1a1a; }
.ad-store-btn--disabled {
  background: var(--BgAlt);
  color: var(--TextMuted);
  border: 1px solid var(--BorderMid);
  cursor: not-allowed;
  pointer-events: none;
}
/* PC: download + store buttons on one row */
@media (min-width: 768px) {
  .ad-download { flex-direction: row; align-items: stretch; }
  .ad-download__btn { flex: 1; }
  .ad-store-btns { flex: 2; flex-wrap: nowrap; }
}

/* ── about / description ── */
.ad-about {
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 20px 24px;
}
.ad-about__content {
  font-size: 15px;
  color: var(--TextPrimary);
  line-height: 1.7;
}
.ad-about__content h2, .ad-about__content h3, .ad-about__content h4 { font-family: var(--FontTitle); margin: 12px 0 6px; }
.ad-about__content p, .ad-about__content li { margin: 0 0 10px; }

/* ── ad slot ── */
.ad-slot-wrap { padding: 4px 0; }

/* ── info table ── */
.ad-info-section {
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 20px 24px 8px;
}
.ad-info-grid { display: flex; flex-direction: column; }
.ad-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--Border);
}
.ad-info-row:last-child { border-bottom: none; }
.ad-info-row__label {
  font-size: 13px;
  color: var(--TextSecondary);
  font-weight: 500;
  flex-shrink: 0;
}
.ad-info-row__value {
  font-size: 13px;
  color: var(--TextPrimary);
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-info-row__value--link {
  color: var(--Theme);
  text-decoration: none;
}
.ad-info-row__value--link:hover { text-decoration: underline; }
.ad-info-row__value--safe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #065F46;
}
/* PC: lay info out in columns (~2 rows) */
@media (min-width: 768px) {
  .ad-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 32px;
    row-gap: 0;
  }
  .ad-info-row {
    justify-content: flex-start;
    gap: 8px;
    border-bottom: none;
    padding: 8px 0;
  }
  .ad-info-row__value {
    text-align: left;
    flex: 1;
    min-width: 0;
  }
}

/* ── screenshots ── */
.ad-screenshots__wrap { position: relative; overflow: hidden; }
.ad-screenshots__track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ad-screenshots__track::-webkit-scrollbar { display: none; }
.ad-screenshots__img {
  width: 160px;
  height: 280px;
  aspect-ratio: 9/16;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--BgAlt);
}
.ad-screenshots__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--BorderMid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--CardShadow);
  color: var(--TextPrimary);
  z-index: 2;
}
.ad-screenshots__btn--prev { left: 0; }
.ad-screenshots__btn--next { right: 0; }
.ad-screenshots__btn[disabled] { opacity: 0.3; cursor: default; }

/* ── similar apps grid (download-page card style) ── */
.ad-app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ad-app-grid > * { min-width: 0; }
.ad-sim-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--CardBg);
  border: 1px solid var(--Border);
  border-radius: var(--CardRadius);
  text-decoration: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}
.ad-sim-card:hover {
  box-shadow: var(--CardShadowHover);
  transform: translateY(-2px);
}
.ad-sim-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--BgAlt);
}
.ad-sim-card__info { flex: 1; min-width: 0; width: 100%; }
.ad-sim-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--TextPrimary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 0 4px;
}
.ad-sim-card__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 2px;
}
.ad-sim-card__rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--TextSecondary);
}
.ad-sim-card__dl { font-size: 11px; color: var(--TextMuted); }
.ad-sim-card__cat {
  font-size: 11px;
  color: var(--TextMuted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-sim-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--Theme);
  border: 1.5px solid var(--Theme);
  border-radius: 20px;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
  width: 100%;
}
.ad-sim-card:hover .ad-sim-card__btn {
  background: var(--ThemeGradient);
  color: #fff;
  border-color: transparent;
}

/* ── rating summary ── */
.ad-rating-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--BgAlt);
  border-radius: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ad-rating-summary__score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}
.ad-rating-summary__score strong {
  font-size: 48px;
  font-family: var(--FontTitle);
  font-weight: 800;
  color: var(--TextPrimary);
  line-height: 1;
}
.ad-rating-summary__stars { display: flex; gap: 2px; }
.ad-rating-summary__count { font-size: 13px; color: var(--TextSecondary); }
.ad-rating-summary__bars {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ad-rating-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ad-rating-bar__num {
  font-size: 12px;
  color: var(--TextSecondary);
  min-width: 10px;
  text-align: right;
}
.ad-rating-bar__track {
  flex: 1;
  height: 7px;
  background: var(--BorderMid);
  border-radius: 4px;
  overflow: hidden;
}
.ad-rating-bar__fill {
  height: 100%;
  background: var(--Theme);
  border-radius: 4px;
}

/* ── sidebar ── */
.ad-sidebar__panel {
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 20px;
  position: sticky;
  top: 80px;
}
.ad-sidebar__tabs {
  display: flex;
  border-bottom: 1px solid var(--BorderMid);
  margin-bottom: 4px;
}
.ad-sidebar__tab {
  height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--TextSecondary);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  font-family: var(--FontBody);
  transition: color 0.2s ease;
}
.ad-sidebar__tab.is-active { color: var(--Theme); }
.ad-sidebar__tab.is-active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--Theme);
  border-radius: 2px 2px 0 0;
}
.ad-sidebar__list { display: flex; flex-direction: column; padding: 8px 0; }
.ad-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--Border);
  text-decoration: none;
}
.ad-sidebar__item:last-child { border-bottom: none; }
.ad-sidebar__item:hover .ad-sidebar__name { color: var(--Theme); }
.ad-sidebar__icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--BgAlt);
}
.ad-sidebar__info { flex: 1; min-width: 0; }
.ad-sidebar__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--TextPrimary);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.ad-sidebar__meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.ad-sidebar__rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--TextSecondary);
}
.ad-sidebar__cat {
  font-size: 12px;
  color: var(--TextMuted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── responsive ── */
@media (max-width: 1023px) {
  .ad-sidebar { display: none; }
  .ad-layout { gap: 0; }
}
@media (max-width: 767px) {
  .app-detail-page { padding-top: 20px; padding-bottom: 48px; }
  .ad-hero { padding: 16px; gap: 12px; align-items: center; }
  .ad-hero__icon { width: 64px; height: 64px; border-radius: 14px; }
  .ad-hero__info { padding-right: 80px; }
  .ad-hero__name { font-size: 16px; margin-bottom: 8px; }
  .ad-hero__safe { top: 10px; right: 10px; font-size: 11px; padding: 2px 8px; }
  .ad-hero__badge { font-size: 11px; padding: 2px 8px; }
  .ad-info-section { padding: 16px 16px 4px; }
  .ad-about { padding: 16px; }
  .ad-app-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-store-btns { flex-direction: column; }
  .ad-store-btn { min-width: unset; }
  /* match jump-to-version button height with store buttons */
  .ad-download__btn { padding: 11px 20px; font-size: 14px; gap: 8px; }
  .ad-download__btn svg { width: 18px; height: 18px; }
  .ad-rating-summary { flex-direction: column; gap: 12px; align-items: flex-start; }
  .ad-screenshots__img { width: 48vw; height: auto; scroll-snap-align: start; }
  .ad-screenshots__btn { display: none; }
  .ad-screenshots__track { -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .ad-app-grid { grid-template-columns: repeat(4, 1fr); }
}
