/* ═══════════════════════════════════════════════════════════════
   App Store — صفحهٔ نمایش و اجرای اپ‌ها
   طراحی مشابه kavoshgaar.ir/apps
   ═══════════════════════════════════════════════════════════════ */

/* ── Page wrapper ──────────────────────────────────────────────── */
.as-page {
  padding: 40px 0 80px;
  min-height: 70vh;
}

/* ── Top bar: title + search ──────────────────────────────────── */
.as-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.as-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand, #17324d);
  margin: 0;
}
.as-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface, #fff);
  border: 1.5px solid var(--line, #e6e9ee);
  border-radius: 50px;
  padding: 8px 18px;
  transition: border-color .2s, box-shadow .2s;
  flex: 0 0 260px;
  max-width: 100%;
}
.as-search:focus-within {
  border-color: var(--brand, #17324d);
  box-shadow: 0 0 0 3px rgba(23,50,77,.1);
}
.as-search i { color: var(--muted, #667085); font-size: 14px; }
.as-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--text, #1f2937);
  direction: rtl;
}
.as-search input::placeholder { color: var(--muted, #667085); }

/* ── Category tabs ────────────────────────────────────────────── */
.as-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.as-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--line, #e6e9ee);
  background: var(--surface, #fff);
  color: var(--muted, #667085);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.as-tab:hover {
  border-color: var(--brand, #17324d);
  color: var(--brand, #17324d);
}
.as-tab.is-active {
  background: var(--brand, #17324d);
  border-color: var(--brand, #17324d);
  color: #fff;
}
.as-tab i { font-size: 12px; }

/* ── Section heading row ──────────────────────────────────────── */
.as-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
}
.as-head h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #1f2937);
  margin: 0;
}
.as-count {
  font-size: 13px;
  color: var(--muted, #667085);
  background: var(--bg, #f6f8fa);
  padding: 2px 10px;
  border-radius: 50px;
}

/* ── App card grid ────────────────────────────────────────────── */
.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

/* ── App card ─────────────────────────────────────────────────── */
.as-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--line, #e6e9ee);
  background: var(--surface, #fff);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.as-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand, #17324d);
  opacity: 0;
  transition: opacity .2s;
  border-radius: inherit;
}
.as-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.1); border-color: var(--brand, #17324d); }
.as-card:hover::before { opacity: .03; }
.as-card:active { transform: translateY(-1px); }

/* ── App icon ─────────────────────────────────────────────────── */
.as-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: var(--brand-soft, #eaf1f6);
  color: var(--brand, #17324d);
  flex-shrink: 0;
  overflow: hidden;
}
.as-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.as-icon-lg {
  width: 88px;
  height: 88px;
  font-size: 38px;
  border-radius: 22px;
}

/* ── Card text ─────────────────────────────────────────────────── */
.as-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1f2937);
  line-height: 1.4;
  position: relative;
}
.as-cat {
  font-size: 11px;
  color: var(--muted, #667085);
  background: var(--bg, #f6f8fa);
  padding: 2px 8px;
  border-radius: 50px;
  position: relative;
}
.as-rate {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  position: relative;
}
.as-num {
  font-weight: 700;
  color: var(--accent, #d6a84f);
  font-size: 12px;
}

/* ── Star renderer ────────────────────────────────────────────── */
.as-stars {
  display: inline-flex;
  gap: 1px;
  font-size: 11px;
  color: #fbbf24;
}
.as-stars-lg { font-size: 14px; gap: 2px; }

/* ── Empty state ──────────────────────────────────────────────── */
.as-empty {
  text-align: center;
  color: var(--muted, #667085);
  padding: 60px 20px;
  font-size: 15px;
}

/* ════════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════════ */
.as-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;          /* slide up from bottom on mobile */
  justify-content: center;
}
@media (min-width: 600px) {
  .as-modal { align-items: center; }
}
.as-modal[hidden] { display: none !important; }

.as-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.as-dialog {
  position: relative;
  background: var(--surface, #fff);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 -4px 60px rgba(0,0,0,.18);
  animation: slideUp .28s cubic-bezier(.22,.61,.36,1);
  display: flex;
  flex-direction: column;
}
@media (min-width: 600px) {
  .as-dialog {
    border-radius: 28px;
    max-height: 88vh;
    animation: popIn .24s cubic-bezier(.22,.61,.36,1);
  }
}

@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(.93); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Dialog top bar ───────────────────────────────────────────── */
.as-dbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 0;
}
.as-ibtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg, #f6f8fa);
  color: var(--muted, #667085);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.as-ibtn:hover { background: var(--brand, #17324d); color: #fff; }

/* ── Detail section ───────────────────────────────────────────── */
#m-detail { padding: 20px 24px 28px; }

.as-dhead {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.as-dmeta { flex: 1; }
.as-dmeta h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand, #17324d);
  margin: 0 0 4px;
}
.as-dcat {
  font-size: 12px;
  color: var(--muted, #667085);
  background: var(--bg, #f6f8fa);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  margin-bottom: 8px;
}
.as-drate {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.as-ppl { font-size: 12px; color: var(--muted, #667085); }

/* ── Chips ────────────────────────────────────────────────────── */
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text, #1f2937);
  background: var(--bg, #f6f8fa);
  border: 1px solid var(--line, #e6e9ee);
  border-radius: 50px;
  padding: 3px 10px;
}
.as-chip i { color: var(--muted, #667085); }

/* ── Action buttons ───────────────────────────────────────────── */
.as-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.as-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--line, #e6e9ee);
  background: var(--surface, #fff);
  color: var(--text, #1f2937);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .17s;
  text-decoration: none;
}
.as-btn-primary {
  background: var(--brand, #17324d);
  border-color: var(--brand, #17324d);
  color: #fff;
  flex: 1;
  justify-content: center;
}
.as-btn-primary:hover { background: var(--brand-dark, #10263a); border-color: var(--brand-dark, #10263a); }
.as-btn:not(.as-btn-primary):hover { border-color: var(--brand, #17324d); color: var(--brand, #17324d); }

/* ── Star rating picker ───────────────────────────────────────── */
.as-yours {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted, #667085);
  margin-bottom: 20px;
  background: var(--bg, #f6f8fa);
  border-radius: 12px;
  padding: 10px 14px;
}
.as-pick {
  display: flex;
  gap: 4px;
  direction: ltr;
}
.as-pick button {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 20px;
  padding: 0 2px;
  cursor: pointer;
  transition: color .12s, transform .1s;
}
.as-pick button:hover,
.as-pick button.lit { color: #fbbf24; }
.as-pick button:active { transform: scale(1.2); }
.as-pick.voted button { cursor: default; }
.as-pick.voted button:not(.lit) { opacity: .4; }

/* ── About section ────────────────────────────────────────────── */
.as-about {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #1f2937);
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #e6e9ee);
}
.as-desc {
  font-size: 14px;
  color: var(--text, #1f2937);
  line-height: 1.8;
  margin: 0;
  white-space: pre-line;
}

/* ── Iframe runner ────────────────────────────────────────────── */
#m-runner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#m-runner[hidden] { display: none !important; }
.as-back {
  margin: 10px 16px;
  align-self: flex-start;
}
#m-frame {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 60vh;
}

/* ── Back button (runner mode) ────────────────────────────────── */
#m-runner .as-back {
  flex: unset;
}

/* ── Toast ────────────────────────────────────────────────────── */
.as-toast {
  position: fixed;
  bottom: 28px;
  right: 50%;
  transform: translateX(50%);
  background: var(--brand, #17324d);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 50px;
  z-index: 3000;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: fadeToast .2s ease;
}
.as-toast[hidden] { display: none !important; }
@keyframes fadeToast {
  from { opacity: 0; transform: translateX(50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(50%) translateY(0); }
}

/* ── Responsive tweaks ────────────────────────────────────────── */
@media (max-width: 600px) {
  .as-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .as-card { padding: 16px 8px 14px; gap: 7px; border-radius: 16px; }
  .as-icon { width: 56px; height: 56px; font-size: 24px; border-radius: 14px; }
  .as-name { font-size: 12px; }
  .as-cat, .as-rate { display: none; }
  .as-title { font-size: 20px; }
  .as-search { flex: 1; min-width: 0; }
}
@media (max-width: 360px) {
  .as-grid { grid-template-columns: repeat(2, 1fr); }
}
