/* تبلیغات: جایگاه‌ها، بنرها و پنل مدیریت تبلیغات (کد در ads.py) */

/* چیدمان جایگاه‌های تبلیغاتی در صفحه اصلی */
.page:has(.home-ad-layout) {
  width: min(97%, 1660px);
  padding-top: 26px;
}
.home-ad-layout {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(500px, 690px) minmax(230px, 1fr);
  align-items: start;
  gap: 26px;
  direction: ltr;
}
.home-main-content {
  direction: rtl;
  width: 100%;
  min-width: 0;
}
.ad-column {
  display: flex;
  flex-direction: column;
  gap: 50px;
  padding-top: 18px;
  min-width: 0;
}
.ad-placeholder {
  position: relative;
  min-height: 235px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  border-radius: 19px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(21, 184, 153, .13), transparent 67%),
    linear-gradient(145deg, #102522 0%, #101b20 48%, #10171d 100%);
  box-shadow:
    inset 0 1px 0 rgba(147, 255, 224, .08),
    inset 0 -1px 0 rgba(0, 0, 0, .28),
    0 14px 34px rgba(0, 0, 0, .16);
}
.ad-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(45, 212, 191, .38), rgba(45, 212, 191, .06) 42%, rgba(56, 189, 248, .22));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.ad-placeholder::after {
  content: "";
  position: absolute;
  width: 75%;
  height: 65%;
  border-radius: 50%;
  background: rgba(20, 184, 166, .08);
  filter: blur(45px);
  z-index: -1;
  animation: adGlow 7s ease-in-out infinite alternate;
}
.ad-placeholder span {
  color: rgba(190, 220, 218, .68);
  font-size: clamp(.85rem, 1vw, 1rem);
  font-weight: 500;
  letter-spacing: .01em;
  text-shadow: 0 0 18px rgba(45, 212, 191, .16);
  transition: color .25s ease, transform .25s ease, text-shadow .25s ease;
}
.ad-placeholder:hover span {
  color: #b8fff1;
  transform: translateY(-2px);
  text-shadow: 0 0 22px rgba(45, 212, 191, .32);
}
@keyframes adGlow {
  from { transform: translate(-8%, -4%) scale(.9); opacity: .55; }
  to { transform: translate(8%, 5%) scale(1.12); opacity: 1; }
}

@media (max-width: 1120px) {
  .home-ad-layout {
    grid-template-columns: minmax(180px, .75fr) minmax(460px, 690px) minmax(180px, .75fr);
    gap: 16px;
  }
  .ad-placeholder { min-height: 205px; }
  .ad-column { gap: 34px; }
}
@media (max-width: 920px) {
  .home-ad-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .home-main-content { grid-row: 1; }
  .ad-column {
    padding-top: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .ad-column-left { grid-row: 2; }
  .ad-column-right { grid-row: 3; }
  .ad-placeholder { min-height: 130px; }
}
@media (max-width: 520px) {
  .page:has(.home-ad-layout) { width: min(94%, 690px); }
  .ad-placeholder { min-height: 105px; border-radius: 14px; }
  .ad-placeholder span { font-size: .78rem; }
}


/* Updated ad placeholders: dotted neon outline with the page background showing through */
.ad-placeholder {
  background: transparent !important;
  border: 2px dotted rgba(45, 212, 191, .58);
  border-radius: 18px;
  box-shadow:
    inset 0 0 28px rgba(20, 184, 166, .045),
    0 0 16px rgba(20, 184, 166, .06);
}
.ad-placeholder::before {
  display: none;
}
.ad-placeholder::after {
  background: rgba(20, 184, 166, .10);
  filter: blur(48px);
}
.ad-placeholder span {
  color: rgba(190, 220, 218, .78);
  text-shadow: 0 0 12px rgba(45, 212, 191, .22);
}

/* Ad placements: visible dotted frame in both light and dark themes */
.ad-placeholder {
  background: transparent !important;
  border: 2px dotted rgba(13, 148, 136, .72) !important;
  box-shadow:
    inset 0 0 0 1px rgba(13, 148, 136, .05),
    0 0 12px rgba(13, 148, 136, .10) !important;
}
.ad-placeholder::before {
  display: none !important;
}
.ad-placeholder::after {
  background: rgba(13, 148, 136, .09) !important;
  opacity: .75;
}
.ad-placeholder span {
  color: #0f766e !important;
  text-shadow: 0 0 10px rgba(13, 148, 136, .15) !important;
  font-weight: 600;
}
[data-theme="dark"] .ad-placeholder {
  border-color: rgba(45, 212, 191, .72) !important;
  box-shadow:
    inset 0 0 0 1px rgba(45, 212, 191, .06),
    0 0 14px rgba(45, 212, 191, .12) !important;
}
[data-theme="dark"] .ad-placeholder span {
  color: rgba(190, 255, 244, .82) !important;
  text-shadow: 0 0 12px rgba(45, 212, 191, .25) !important;
}


/* ---------- نمایش تبلیغات واقعی ---------- */
.ad-box {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-box a { display: block; width: 100%; }
.ad-box img { display: block; width: 100%; height: auto; }
.ad-box iframe, .ad-box ins { max-width: 100%; }

/* پنل مدیریت: تب‌ها و کارت تبلیغات */
.admin-tabs { display: flex; gap: 8px; }
.admin-tab {
  padding: 9px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.ad-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge-ok {
  color: var(--ok);
  border-color: rgba(5, 150, 105, 0.35);
  background: rgba(5, 150, 105, 0.08);
}
.ad-preview {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
}
.ad-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 10px;
  display: block;
  margin: 0 auto 8px;
}
.ad-actions { margin-top: 4px; }
.ad-clear-form { margin-top: 12px; }

/* ابعاد پیشنهادی داخل مستطیل جایگاه تبلیغ */
.ad-placeholder .ad-size {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: .8rem;
  font-weight: 500;
  opacity: .75;
  letter-spacing: .04em;
}


/* دکمه «سفارش تبلیغات» در هدر: سبز تیره + آیکون تلگرام + افکت */
.btn-order {
  position: relative;
  overflow: hidden;
  color: #ecfdf5 !important;
  border: 1px solid rgba(74, 222, 128, .35);
  background: linear-gradient(135deg, #14532d 0%, #166534 55%, #15803d 100%);
  box-shadow: 0 4px 14px rgba(22, 101, 52, .45);
  transition: transform .2s ease, box-shadow .25s ease, filter .2s ease;
}
.btn-order .order-icon {
  flex-shrink: 0;
  transition: transform .35s ease;
}
/* درخشش متحرک از روی دکمه */
.btn-order::after {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: skewX(-20deg);
  animation: orderShine 3.6s ease-in-out infinite;
  pointer-events: none;
}
.btn-order:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 8px 22px rgba(34, 197, 94, .45), 0 0 0 3px rgba(34, 197, 94, .15);
}
.btn-order:hover .order-icon { transform: translate(2px, -2px) rotate(-12deg) scale(1.12); }
.btn-order:active { transform: scale(.97); }
@keyframes orderShine {
  0%, 55% { left: -70%; }
  100% { left: 135%; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-order::after { animation: none; }
}
