/* ═══════════════════════════════════════════════════════════
   Kavoshgar — App Detail Popover
   apps-detail.css
   ═══════════════════════════════════════════════════════════ */

/* ── Overlay ────────────────────────────────────────────── */
.kv-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.kv-detail-overlay.kv-detail-visible {
  opacity: 1;
  pointer-events: auto;
}
body.kv-detail-open { overflow: hidden; }

/* ── Panel ──────────────────────────────────────────────── */
.kv-detail-panel {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .22);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.95) translateY(16px);
  transition: transform .22s ease;
  direction: rtl;
  font-family: 'Vazirmatn', 'Segoe UI', sans-serif;
}
.kv-detail-overlay.kv-detail-visible .kv-detail-panel {
  transform: scale(1) translateY(0);
}
.kv-detail-panel.kv-detail-maximized {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  width: 100vw;
  height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
.kv-detail-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 10px 12px 0;
  flex-shrink: 0;
}
.kv-detail-close,
.kv-detail-maximize {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #70757a;
  font-size: 15px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.kv-detail-close:hover    { background: #fce8e6; color: #c5221f; }
.kv-detail-maximize:hover { background: #e8f0fe; color: #1a73e8; }
.kv-detail-close:focus-visible,
.kv-detail-maximize:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

/* ── Body ───────────────────────────────────────────────── */
.kv-detail-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: #dadce0 transparent;
}
.kv-detail-body::-webkit-scrollbar       { width: 6px; }
.kv-detail-body::-webkit-scrollbar-track { background: transparent; }
.kv-detail-body::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 3px; }

/* ── Hero ───────────────────────────────────────────────── */
.kv-detail-hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f3f4;
  margin-bottom: 20px;
}
.kv-detail-app-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
}
.kv-detail-app-info { flex: 1; min-width: 0; }
.kv-detail-app-name {
  font-size: 22px;
  font-weight: 700;
  color: #202124;
  margin: 0 0 4px;
  line-height: 1.3;
}
.kv-detail-app-category {
  font-size: 13px;
  color: #1a73e8;
  font-weight: 500;
  margin-bottom: 8px;
}
.kv-detail-rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.kv-detail-stars {
  display: flex;
  gap: 2px;
  color: #fbbc05;
  font-size: 14px;
}
.kv-detail-stars .fa-regular { color: #dadce0; }
.kv-detail-rating-num  { font-size: 14px; font-weight: 700; color: #202124; }
.kv-detail-rating-count { font-size: 12px; color: #70757a; }
.kv-detail-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.kv-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #5f6368;
  background: #f1f3f4;
  border-radius: 20px;
  padding: 3px 10px;
  font-weight: 500;
}
.kv-detail-badge i { font-size: 11px; color: #9aa0a6; }

/* ── دکمه‌های عملیاتی ───────────────────────────────────── */
.kv-detail-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.kv-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.kv-detail-btn:active { transform: scale(.97); }
.kv-detail-btn:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}
.kv-detail-btn-primary {
  background: #1a73e8;
  color: #fff;
}
.kv-detail-btn-primary:hover {
  background: #1557b0;
  box-shadow: 0 2px 8px rgba(26, 115, 232, .35);
}
.kv-detail-btn-install {
  background: #34a853;
  color: #fff;
}
.kv-detail-btn-install:hover {
  background: #2d8e47;
  box-shadow: 0 2px 8px rgba(52, 168, 83, .35);
}
.kv-detail-btn-share {
  background: #f1f3f4;
  color: #3c4043;
}
.kv-detail-btn-share:hover { background: #e8eaed; }

/* ── بخش‌ها ─────────────────────────────────────────────── */
.kv-detail-section { margin-bottom: 24px; }
.kv-detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #70757a;
  letter-spacing: .4px;
  margin: 0 0 12px;
  text-transform: uppercase;
}
.kv-detail-desc {
  font-size: 14px;
  color: #3c4043;
  line-height: 1.7;
  margin: 0;
}

/* ── تصاویر ─────────────────────────────────────────────── */
.kv-detail-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.kv-screenshot-thumb {
  border: none;
  padding: 0;
  background: #f1f3f4;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 9 / 16;
  display: block;
  transition: transform .15s, box-shadow .15s;
}
.kv-screenshot-thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
}
.kv-screenshot-thumb:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}
.kv-screenshot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── بازخوردها ──────────────────────────────────────────── */
.kv-detail-reviews { display: flex; flex-direction: column; gap: 14px; }
.kv-review-item {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 14px 16px;
}
.kv-review-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.kv-review-author { font-size: 13px; font-weight: 700; color: #202124; }
.kv-review-stars {
  display: flex;
  gap: 2px;
  color: #fbbc05;
  font-size: 11px;
}
.kv-review-stars .fa-regular { color: #dadce0; }
.kv-review-date { font-size: 11px; color: #9aa0a6; margin-right: auto; }
.kv-review-text { font-size: 13px; color: #3c4043; line-height: 1.6; margin: 0; }

/* ── Lightbox ───────────────────────────────────────────── */
.kv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .92);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
}
.kv-lightbox.kv-lightbox-visible { opacity: 1; }
.kv-lightbox-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 56px 60px 72px;
}
.kv-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4);
}
.kv-lightbox-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, .15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.kv-lightbox-close:hover { background: rgba(255, 255, 255, .28); }
.kv-lightbox-prev,
.kv-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, .15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.kv-lightbox-prev { right: 16px; }
.kv-lightbox-next { left: 16px; }
.kv-lightbox-prev:hover,
.kv-lightbox-next:hover { background: rgba(255, 255, 255, .28); }
.kv-lightbox-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.kv-lightbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .4);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .15s, transform .15s;
}
.kv-lightbox-dot.active { background: #fff; transform: scale(1.3); }

/* ── Toast ──────────────────────────────────────────────── */
.kv-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #202124;
  color: #fff;
  font-size: 14px;
  font-family: 'Vazirmatn', sans-serif;
  padding: 10px 20px;
  border-radius: 24px;
  z-index: 1300;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.kv-toast.kv-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── موبایل ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .kv-detail-overlay { align-items: flex-end; padding: 0; }
  .kv-detail-panel {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
  .kv-detail-overlay.kv-detail-visible .kv-detail-panel { transform: translateY(0); }
  .kv-detail-panel.kv-detail-maximized {
    max-height: 100vh;
    border-radius: 0;
    height: 100dvh;
  }
  .kv-detail-body { padding: 4px 16px 32px; }
  .kv-detail-app-icon { width: 64px; height: 64px; font-size: 28px; }
  .kv-detail-app-name { font-size: 19px; }
  .kv-detail-screenshots { grid-template-columns: repeat(2, 1fr); }
  .kv-lightbox-inner { padding: 48px 44px 64px; }
  .kv-lightbox-prev { right: 8px; }
  .kv-lightbox-next { left: 8px; }
}
