/* public/css/announcement.css — مودال اعلان سایت
   فقط از توکن‌های ezlan-tokens.css استفاده می‌کنه؛ پس با سوییچ تیره/روشن سایت همزمان (و بدون هیچ کد اضافه) عوض می‌شه.
   همهٔ کلاس‌ها پیشوند ezann- دارن تا با صفحه‌ها تداخل نکنه. روی موبایل «ورق پایین‌آمده» (bottom sheet)، روی دسکتاپ کارت وسط صفحه. */

.ezann-overlay {
  --ann-c: var(--accent-ink);
  --ann-bg: var(--accent-soft-2);
  --ann-line: var(--accent-line);
  --ann-bar-a: var(--accent);
  --ann-bar-b: #4aa584;

  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  font-family: var(--font);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.ezann-overlay.is-open { opacity: 1; }
.ezann-overlay *, .ezann-overlay *::before, .ezann-overlay *::after { box-sizing: border-box; }

/* رنگ نوع اعلان (آیکون، نوار بالا، لینک‌ها) — در هر دو تم */
.ezann-t-success { --ann-c: var(--success); --ann-bg: rgba(43, 122, 75, 0.14); --ann-line: rgba(43, 122, 75, 0.36); --ann-bar-a: #2b7a4b; --ann-bar-b: #5cb585; }
.ezann-t-warning { --ann-c: #9a5f06; --ann-bg: rgba(201, 138, 27, 0.15); --ann-line: rgba(201, 138, 27, 0.45); --ann-bar-a: #c98a1b; --ann-bar-b: #e8b765; }
.ezann-t-promo   { --ann-bar-a: #2c6652; --ann-bar-b: #52b08c; }
:root[data-theme="dark"] .ezann-t-success { --ann-bg: rgba(108, 197, 151, 0.16); --ann-line: rgba(108, 197, 151, 0.4); --ann-bar-a: #3f9b6c; --ann-bar-b: #8bd8b0; }
:root[data-theme="dark"] .ezann-t-warning { --ann-c: #e8b765; --ann-bg: rgba(232, 183, 101, 0.14); --ann-line: rgba(232, 183, 101, 0.42); --ann-bar-a: #b9791a; --ann-bar-b: #f0c985; }
:root[data-theme="dark"] .ezann-t-promo   { --ann-bar-a: #2f7a60; --ann-bar-b: #7fd0ac; }

.ezann-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-3);
  outline: none;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.34s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.ezann-overlay.is-open .ezann-dialog { transform: none; }

/* نوار رنگی بالای کارت */
.ezann-dialog::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 3;
  background: linear-gradient(90deg, var(--ann-bar-a), var(--ann-bar-b), var(--ann-bar-a));
  background-size: 200% 100%;
}
.ezann-t-promo .ezann-dialog::before { animation: ezann-shimmer 5s linear infinite; }
@keyframes ezann-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* دکمهٔ ✕ */
.ezann-x {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 4;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: rgba(var(--surface-rgb), 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.ezann-x:hover { color: var(--ink); background: var(--surface-3); }
.ezann-x:active { transform: scale(0.92); }
.ezann-x svg { width: 16px; height: 16px; }

/* عکس */
.ezann-media {
  position: relative;
  flex: none;
  background: var(--surface-2);
  overflow: hidden;
}
.ezann-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.ezann-fit-natural .ezann-media img {
  aspect-ratio: auto;
  max-height: min(320px, 42vh);
  max-height: min(320px, 42dvh);
  object-fit: contain;
}
.ezann-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(to top, var(--surface), rgba(var(--surface-rgb), 0));
  pointer-events: none;
}
:root[data-theme="dark"] .ezann-media img { filter: brightness(0.92) saturate(0.97); }
@supports not (aspect-ratio: 16 / 9) { .ezann-media img { height: 200px; } }

/* بدنه */
.ezann-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 28px 24px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.ezann-has-media .ezann-body { padding-top: 0; margin-top: -26px; }

.ezann-icon {
  width: 54px;
  height: 54px;
  margin: 0 0 14px;
  display: grid;
  place-items: center;
  color: var(--ann-c);
  background: var(--ann-bg);
  border: 1px solid var(--ann-line);
  border-radius: 17px;
  box-shadow: var(--shadow-1);
}
.ezann-icon svg { width: 27px; height: 27px; }
.ezann-t-promo .ezann-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--ann-bar-a), var(--ann-bar-b));
  border-color: transparent;
}
.ezann-has-media .ezann-icon { background: var(--surface); box-shadow: var(--shadow-2); }
.ezann-has-media.ezann-t-promo .ezann-icon { background: linear-gradient(135deg, var(--ann-bar-a), var(--ann-bar-b)); }

.ezann-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.65;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.ezann-text {
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.ezann-text p { margin: 0 0 10px; }
.ezann-text p:last-child, .ezann-text ul:last-child { margin-bottom: 0; }
.ezann-text ul { margin: 0 0 10px; padding: 0 20px 0 0; }
.ezann-text li { margin: 0 0 4px; }
.ezann-text li::marker { color: var(--ann-c); }
.ezann-text strong { color: var(--ink); font-weight: 800; }
.ezann-text a { color: var(--ann-c); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* دکمه‌ها */
.ezann-actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 8px 24px 22px;
  background: var(--surface);
}
/* متن بلند → ناحیهٔ دکمه‌ها از متنِ اسکرول‌شونده جدا می‌شه */
.ezann-scrolls .ezann-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 18px -16px rgba(0, 0, 0, 0.28);
}
.ezann-btn {
  flex: 1 1 140px;
  min-height: 48px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.ezann-btn:active { transform: scale(0.98); }
.ezann-btn svg { width: 16px; height: 16px; flex: none; }
.ezann-btn-primary { color: var(--on-accent); background: var(--accent); box-shadow: 0 6px 16px -6px rgba(44, 102, 82, 0.55); }
.ezann-btn-primary:hover { background: var(--accent-hover); }
.ezann-btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.ezann-btn-secondary:hover { background: var(--surface-3); }
.ezann-btn-close {
  flex: 1 1 100%;
  min-height: 42px;
  color: var(--ink-3);
  background: transparent;
  font-weight: 600;
  font-size: 13.5px;
}
.ezann-btn-close:hover { color: var(--ink); background: var(--surface-3); }
.ezann-btn-only-close { color: var(--on-accent); background: var(--accent); font-weight: 700; font-size: 14.5px; min-height: 48px; }
.ezann-btn-only-close:hover { color: var(--on-accent); background: var(--accent-hover); }

/* موبایل: ورق پایین‌آمده */
@media (max-width: 560px) {
  .ezann-overlay { place-items: end center; padding: 0; }
  .ezann-dialog {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
    transform: translateY(48px);
  }
  .ezann-body { padding: 24px 20px 12px; }
  .ezann-has-media .ezann-body { padding-top: 0; }
  .ezann-actions { padding: 8px 20px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .ezann-scrolls .ezann-actions { padding-top: 12px; }
  .ezann-btn { flex: 1 1 100%; }
  .ezann-title { font-size: 19px; }
}
@media print { .ezann-overlay { display: none !important; } }
/* گوشی افقی / صفحه‌های کوتاه */
@media (max-height: 480px) {
  .ezann-media img { max-height: 120px; aspect-ratio: auto; object-fit: cover; }
  .ezann-body { padding-top: 18px; }
  .ezann-actions { padding-bottom: 14px; }
  .ezann-icon { width: 44px; height: 44px; margin-bottom: 8px; }
  .ezann-icon svg { width: 22px; height: 22px; }
}
@media (max-width: 340px) {
  .ezann-body, .ezann-actions { padding-inline: 14px; }
  .ezann-title { font-size: 17.5px; }
}
