/* Export: the free popover under the Export button, the export window, and the upgrade window. */

.ed-export-pop {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; gap: 12px; width: 384px; padding: 16px;
    border: 1px solid var(--ed-line); border-radius: 14px; background: #1f1f1f; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.ed-export-pop[hidden], .ed-export-pop [hidden], .ed-export-dialog [hidden] { display: none; }
.ed-export-pop h2 { margin: 0; font-size: 16px; }
.ed-export-preview { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; border-radius: 10px; background: #000; }
.ed-export-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ed-dim); font-variant-numeric: tabular-nums; }
.ed-export-quality { display: flex; align-items: center; gap: 8px; }
.ed-export-quality select { width: auto; min-height: var(--ed-hit); }
.ed-export-pop .ed-hint { margin: 0; }
.ed-export-wide { justify-content: center; width: 100%; border: 0; cursor: pointer; }
/* A light that sweeps across the upgrade buttons now and then. */
.ed-shine { position: relative; overflow: hidden; }
.ed-shine::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-120%);
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
    animation: ed-shine 3.2s ease-in-out 1s infinite;
}
@keyframes ed-shine { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }

.ed-export-dialog { width: min(440px, calc(100vw - 32px)); }
.ed-export-dialog:focus { outline: none; }
.ed-export-head { display: flex; align-items: center; gap: 12px; }
.ed-export-head > div { flex: 1; min-width: 0; }
.ed-export-dialog .ed-export-head p { margin: 0; }
.ed-export-dialog .ed-spinner:not([hidden]) { display: block; flex: none; }
.ed-export-done { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(34, 197, 94, .15); color: #22c55e; }
.ed-export-bar { width: 100%; height: 8px; margin: 16px 0 6px; accent-color: var(--ed-accent); }
.ed-export-dialog .ed-export-count { display: flex; justify-content: space-between; margin-bottom: 14px; color: var(--ed-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.ed-export-saved { display: grid; gap: 6px; margin: 14px 0; }
.ed-export-dialog .ed-export-saved p { margin: 0; overflow-wrap: anywhere; }
.ed-export-saved [data-role=name] { color: var(--ed-ink); font-weight: 600; }
.ed-export-saved .ed-ghost { justify-self: start; padding: 0; }
.ed-export-upsell { display: grid; gap: 8px; padding: 14px; border: 1px solid rgba(245, 165, 36, .35); border-radius: 12px; background: rgba(245, 165, 36, .08); }
.ed-export-dialog .ed-export-upsell p { margin: 0; }
.ed-export-upsell .ed-upgrade { justify-self: start; border: 0; cursor: pointer; }

.ed-upgrade-dialog {
    position: fixed; width: min(1000px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
    overflow-y: auto; padding: 28px;
}
.ed-upgrade-close { position: absolute; top: 12px; right: 12px; }
.ed-upgrade-dialog h2 { padding-right: 40px; font-size: 22px; }
.ed-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.ed-plan { display: grid; align-content: start; gap: 8px; padding: 16px; border: 1px solid var(--ed-line); border-radius: 12px; background: var(--ed-card); }
.ed-plan.is-featured { border-color: var(--ed-accent); }
.ed-plan h3 { margin: 0; font-size: 15px; }
.ed-upgrade-dialog .ed-plan p { margin: 0; }
.ed-plan-price strong { color: var(--ed-ink); font-size: 24px; }
.ed-plan-price small { display: block; color: var(--ed-dim); }
.ed-plan ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--ed-dim); }
.ed-plan li { display: flex; align-items: center; gap: 8px; }
.ed-plan li .ed-ic { flex: none; width: 16px; height: 16px; color: #22c55e; }
.ed-plan-free li .ed-ic { color: var(--ed-faint); }
.ed-plan .ed-primary { margin-top: 4px; text-decoration: none; }
.ed-periods { display: inline-flex; gap: 2px; margin-bottom: 12px; padding: 3px; border-radius: 10px; background: var(--ed-card); }
.ed-periods[hidden] { display: none; }
.ed-periods button {
    min-height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--ed-dim);
    font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.ed-periods button[aria-pressed=true] { background: var(--ed-accent); color: #fff; }
.ed-plan-current { color: var(--ed-dim); font-weight: 600; }
.ed-upgrade-dialog .ed-upgrade-note {
    display: grid; gap: 10px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--ed-line); border-radius: 12px;
    background: var(--ed-card); color: var(--ed-ink); scroll-margin: 16px;
}
.ed-upgrade-dialog .ed-upgrade-note[hidden] { display: none; }
.ed-upgrade-note .ed-primary { justify-content: center; min-height: 44px; text-decoration: none; }
.ed-upgrade-dialog .ed-upgrade-terms { margin: 0 0 12px; color: var(--ed-dim); font-size: 13px; }
.ed-upgrade-foot { display: flex; justify-content: flex-end; }
.ed-upgrade-foot .ed-primary { text-decoration: none; }

@media (max-width: 899px) {
    .ed-export-pop {
        position: fixed; top: calc(var(--ed-top-h) + 8px + env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right));
        left: max(8px, env(safe-area-inset-left)); width: auto; overflow-y: auto;
        max-height: calc(100vh - var(--ed-top-h) - 16px); max-height: calc(100dvh - var(--ed-top-h) - 16px - env(safe-area-inset-top));
    }
    .ed-upgrade-dialog { padding: 20px 16px; }
}
/* Four cards do not fit one row here, and three would leave the last one alone. */
@media (min-width: 768px) and (max-width: 923px) {
    .ed-plans { grid-template-columns: repeat(2, 1fr); }
}
@media (pointer: coarse) {
    .ed-export-quality select, .ed-export-wide, .ed-plan .ed-primary, .ed-upgrade-foot .ed-primary, .ed-export-dialog button, .ed-periods button { min-height: 44px; }
    .ed-upgrade-close { width: 44px; height: 44px; }
    .ed-export-quality select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .ed-shine::after { animation: none; }
}
