/* 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 {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 24px;
}
.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; }
.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 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;
}

/* ── about ── */
.ad-about {
  background: var(--CardBg);
  border: 1px solid var(--BorderMid);
  border-radius: var(--CardRadius);
  padding: 20px 24px;
}
.ad-about__body {
  position: relative;
  overflow: hidden;
  transition: max-height 0.3s ease;
  font-size: 15px;
  color: var(--TextPrimary);
  line-height: 1.7;
}
.ad-about__body.is-collapsed { max-height: 280px; }
.ad-about__body.is-expanded { max-height: none; }
.ad-about__fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
}
.ad-about__body.is-expanded .ad-about__fade { display: none; }
.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-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--Theme);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--FontBody);
}
.ad-toggle:hover { text-decoration: underline; }

/* ── 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 ── */
.ad-app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ad-app-grid > * { min-width: 0; }

/* ── 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;
}

/* ── review write btn ── */
.ad-review-write-btn {
  display: block;
  width: 100%;
  max-width: 360px;
  margin-bottom: 16px;
  padding: 12px 24px;
  background: var(--ThemeGradient);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--FontBody);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s;
}
.ad-review-write-btn:hover { opacity: 0.9; }

/* ── review grid ── */
.ad-review-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}
.ad-review-empty {
  grid-column: 1 / -1;
  color: var(--TextMuted);
  font-size: 14px;
  text-align: center;
  padding: 16px 0;
  margin: 0;
}
.ad-review-card {
  padding: 16px;
  border: 1px solid var(--BorderMid);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--CardBg);
}
.ad-review-card__hd {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ad-review-card__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--Theme);
  flex-shrink: 0;
}
.ad-review-card__user {
  font-size: 13px;
  font-weight: 600;
  color: var(--TextPrimary);
  display: block;
}
.ad-review-card__stars { display: flex; gap: 2px; margin-top: 2px; }
.ad-review-card__text {
  font-size: 14px;
  color: var(--TextPrimary);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  margin: 0;
}
.ad-review-card__date { font-size: 12px; color: var(--TextMuted); }
.ad-review-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--Theme);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--FontBody);
  margin-top: 4px;
}
.ad-review-more:hover { text-decoration: underline; }
.ad-review-more[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── 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;
}

/* ── review modal ── */
.ad-review-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;
}
.ad-review-modal[hidden] { display: none !important; }
.ad-review-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.ad-review-modal__dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ad-review-modal__hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.ad-review-modal__title {
  font-family: var(--FontTitle);
  font-size: 20px;
  font-weight: 700;
  color: var(--TextPrimary);
  margin: 0;
  flex: 1;
  text-align: center;
}
.ad-review-modal__close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--TextMuted);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-review-modal__body { display: flex; flex-direction: column; gap: 20px; }
.ad-review-modal__rating-tip {
  color: #EF4444;
  font-size: 13px;
  text-align: center;
  margin: 0;
}
.ad-review-modal__rating-tip[hidden] { display: none !important; }
.ad-review-modal__stars {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.ad-review-modal__star { cursor: pointer; }
.ad-review-modal__form { display: flex; flex-direction: column; gap: 10px; }
.ad-review-modal__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--TextPrimary);
}
.ad-review-modal__textarea {
  padding: 12px;
  border: 1px solid var(--BorderMid);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--FontBody);
  color: var(--TextPrimary);
  resize: vertical;
  min-height: 120px;
  box-sizing: border-box;
  width: 100%;
}
.ad-review-modal__submit {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

/* ── 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; }
  .ad-hero__icon { width: 72px; height: 72px; border-radius: 14px; }
  .ad-hero__name { font-size: 18px; }
  .ad-info-section { padding: 16px 16px 4px; }
  .ad-about { padding: 16px; }
  .ad-review-grid { grid-template-columns: 1fr; }
  .ad-app-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-rating-summary { flex-direction: column; gap: 12px; align-items: flex-start; }
  .ad-review-modal { padding: 12px; }
  .ad-review-modal__dialog { padding: 24px 16px; }
  .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-review-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-app-grid { grid-template-columns: repeat(4, 1fr); }
}
