/* assets/css/popup.css — popup engine styling.
   Fully responsive: center modal on desktop, bottom sheet on phones.
   Inherits the site accent variables so it matches the admin theme colours. */

.md-popup-root { position: relative; z-index: 20000; }
html.md-pop-open, html.md-pop-open body { overflow: hidden; }

.md-pop-overlay {
  --md-pop-accent: var(--md-accent, #38e1b0);
  --md-pop-accent-2: var(--md-accent-2, #6aa8ff);
  position: fixed; inset: 0; z-index: 20000;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 4vw, 32px);
  background: rgba(4, 8, 16, .68);
  opacity: 0; transition: opacity .22s ease;
}
.md-pop-overlay.is-blur { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.md-pop-overlay.is-in { opacity: 1; }

/* ---------------------------------------------------------------- the card */
.md-pop-card {
  position: relative; width: 100%; max-height: min(92vh, 900px);
  overflow: auto; -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  background: var(--glass-2, rgba(16, 22, 36, .96));
  color: var(--bs-body-color, #e6ecf7);
  border: 1px solid var(--md-border, rgba(255, 255, 255, .14));
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85);
  transform: translateY(12px) scale(.96); opacity: 0;
  transition: transform .26s cubic-bezier(.2, .8, .2, 1), opacity .26s ease;
}
[data-bs-theme="light"] .md-pop-card { background: #fff; color: #1a2233; border-color: rgba(20, 30, 50, .12); }
.md-pop-overlay.is-in .md-pop-card { transform: none; opacity: 1; }

.md-pop-size-sm { max-width: 380px; }
.md-pop-size-md { max-width: 520px; }
.md-pop-size-lg { max-width: 680px; }
.md-pop-size-xl { max-width: 860px; }

/* animations */
.md-pop-anim-fade   { transform: none; }
.md-pop-anim-zoom   { transform: scale(.9); }
.md-pop-anim-up     { transform: translateY(40px); }
.md-pop-anim-down   { transform: translateY(-40px); }
.md-pop-anim-bounce { transform: scale(.8); transition: transform .42s cubic-bezier(.2, 1.5, .4, 1), opacity .3s ease; }

/* ------------------------------------------------------------- placements */
.md-pop-style-slide-right, .md-pop-style-slide-left { align-items: flex-end; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.md-pop-style-slide-right { justify-content: flex-end; }
.md-pop-style-slide-left  { justify-content: flex-start; }
.md-pop-style-slide-right .md-pop-card,
.md-pop-style-slide-left .md-pop-card { pointer-events: auto; max-width: 360px; margin-bottom: 88px; }

.md-pop-style-bottom-bar { align-items: flex-end; padding: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.md-pop-style-bottom-bar .md-pop-card {
  pointer-events: auto; max-width: none; width: 100%; border-radius: 18px 18px 0 0;
  border-bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 6px 10px;
}
.md-pop-style-bottom-bar .md-pop-media { width: 132px; flex: 0 0 auto; margin: 8px 0; border-radius: 12px; }
.md-pop-style-bottom-bar .md-pop-body { flex: 1 1 260px; padding: 10px 12px; }
.md-pop-style-bottom-bar .md-pop-title { font-size: 1.05rem; }

.md-pop-style-full { padding: 0; }
.md-pop-style-full .md-pop-card { max-width: none; width: 100%; height: 100%; max-height: 100%; border-radius: 0; border: 0; }
.md-pop-style-full .md-pop-body { max-width: 720px; margin: 0 auto; }

/* ------------------------------------------------------------------- media */
.md-pop-media { position: relative; overflow: hidden; background: #05080f; border-radius: 20px 20px 0 0; line-height: 0; }
.md-pop-media img, .md-pop-media video { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: cover; }
.md-pop-media iframe { display: block; width: 100%; height: 100%; border: 0; }
.md-pop-ratio-16x9 { aspect-ratio: 16 / 9; }
.md-pop-ratio-ig   { aspect-ratio: 4 / 5.2; max-height: 70vh; }
.md-pop-ratio-ig iframe { height: 100%; }
.md-pop-media.is-ig { background: #fff; }

/* -------------------------------------------------------------------- text */
.md-pop-body { padding: 20px 22px 22px; }
.md-pop-eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--md-pop-accent); margin-bottom: 6px;
}
.md-pop-title { font-size: clamp(1.15rem, 3.4vw, 1.5rem); font-weight: 800; margin: 0 0 8px; line-height: 1.22; }
.md-pop-text { font-size: .95rem; line-height: 1.6; opacity: .88; margin-bottom: 4px; }

/* ----------------------------------------------------------------- buttons */
.md-pop-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.md-pop-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: .62rem 1.15rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: .92rem; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.md-pop-btn:hover { transform: translateY(-1px); }
.md-pop-btn-primary {
  background: linear-gradient(135deg, var(--md-pop-accent), var(--md-pop-accent-2));
  color: #06121a; box-shadow: 0 10px 24px -10px rgba(56, 225, 176, .7);
}
.md-pop-btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.md-pop-btn-ghost { background: transparent; color: inherit; border-color: var(--md-border, rgba(255, 255, 255, .22)); opacity: .8; }
.md-pop-vote { margin-top: 12px; width: 100%; }

.md-pop-close {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.35rem; line-height: 1;
  background: rgba(8, 12, 20, .62); color: #fff; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background .15s ease, transform .15s ease;
}
.md-pop-close:hover { background: rgba(8, 12, 20, .9); transform: rotate(90deg); }
.md-pop-close.is-waiting { cursor: default; font-size: .85rem; font-weight: 700; opacity: .75; }
.md-pop-close.is-waiting:hover { transform: none; }

.md-pop-auto {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; font-size: .75rem; font-weight: 700;
  background: rgba(8, 12, 20, .6); color: #fff;
}

/* -------------------------------------------------------------------- poll */
.md-pop-poll { margin-top: 14px; }
.md-pop-poll.is-sending { opacity: .6; pointer-events: none; }
.md-pop-poll-q { font-weight: 700; font-size: 1rem; margin-bottom: 10px; }
.md-pop-opts { display: flex; flex-direction: column; gap: 8px; }
.md-pop-opts.is-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.md-pop-opt {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  padding: .68rem .8rem; border-radius: 14px;
  background: rgba(127, 140, 170, .1);
  border: 1px solid var(--md-border, rgba(255, 255, 255, .14));
  color: inherit; font-size: .93rem; font-weight: 600;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.md-pop-opt:hover:not(:disabled) { border-color: var(--md-pop-accent); background: rgba(127, 140, 170, .18); transform: translateY(-1px); }
.md-pop-opt:disabled { cursor: default; }
.md-pop-opt.is-picked { border-color: var(--md-pop-accent); box-shadow: inset 0 0 0 1px var(--md-pop-accent); }
.md-pop-opt.is-mine { border-color: var(--md-pop-accent); background: rgba(56, 225, 176, .14); }
.md-pop-opt-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.md-pop-opt-label { display: block; }
.md-pop-tick { font-style: normal; color: var(--md-pop-accent); font-weight: 800; }

.md-pop-bar { display: block; height: 6px; border-radius: 999px; background: rgba(127, 140, 170, .25); overflow: hidden; }
.md-pop-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--md-pop-accent), var(--md-pop-accent-2)); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.md-pop-pct { font-size: .78rem; opacity: .75; font-weight: 700; }
.md-pop-poll-foot { margin-top: 10px; font-size: .78rem; opacity: .7; }
.md-pop-poll-msg { margin-top: 10px; font-size: .85rem; font-weight: 600; color: var(--md-pop-accent); }
.md-pop-closed { color: #ff9aa5; }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 575.98px) {
  .md-pop-overlay { padding: 0; align-items: flex-end; }
  .md-pop-card, .md-pop-size-sm, .md-pop-size-md, .md-pop-size-lg, .md-pop-size-xl {
    max-width: none; width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh;
  }
  .md-pop-media { border-radius: 20px 20px 0 0; }
  .md-pop-media img, .md-pop-media video { max-height: 44vh; }
  .md-pop-ratio-ig { aspect-ratio: 4 / 5; max-height: 56vh; }
  .md-pop-body { padding: 16px 16px 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  .md-pop-actions .md-pop-btn { flex: 1 1 auto; }
  .md-pop-style-slide-right .md-pop-card, .md-pop-style-slide-left .md-pop-card { max-width: none; margin-bottom: 0; }
  .md-pop-style-bottom-bar .md-pop-card { flex-direction: column; align-items: stretch; }
  .md-pop-style-bottom-bar .md-pop-media { width: 100%; }
  .md-pop-opts.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 360px) { .md-pop-opts.is-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .md-pop-overlay, .md-pop-card, .md-pop-bar-fill, .md-pop-btn { transition: none !important; }
  .md-pop-card { transform: none !important; }
}
