/* Ehtesham Law — free-download popup (phone → OTP → download).
 * Own "el-gm" prefix on purpose: .el-gate (notice boxes) and .el-dl (definition
 * lists) are already used elsewhere. Markup: resources/views/front/partials/gate-modal.blade.php
 */
.el-gm { position: fixed; inset: 0; z-index: 100000; /* above the legacy theme's floating widgets (up to 99997) */ display: flex; align-items: center; justify-content: center; padding: 20px; font-family: var(--el-font); }
.el-gm[hidden] { display: none; }
.el-gm *, .el-gm *::before, .el-gm *::after { box-sizing: border-box; }
.el-gm__scrim { position: absolute; inset: 0; background: rgba(7, 23, 38, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: el-gm-fade .2s ease; }

.el-gm__panel {
    position: relative; display: flex; flex-direction: column;
    width: min(460px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
    background: #fff; border-radius: 24px; overflow: hidden;
    box-shadow: 0 40px 80px -24px rgba(7, 23, 38, .55), 0 0 0 1px rgba(255, 255, 255, .06);
    animation: el-gm-pop .28s var(--el-ease);
}
.el-gm__grip { display: none; }

/* ---- Header ---- */
.el-gm__head {
    position: relative; flex-shrink: 0; padding: 22px 24px 18px; color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(242, 165, 43, .28) 0%, rgba(242, 165, 43, 0) 55%),
        linear-gradient(135deg, var(--el-navy-900) 0%, var(--el-navy-700) 100%);
}
.el-gm__x {
    position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 16px; cursor: pointer;
    display: grid; place-items: center; transition: background .15s;
}
.el-gm__x:hover, .el-gm__x:focus-visible { background: rgba(255, 255, 255, .24); outline: none; }
.el-gm__brand { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.el-gm__icon {
    width: 50px; height: 50px; flex-shrink: 0; border-radius: 15px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--el-gold-400), var(--el-gold-500)); color: var(--el-navy-950); font-size: 21px;
    box-shadow: 0 10px 22px -8px rgba(242, 165, 43, .7);
}
.el-gm__titles { min-width: 0; }
.el-gm__eyebrow {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; color: var(--el-gold-400);
}
.el-gm__head h2 { margin: 3px 0 0; color: #fff !important; font: 800 21px/1.2 var(--el-font) !important; letter-spacing: -.01em; }
.el-gm__res {
    display: flex; align-items: center; gap: 9px; margin: 16px 0 0; padding: 10px 12px; border-radius: 12px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
    font-size: 13.5px; font-weight: 600; color: rgba(255, 255, 255, .9);
}
.el-gm__res i { color: #ff8a80; flex-shrink: 0; }
.el-gm__res span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-gm__res:has(span:empty) { display: none; }

/* Step bar */
.el-gm__steps { display: flex; gap: 6px; list-style: none; margin: 16px 0 0; padding: 0; counter-reset: none; }
.el-gm__steps li {
    flex: 1; display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .5);
    padding-top: 10px; border-top: 3px solid rgba(255, 255, 255, .16); transition: color .2s, border-color .2s;
}
.el-gm__steps li span {
    width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px;
    background: rgba(255, 255, 255, .14); color: #fff; flex-shrink: 0;
}
.el-gm:is([data-step="1"], [data-step="login"]) .el-gm__steps li[data-n="1"],
.el-gm[data-step="2"] .el-gm__steps li:is([data-n="1"], [data-n="2"]),
.el-gm[data-step="3"] .el-gm__steps li:not([data-n="4"]),
.el-gm[data-step="4"] .el-gm__steps li { color: #fff; border-color: var(--el-gold-500); }
.el-gm:is([data-step="1"], [data-step="login"]) .el-gm__steps li[data-n="1"] span,
.el-gm[data-step="2"] .el-gm__steps li:is([data-n="1"], [data-n="2"]) span,
.el-gm[data-step="3"] .el-gm__steps li:not([data-n="4"]) span,
.el-gm[data-step="4"] .el-gm__steps li span { background: var(--el-gold-500); color: var(--el-navy-950); }
.el-gm[data-step="login"] .el-gm__steps { display: none; }
.el-gm__ok { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: 14px; background: #e7f6ee; color: #0f6b3c; font-size: 14px; line-height: 1.45; }
.el-gm__field > label small { font-weight: 600; color: var(--el-muted); font-size: 12px; }
.el-gm__field > label .el-gm__link { float: right; font-size: 12.5px; }

/* ---- Body ---- */
.el-gm__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px 22px; }
.el-gm__form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.el-gm__form[hidden], .el-gm__done[hidden] { display: none; }

.el-gm__perks { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.el-gm__perks li {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
    background: var(--el-bg); color: var(--el-body); font-size: 12.5px; font-weight: 600;
}
.el-gm__perks i { color: var(--el-green-600); font-size: 11px; }

.el-gm__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.el-gm__field[hidden] { display: none; }
.el-gm__field > label, .el-gm__label { font-size: 13px; font-weight: 700; color: var(--el-ink); margin: 0; }
.el-gm__control {
    position: relative; display: flex; align-items: center; width: 100%; height: 50px;
    border: 1.5px solid var(--el-line); border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.el-gm__control:focus-within { border-color: var(--el-blue-600); box-shadow: 0 0 0 4px rgba(22, 104, 196, .13); }
.el-gm__control > i { width: 44px; text-align: center; color: var(--el-muted); font-size: 14px; flex-shrink: 0; }
.el-gm__control input {
    flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: 0; background: transparent; box-shadow: none !important;
    padding: 0 14px 0 0; margin: 0; font: 600 15.5px var(--el-font); color: var(--el-ink);
}
.el-gm__control input::placeholder { color: #a5afbd; font-weight: 500; }
.el-gm__cc {
    align-self: stretch; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 14px; margin-right: 12px;
    border-right: 1.5px solid var(--el-line); font-weight: 800; font-size: 15px; color: var(--el-ink);
}
.el-gm__cc::before { content: ""; width: 18px; height: 12px; border-radius: 2px; background: linear-gradient(#ff9933 0 33.3%, #fff 33.3% 66.6%, #138808 66.6%); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.el-gm__control--phone input { letter-spacing: .04em; }
.el-gm__err { font-size: 12.5px; font-weight: 600; color: var(--el-red-600); }
.el-gm__err:empty { display: none; }
.el-gm__field:has(.el-gm__err:not(:empty)) .el-gm__control { border-color: var(--el-red-600); }

/* Segmented channel picker — always one row */
.el-gm__seg { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--el-bg); }
.el-gm__opt { position: relative; margin: 0; min-width: 0; }
.el-gm__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.el-gm__opt span {
    display: flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 6px; border-radius: 10px;
    font-size: 14px; font-weight: 700; color: var(--el-body); white-space: nowrap; transition: all .15s;
}
.el-gm__opt i { font-size: 15px; }
.el-gm__opt input:hover + span { color: var(--el-ink); }
.el-gm__opt input:checked + span { background: #fff; color: var(--el-ink); box-shadow: 0 2px 8px -2px rgba(11, 34, 54, .2), 0 0 0 1px var(--el-line); }
.el-gm__opt--whatsapp input:checked + span i { color: #25d366; }
.el-gm__opt--sms input:checked + span i { color: var(--el-blue-600); }
.el-gm__opt--email input:checked + span i { color: #b26b00; }
.el-gm__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(242, 165, 43, .55); }

/* WhatsApp opt-in */
.el-gm__optin { position: relative; display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--el-body); cursor: pointer; }
.el-gm__optin input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; }
.el-gm__tick {
    width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; border-radius: 6px; border: 1.5px solid #c3ccd8;
    display: grid; place-items: center; color: transparent; font-size: 11px; transition: all .15s;
}
.el-gm__optin input:checked + .el-gm__tick { background: #25d366; border-color: #25d366; color: #fff; }
.el-gm__optin input:focus-visible + .el-gm__tick { box-shadow: 0 0 0 3px rgba(37, 211, 102, .3); }

/* Alerts */
.el-gm__alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: 13.5px; background: #fdecec; color: #9b1c1c; border: 1px solid #f3c7c7; }
.el-gm__alert[hidden] { display: none; }
.el-gm__alert i { margin-top: 3px; }
.el-gm__alert--test { background: var(--el-gold-50); color: #7a4600; border-color: #f6dfb5; }
.el-gm__code { font-size: 15px; letter-spacing: .14em; background: #fff; padding: 1px 7px; border-radius: 6px; }

/* Buttons & links */
.el-gm__btn {
    display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; height: 52px; padding: 0 20px;
    border: 0; border-radius: 14px; cursor: pointer; text-decoration: none !important;
    background: linear-gradient(135deg, var(--el-gold-400), var(--el-gold-500)); color: var(--el-navy-950) !important;
    font: 800 15.5px var(--el-font); box-shadow: 0 12px 24px -12px rgba(242, 165, 43, .9); transition: transform .15s, box-shadow .15s, filter .15s;
}
.el-gm__btn:hover { transform: translateY(-1px); filter: brightness(1.03); box-shadow: 0 16px 28px -12px rgba(242, 165, 43, .95); }
.el-gm__btn:active { transform: none; }
.el-gm__btn:focus-visible { outline: 3px solid rgba(22, 104, 196, .45); outline-offset: 2px; }
.el-gm__btn:disabled { opacity: .7; cursor: progress; transform: none; }
.el-gm__btn--dark { background: linear-gradient(135deg, var(--el-navy-800), var(--el-navy-950)); color: #fff !important; box-shadow: 0 12px 24px -12px rgba(7, 23, 38, .8); }
.el-gm__btn--dark:hover { box-shadow: 0 16px 28px -12px rgba(7, 23, 38, .9); }
.el-gm__link {
    display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer;
    font: 700 13.5px var(--el-font); color: var(--el-blue-600) !important; text-decoration: none !important;
}
.el-gm__link:hover { text-decoration: underline !important; }
.el-gm__link:disabled { color: var(--el-muted) !important; cursor: default; text-decoration: none !important; }
.el-gm__link--wa { color: #128c4a !important; }
.el-gm__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.el-gm__fine { margin: -2px 0 0; text-align: center; font-size: 12.5px; color: var(--el-muted); }
.el-gm__fine i { color: var(--el-green-600); margin-right: 3px; }
.el-gm__fine a { color: var(--el-muted) !important; text-decoration: underline !important; }

/* Step 2 */
.el-gm__sent { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--el-bg); }
.el-gm__sent-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--el-blue-50); color: var(--el-blue-600); font-size: 14px; }
.el-gm__sent > div { flex: 1; min-width: 0; }
.el-gm__sent p { margin: 0; font-size: 12.5px; color: var(--el-muted); }
.el-gm__sent strong { display: block; font-size: 15.5px; color: var(--el-ink); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-gm .el-otp { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.el-gm .el-otp__box {
    width: 100%; max-width: none; height: 58px; padding: 0; border-radius: 14px; border: 1.5px solid var(--el-line); background: #fff;
    text-align: center; font: 800 24px var(--el-font); color: var(--el-ink); caret-color: var(--el-blue-600); transition: border-color .15s, box-shadow .15s, background .15s;
}
.el-gm .el-otp__box.is-filled { border-color: #b9c4d2; background: var(--el-bg-soft); }
.el-gm .el-otp__box:focus { outline: none; border-color: var(--el-blue-600); box-shadow: 0 0 0 4px rgba(22, 104, 196, .13); background: #fff; }

/* Step 3 */
.el-gm__done { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 2px; }
.el-gm__check {
    width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
    background: var(--el-green-600); color: #fff; font-size: 30px; box-shadow: 0 0 0 10px var(--el-green-50);
    animation: el-gm-pop .4s var(--el-ease);
}
.el-gm__done h3 { margin: 6px 0 6px; font: 800 21px var(--el-font) !important; color: var(--el-ink); }
.el-gm__done p { margin: 0 0 18px; font-size: 14.5px; color: var(--el-muted); max-width: 320px; }
.el-gm__more { margin-top: 14px; }
.el-gm[data-step="4"] .el-gm__res { display: none; }

/* ---- Phones: bottom sheet ---- */
@media (max-width: 575.98px) {
    .el-gm { align-items: flex-end; padding: 0; }
    .el-gm__panel {
        width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 22px 22px 0 0;
        animation: el-gm-sheet .32s var(--el-ease);
    }
    .el-gm__grip { display: block; position: absolute; top: 7px; left: 50%; z-index: 2; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, .35); }
    .el-gm__head { padding: 22px 18px 16px; }
    .el-gm__x { top: 14px; right: 12px; }
    .el-gm__head h2 { font-size: 19px !important; }
    .el-gm__icon { width: 44px; height: 44px; font-size: 18px; border-radius: 13px; }
    .el-gm__res { margin-top: 14px; }
    .el-gm__steps { margin-top: 14px; }
    .el-gm__body { padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
    .el-gm__opt span { font-size: 13.5px; gap: 6px; }
    .el-gm .el-otp { gap: 6px; }
    .el-gm .el-otp__box { height: 52px; font-size: 21px; border-radius: 12px; }
}
@media (max-width: 359.98px) {
    .el-gm__opt span { flex-direction: column; gap: 2px; height: 52px; font-size: 12px; }
    .el-gm__steps li { font-size: 0; gap: 0; }
}
/* Laptops / short screens: tighten so the form fits without an inner scrollbar. */
@media (max-height: 780px) {
    .el-gm__perks { display: none; }
    .el-gm__head { padding-top: 18px; padding-bottom: 14px; }
    .el-gm__res, .el-gm__steps { margin-top: 12px; }
    .el-gm__body { padding-top: 16px; padding-bottom: 18px; }
    .el-gm__form { gap: 11px; }
    .el-gm__control { height: 46px; }
    .el-gm__btn { height: 48px; }
    .el-gm .el-otp__box { height: 52px; }
}
@media (max-height: 640px) {
    .el-gm__steps { display: none; }
    .el-gm__icon { width: 42px; height: 42px; font-size: 17px; }
}
/* Short landscape screens: let the whole panel scroll rather than squeezing the body. */
@media (max-height: 560px) and (min-width: 576px) {
    .el-gm { align-items: flex-start; overflow-y: auto; }
    .el-gm__panel { max-height: none; overflow: visible; }
    .el-gm__body { overflow: visible; }
}

@keyframes el-gm-fade { from { opacity: 0; } }
@keyframes el-gm-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes el-gm-sheet { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .el-gm__scrim, .el-gm__panel, .el-gm__check { animation: none; } }

/* Download popup — “welcome back”: optional new password under the download button */
.el-gm__setpw { margin-top: 14px; text-align: center; }
.el-gm__setpw form { margin-top: 12px; text-align: left; }
.el-gm__setpw .el-gm__ok { margin-top: 12px; text-align: left; }
