/* ============================================================
   ENCY TV STORE — Linktree-style theme (pixel replica)
   Colors are overridden per-theme by themes.css [data-theme=...]
   Defaults below = Official Downloader theme
   ============================================================ */
:root {
  --bg: #0a0d12;
  --page-1: #232c38;
  --page-2: #161d27;
  --page-3: #10151d;
  --card-top: rgba(249, 124, 33, 0.50);
  --card-mid: rgba(126, 58, 14, 0.26);
  --card-bottom: #0b0e13;
  --btn-grad-1: rgba(249, 124, 33, 0.42);
  --btn-grad-2: rgba(128, 54, 10, 0.55);
  --btn-border: rgba(255, 158, 79, 0.55);
  --gold: #ffa452;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ---------- Main card (the red-gradient column) ---------- */
.page {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  padding: 20px 22px 46px;
  position: relative;
  border-radius: 26px;
  background:
    radial-gradient(130% 42% at 50% -6%, var(--card-top) 0%, var(--card-mid) 44%, rgba(0, 0, 0, 0.07) 66%, rgba(0, 0, 0, 0) 78%),
    linear-gradient(180deg, var(--page-1) 0%, var(--page-2) 26%, var(--page-3) 54%, var(--card-bottom) 100%);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.55);
  animation: fadeIn .45s ease both;
}
@media (max-width: 720px) {
  .page { border-radius: 0; max-width: 100%; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

/* ---------- Top corner buttons (✱ and share) ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.topbtn {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(30, 30, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 15px;
  color: #fff; cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.topbtn:hover { background: rgba(58, 58, 58, 0.85); transform: translateY(-1px); }
.topbtn svg { width: 22px; height: 22px; fill: currentColor; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.langbtn { gap: 5px; font-weight: 800; font-size: 13px; }
.langbtn .langtxt { color: #fff; }
.langbtn:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Profile header ---------- */
.profile { text-align: center; padding-top: 26px; }

.avatar {
  width: 104px; height: 104px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 18px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* clickable logo -> clean site root (v3.6) */
.avatar-a { display: inline-block; line-height: 0; border-radius: 50%; }

.store-title {
  font-size: 30px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  color: #fff;
  word-break: break-word;
}

.store-desc {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  color: #fff;
  max-width: 520px;
  margin: 0 auto;
  white-space: pre-line;
}

/* ---------- Social buttons ---------- */
.socials {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 6px;
}
.socbtn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.socbtn:hover { transform: translateY(-2px) scale(1.05); }
.socbtn svg { width: 23px; height: 23px; fill: #14161a; }

/* ---------- Downloader code box (TV users) ---------- */
.dl-box {
  margin: 22px auto 4px;
  max-width: 460px;
  border: 1.6px dashed var(--btn-border);
  background: linear-gradient(180deg, var(--btn-grad-1), var(--btn-grad-2));
  border-radius: 18px;
  padding: 14px 18px;
  text-align: center;
  animation: fadeIn .5s ease both;
}
.dl-box .dl-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dl-box .dl-label svg { width: 17px; height: 17px; fill: var(--gold); }
.dl-logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  flex: 0 0 30px;
}
.dl-code-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.dl-code {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  font-family: 'Courier New', monospace;
}
.dl-copy {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s ease;
}
.dl-copy:hover { background: rgba(255,255,255,.24); }
.dl-note { font-size: 12.5px; color: var(--muted); margin-top: 7px; font-weight: 600; }

/* ---------- Category filter chips ---------- */
.cats {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 30px;
  border: 1px solid var(--btn-border);
  background: var(--btn-grad-2);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, background .14s ease;
}
.chip:hover { transform: translateY(-1px); filter: brightness(1.2); }
.chip.on {
  background: var(--btn-grad-1);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 3px 14px rgba(0,0,0,.35);
}
.chip .chipn {
  background: rgba(0,0,0,.35);
  border-radius: 12px;
  font-size: 11px;
  padding: 1px 7px;
  color: rgba(255,255,255,.85);
}
.chip.on .chipn { color: var(--gold); }

/* ---------- Link buttons ---------- */
.links {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.linkbtn {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 78px;
  padding: 9px 52px 9px 13px;
  border-radius: 40px;
  border: 1px solid var(--btn-border);
  background: linear-gradient(180deg, var(--btn-grad-1) 0%, var(--btn-grad-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 226, 160, 0.09), 0 4px 16px rgba(0,0,0,.28);
  text-decoration: none;
  color: #fff;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
  animation: fadeIn .4s ease both;
}
.linkbtn:hover {
  transform: translateY(-2px);
  filter: brightness(1.16);
  box-shadow: inset 0 1px 0 rgba(255,226,160,.12), 0 8px 22px rgba(0,0,0,.4);
}
.linkbtn:active { transform: translateY(0); }

.linkbtn .icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  flex: 0 0 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.linkbtn .ltitle {
  flex: 1 1 auto;
  text-align: center;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
  padding: 0 6px;
  word-break: break-word;
}

/* three-dot menu */
.linkrow { position: relative; }
.kebab {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  color: #fff; cursor: pointer;
  border-radius: 50%;
  transition: background .15s ease;
}
.kebab:hover { background: rgba(255,255,255,.14); }
.kebab svg { width: 19px; height: 19px; fill: currentColor; }

/* ---------- Share / kebab popup menu ---------- */
.pop {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  background: #262626;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
  padding: 6px;
  display: none;
}
.pop.open { display: block; animation: popIn .14s ease both; }
@keyframes popIn { from { opacity: 0; transform: scale(.96);} to { opacity: 1; transform: scale(1);} }
.pop button, .pop a {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: transparent; border: 0;
  color: #eee;
  font-size: 14px; font-weight: 600;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.pop button:hover, .pop a:hover { background: rgba(255,255,255,.09); }
.pop svg { width: 17px; height: 17px; fill: currentColor; opacity: .8; }
.pop .pop-title {
  font-size: 12px; color: #9a9a9a; font-weight: 700;
  padding: 7px 12px 4px; white-space: nowrap; overflow: hidden;
  max-width: 230px; text-overflow: ellipsis; direction: ltr; text-align: left;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #fff;
  color: #111;
  font-size: 14px; font-weight: 700;
  padding: 11px 20px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  opacity: 0;
  transition: all .3s ease;
  z-index: 99;
  pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- Footer ---------- */
.foot {
  margin-top: 34px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(255,255,255,.45);
  font-weight: 600;
}
.foot a { color: rgba(255,255,255,.6); text-decoration: none; }

/* ---------- Ad slot on homepage (optional, admin-set) ---------- */
.ad-slot {
  margin: 18px auto 0; text-align: center;
  max-width: 100%; width: 100%; box-sizing: border-box;
  background: rgba(11,14,19,.55);
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 14px; padding: 10px 12px;
  overflow: hidden; display: flow-root;
}
.ad-slot::before {
  content: '· إعلان ·'; display: block;
  font-size: 10px; letter-spacing: 1.5px;
  color: rgba(255,255,255,.35); margin-bottom: 6px;
}
.ad-slot > * { max-width: 100% !important; }
.ad-slot iframe, .ad-slot ins, .ad-slot img { max-width: 100% !important; overflow: hidden; }

/* ---------- RTL support (Arabic content) ---------- */
.rtl { direction: rtl; }

/* ---------- Search (optional filter for many apps) ---------- */
.search-wrap { margin-top: 22px; display: none; }
.search-wrap.show { display: block; }
.search-wrap input {
  width: 100%;
  padding: 13px 18px;
  border-radius: 30px;
  border: 1px solid var(--btn-border);
  background: rgba(20, 8, 6, 0.55);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  font-family: inherit;
}
.search-wrap input::placeholder { color: rgba(255,255,255,.45); }
.search-wrap input:focus { border-color: var(--gold); }
.no-results { text-align:center; color: var(--muted); font-weight:700; padding: 26px 0; display:none; }

/* ---------- Raw ad zones (NO frame — ads keep their native size) ---------- */
.adzone {
  margin: 16px auto;
  text-align: center;
  max-width: 100%;
}
.adzone > * { margin-inline: auto; }
.adzone iframe,
.adzone ins,
.adzone img,
.adzone video { max-width: 100%; }

/* ---------- Fixed side rails (wide screens only — ideal 160x600) ---------- */
.side-rail {
  position: fixed;
  top: 80px;
  z-index: 40;
  display: none;
  text-align: center;
}
.side-rail.l { left: 6px; }
.side-rail.r { right: 6px; }
@media (min-width: 1400px) {
  .side-rail { display: block; }
}

/* ---------- Short Videos Carousel (YouTube Shorts / TikTok) ---------- */
.vids { margin-top: 26px; }
.vids-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}
.vids-head h3 { font-size: 15px; color: var(--text); margin: 0; }
.vids-nav { display: flex; gap: 6px; }
.vids-nav button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: rgba(20, 8, 6, 0.55);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.vids-nav button:hover { border-color: var(--gold); color: var(--gold); }
.vids-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.vids-row::-webkit-scrollbar { height: 5px; }
.vids-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.vid-card {
  flex: 0 0 auto;
  width: 210px;
  height: 373px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--btn-border);
  scroll-snap-align: start;
  position: relative;
}
.vid-card iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 480px) { .vid-card { width: 172px; height: 306px; } }
