/* Package popup for every page (Views/Shared/_PackagePopup.cshtml, js/package.js), plus the buttons and SMS chip it shares with the home page */
.tm-pkg {
    --o: #ff5000;
    --o-text: #c23c00;
    --tint: #fff4ee;
    --ink: #1f2329;
    --text: #4a4f57;
    --muted: #6b7280;
    --line: #ebe6e2;
    --line-strong: #d9d2cc;
    --warm: #f7f3f0;
    --r-sm: 10px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
}
.tm-pkg *, .tm-pkg *::before, .tm-pkg *::after { box-sizing: border-box; }
/* Undo style.css's bare span rule; :where keeps it from out-ranking the classes below */
.tm-pkg :where(span) { color: inherit; font-size: inherit; }
.tm-pkg :focus-visible { outline: 2px solid var(--o); outline-offset: 2px; }
.tm-pkg svg { flex: none; padding: 0; }

/* ── Buttons ── */
:is(.tm-home, .tm-pkg) .tm-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 22px; margin: 0; border-radius: var(--r-sm); border: 1.5px solid transparent;
    font: inherit; font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none;
    cursor: pointer; transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
/* Same hover as the login buttons */
:is(.tm-home, .tm-pkg) .tm-btn--primary { background: var(--o); border-color: var(--o); color: #fff; }
:is(.tm-home, .tm-pkg) .tm-btn--primary:hover, :is(.tm-home, .tm-pkg) .tm-btn--primary:focus-visible { background: #fff; color: var(--o-text); }
/* For buttons repeated on every row */
:is(.tm-home, .tm-pkg) .tm-btn--ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
:is(.tm-home, .tm-pkg) .tm-btn--ghost:hover, :is(.tm-home, .tm-pkg) .tm-btn--ghost:focus-visible { border-color: var(--o); color: var(--o-text); }
/* Arrow: › gains a shaft on hover (as the login buttons) */
:is(.tm-home, .tm-pkg) .tm-btn__arrow {
    position: relative; top: .06em; width: 10px; height: 10px; margin-left: -1px; overflow: visible;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tm-btn__arrow-line { opacity: 0; transition: opacity .2s ease; }
.tm-btn__arrow-head { transition: transform .2s var(--ease); }
.tm-btn:hover:not(:disabled) .tm-btn__arrow-line, .tm-btn:focus-visible .tm-btn__arrow-line { opacity: 1; }
.tm-btn:hover:not(:disabled) .tm-btn__arrow-head, .tm-btn:focus-visible .tm-btn__arrow-head { transform: translateX(3px); }
:is(.tm-home, .tm-pkg) .tm-btn:disabled { opacity: .6; cursor: default; }

/* SMS chip: a tap opens the SMS app, a click copies (package.js) */
:is(.tm-home, .tm-pkg) .tm-sms {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 32px; margin: 4px 0 0; padding: 0 12px 0 10px;
    border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink);
    font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.tm-sms svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tm-sms .tm-sms__ico { color: var(--o); }
.tm-sms__ok { display: none; color: var(--o-text); }
:is(.tm-home, .tm-pkg) .tm-sms__label { color: var(--muted); font-weight: 600; letter-spacing: .02em; }
:is(.tm-home, .tm-pkg) .tm-sms b { font-weight: 700; color: inherit; }
:is(.tm-home, .tm-pkg) .tm-sms i { font-style: normal; color: var(--muted); transition: transform .25s var(--ease); }
:is(.tm-home, .tm-pkg) .tm-sms span:last-child { font-weight: 600; }
/* Each weight has its own ascent (Bold sits lower), so trim the text to cap height and baseline before centring */
:is(.tm-home, .tm-pkg) .tm-sms > span, :is(.tm-home, .tm-pkg) .tm-sms > b, :is(.tm-home, .tm-pkg) .tm-sms > i { position: relative; top: -1px; }
@supports (text-box: trim-both cap alphabetic) {
    :is(.tm-home, .tm-pkg) .tm-sms > span, :is(.tm-home, .tm-pkg) .tm-sms > b, :is(.tm-home, .tm-pkg) .tm-sms > i { top: 0; text-box: trim-both cap alphabetic; }
}
:is(.tm-home, .tm-pkg) .tm-sms:hover { border-color: var(--o); background: var(--tint); }
:is(.tm-home, .tm-pkg) .tm-sms:hover i { transform: translateX(2px); }
:is(.tm-home, .tm-pkg) .tm-sms.is-copied { border-color: var(--o); background: var(--tint); color: var(--o-text); }
.tm-sms.is-copied .tm-sms__ico { display: none; }
.tm-sms.is-copied .tm-sms__ok { display: block; animation: tm-tick .3s var(--ease-out) both; }
@keyframes tm-tick { from { transform: scale(.4); opacity: 0; } }

/* ── Package popup: z above header (1000), below login modal (1040+) ── */
.tm-pkg { position: fixed; inset: 0; z-index: 1030; display: flex; align-items: center; justify-content: center; padding: 24px; }
.tm-pkg[hidden], .tm-pkg [hidden] { display: none !important; }
/* The support chat button (third-party iframe, z-index 9999) would sit on the Register button */
html:has(.tm-pkg.is-open) #ipcc_chat_iframe { visibility: hidden !important; pointer-events: none !important; }
.tm-pkg__backdrop { position: absolute; inset: 0; background: rgba(17, 17, 17, .5); }
.tm-pkg__dialog {
    position: relative; display: flex; flex-direction: column; width: min(560px, 100%);
    max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
    background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 32px 80px -24px rgba(17, 17, 17, .5);
}
.tm-pkg__close {
    position: absolute; top: 14px; right: 14px; z-index: 2; display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; margin: 0; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255, 255, 255, .94); color: var(--ink); box-shadow: 0 2px 10px rgba(17, 17, 17, .18);
    transition: color .2s ease, background-color .2s ease;
}
.tm-pkg__close:hover { color: var(--o); background: #fff; }
.tm-pkg__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tm-pkg__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tm-pkg__media { aspect-ratio: 3 / 2; overflow: hidden; background: var(--warm); }
.tm-pkg__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tm-pkg__body { display: flex; flex-direction: column; gap: 22px; padding: 24px 28px 26px; }
.tm-pkg__head { display: flex; align-items: last baseline; justify-content: space-between; gap: 16px; }
.tm-pkg__title { min-width: 0; }
.tm-pkg .tm-pkg__badge {
    display: inline-flex; margin: 0 0 8px; padding: 3px 10px; border-radius: 99px; background: var(--tint); color: var(--o-text);
    font-size: 12px; font-weight: 600; line-height: 1.4;
}
.tm-pkg .tm-pkg__name { margin: 0; font-family: var(--font-display); font-size: 32px; line-height: 1.1; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.tm-pkg__price { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tm-pkg .tm-pkg__price strong { font-family: var(--font-display); font-size: 36px; line-height: 1; font-weight: 700; color: var(--o); }
.tm-pkg .tm-pkg__price strong span { font-size: .55em; vertical-align: .62em; margin-right: 1px; }
.tm-pkg .tm-pkg__price s { font-size: 15px; color: var(--muted); }
.tm-pkg__stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 14px 0; border-radius: 14px; background: var(--warm); }
.tm-pkg__stat { padding: 2px 12px; text-align: center; }
.tm-pkg__stat + .tm-pkg__stat { border-left: 1px solid #e6dfd9; }
.tm-pkg .tm-pkg__stat b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.15; font-weight: 700; color: var(--ink); }
.tm-pkg .tm-pkg__stat span { display: block; margin-top: 3px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.tm-pkg__sec { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.tm-pkg .tm-pkg__label { margin: 0; font-size: 12px; line-height: 1.3; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tm-pkg__list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.tm-pkg .tm-pkg__list li { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.tm-pkg__list svg {
    flex: none; width: 22px; height: 22px; margin-top: 0; padding: 4px; border-radius: 50%; background: var(--tint); color: var(--o);
    fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round;
}
.tm-pkg .tm-pkg__text, .tm-pkg .tm-pkg__aside { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text); }
.tm-pkg .tm-pkg__text * { max-width: 100%; }
.tm-pkg .tm-pkg__text p { margin: 0; }
.tm-pkg .tm-pkg__text p + p { margin-top: 8px; }
.tm-pkg__notes { outline: 0; }
.tm-pkg__notes.is-clamped {
    max-height: calc(1.6em * 5); overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}
.tm-pkg .tm-pkg__more {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 0; padding: 4px 0; border: 0; background: none;
    color: var(--o-text); font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; cursor: pointer; transition: color .2s ease;
}
.tm-pkg .tm-pkg__more:hover { color: var(--o); }
.tm-pkg__more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Thin scrollbar that shows only under the pointer */
.tm-pkg__scroll, .tm-pkg__body { --tm-thumb: transparent; }
.tm-pkg__scroll:hover, .tm-pkg__body:hover { --tm-thumb: rgba(17, 17, 17, .18); }
.tm-pkg__scroll::-webkit-scrollbar, .tm-pkg__body::-webkit-scrollbar { width: 4px; }
.tm-pkg__scroll::-webkit-scrollbar-track, .tm-pkg__body::-webkit-scrollbar-track { background: transparent; }
.tm-pkg__scroll::-webkit-scrollbar-thumb, .tm-pkg__body::-webkit-scrollbar-thumb { background: var(--tm-thumb); border-radius: 99px; }
@supports not selector(::-webkit-scrollbar) {
    .tm-pkg__scroll, .tm-pkg__body { scrollbar-width: thin; scrollbar-color: var(--tm-thumb) transparent; }
}
.tm-pkg .tm-pkg__aside { padding: 10px 14px; border-radius: 10px; background: var(--tint); color: var(--o-text); font-size: 14px; font-weight: 600; }
.tm-pkg__rating { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.tm-pkg .tm-pkg__count { font-size: 13px; color: var(--muted); }
/* Footer sits outside the scroll area, so it stays in view */
.tm-pkg__foot {
    display: flex; align-items: center; gap: 12px; padding: 16px 28px 20px; border-top: 1px solid var(--line); background: #fff;
}
.tm-pkg__sms:empty { display: none; }
.tm-pkg .tm-pkg__sms .tm-sms { margin: 0; height: 40px; }
.tm-pkg .tm-pkg__foot .tm-btn { margin-left: auto; min-width: 190px; height: 48px; }

/* Desktop: picture left on warm grey, details right; fits a 768px-tall screen without scrolling */
@media (min-width: 900px) {
    .tm-pkg__dialog {
        display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: minmax(0, 1fr) auto;
        width: min(960px, 100%);
    }
    .tm-pkg__dialog:has(.tm-pkg__media[hidden]) { grid-template-columns: minmax(0, 1fr); width: min(640px, 100%); }
    .tm-pkg__scroll { display: contents; }
    .tm-pkg__media {
        grid-column: 1; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center;
        aspect-ratio: auto; padding: 32px; background: var(--warm);
    }
    .tm-pkg__media img { height: auto; aspect-ratio: 3 / 2; border-radius: 12px; }
    .tm-pkg__body {
        grid-column: -2; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
        gap: 20px; padding: 32px 36px 24px;
    }
    .tm-pkg__head { padding-right: 44px; }
    .tm-pkg__foot { grid-column: -2; grid-row: 2; padding: 16px 36px 24px; }
    .tm-pkg__close { box-shadow: 0 0 0 1px var(--line); }
}

/* Open / close animations */
@keyframes tm-pkg-dim { from { opacity: 0; } }
@keyframes tm-pkg-rise { from { opacity: 0; transform: translateY(28px) scale(.98); } }
@keyframes tm-pkg-item { from { opacity: 0; transform: translateY(10px); } }
@keyframes tm-pkg-undim { to { opacity: 0; } }
@keyframes tm-pkg-sink { to { opacity: 0; transform: translateY(14px) scale(.99); } }
.tm-pkg.is-open .tm-pkg__backdrop { animation: tm-pkg-dim .3s ease both; }
.tm-pkg.is-open .tm-pkg__dialog { animation: tm-pkg-rise .55s var(--ease-out) both; }
.tm-pkg.is-open .tm-pkg__media img { animation: tm-pkg-settle 1.3s var(--ease-out) both; }
.tm-pkg.is-open .tm-pkg__stat,
.tm-pkg.is-open .tm-pkg__list li { animation: tm-pkg-item .6s var(--ease-out) both; animation-delay: calc(.18s + var(--k, 0) * 55ms); }
.tm-pkg.is-closing .tm-pkg__backdrop { animation: tm-pkg-undim .22s ease both; }
.tm-pkg.is-closing .tm-pkg__dialog { animation: tm-pkg-sink .22s ease both; }

@media (max-width: 575px) {
    /* Bottom sheet on phones */
    .tm-pkg { align-items: flex-end; padding: 0; }
    .tm-pkg__dialog {
        width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .tm-pkg__dialog::before {
        content: ""; position: absolute; top: 8px; left: 50%; z-index: 2; width: 40px; height: 4px; margin-left: -20px;
        border-radius: 4px; background: rgba(255, 255, 255, .85); box-shadow: 0 1px 4px rgba(17, 17, 17, .25);
    }
    .tm-pkg__close { top: 12px; right: 12px; width: 36px; height: 36px; }
    .tm-pkg__body { gap: 18px; padding: 20px 18px 22px; }
    .tm-pkg .tm-pkg__name { font-size: 26px; }
    .tm-pkg .tm-pkg__price strong { font-size: 30px; }
    .tm-pkg .tm-pkg__stat b { font-size: 20px; }
    .tm-pkg__foot { flex-wrap: wrap; padding: 12px 18px 16px; }
    .tm-pkg .tm-pkg__foot .tm-btn { flex: 1 1 100%; min-width: 0; margin-left: 0; }
    /* SMS needs no login: a full-width choice above Register */
    .tm-pkg__sms { flex: 1 1 100%; }
    .tm-pkg .tm-pkg__sms .tm-sms { width: 100%; height: 44px; justify-content: center; font-size: 14px; }
    @keyframes tm-pkg-up { from { transform: translateY(100%); } }
    @keyframes tm-pkg-down { to { transform: translateY(100%); } }
    .tm-pkg.is-open .tm-pkg__dialog { animation: tm-pkg-up .5s var(--ease-out) both; }
    .tm-pkg.is-closing .tm-pkg__dialog { animation: tm-pkg-down .25s ease-in both; }
}
@keyframes tm-pkg-settle { from { transform: scale(1.07); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .tm-pkg *, .tm-pkg *::before, .tm-pkg *::after { animation: none !important; transition: none !important; }
}
