/*
 * Gift card FRONTEND, design v2 (config.idefa_gavekort.frontendLayout = v2;
 * docs/frontend-redesign/SPEC.md). Loaded only by the v2 templates (f:asset.css), scoped under
 * .gk-fe. No own visual identity: colours, radius and fonts come from the site's Bootstrap theme;
 * this file only adds what Bootstrap has no class for.
 */

/* Defences against site themes that style bare tags with !important (Danske Hoteller:
   "h1, h2 { font-size: 50px !important; text-transform: uppercase }" and main.css
   ".form-control { margin-bottom: 10px !important }"). The fonts and colours stay the theme's;
   only the sizes and the uppercase that break the layout are taken back. */
.gk-fe h1, .gk-fe h2, .gk-fe h3, .gk-fe h4, .gk-fe h5, .gk-fe h6 {
    text-transform: none !important;
    letter-spacing: normal !important;
}
.gk-fe h1 { font-size: calc(1.4rem + .9vw) !important; line-height: 1.2; }
.gk-fe h2 { font-size: 1.5rem !important; line-height: 1.25; }
/* box titles are h2/h3 class="h5"/"h6": the Bootstrap size the class asks for, not the tag's */
.gk-fe h2.h5, .gk-fe h3.h5 { font-size: 1.25rem !important; line-height: 1.3; }
.gk-fe h3.h6 { font-size: 1rem !important; }
/* a field in an input group must be as tall as its addon ("DKK"): a bottom margin on the field
   leaves the addon hanging below it */
.gk-fe .input-group > .form-control { margin-bottom: 0 !important; height: auto !important; }
/* step buttons side by side: a theme margin on .btn-primary (Danske Hoteller: 15px above and
   below) made the row taller, and "Tilbage" next to it stretched to a tall box */
.gk-fe .gk-step-nav .btn,
.gk-fe .gk-side-nav .btn,
.gk-fe .gk-sum-pay .btn { margin-top: 0 !important; margin-bottom: 0 !important; }
/* the theme's secondary colour is often not part of the site's look; inside the gift card pages
   bg-/text-/border-secondary use Bootstrap's own neutral grey */
/* Both variable spellings: a theme compiled with Bootstrap's default prefix uses --bs-*,
   bootstrap_package themes compiled without one (Danske Hoteller) use --secondary, --btn-*. */
.gk-fe {
    --bs-secondary: #6c757d; --bs-secondary-rgb: 108, 117, 125;
    --secondary: #6c757d; --secondary-rgb: 108, 117, 125;
}
/* secondary buttons (Tilbage, − / +, the quick amounts, the message editor's toolbar) neutral:
   grey border, dark text, a light grey on hover - not filled with the theme's secondary colour,
   which left the editor's dark icons on a dark blue hover */
.gk-fe .btn-outline-secondary {
    --bs-btn-color: #212529; --bs-btn-bg: #fff; --bs-btn-border-color: #adb5bd;
    --bs-btn-hover-color: #212529; --bs-btn-hover-bg: #e9ecef; --bs-btn-hover-border-color: #6c757d;
    --bs-btn-active-color: #212529; --bs-btn-active-bg: #dee2e6; --bs-btn-active-border-color: #6c757d;
    --bs-btn-focus-shadow-rgb: 108, 117, 125;
    --btn-color: #212529; --btn-bg: #fff; --btn-border-color: #adb5bd;
    --btn-hover-color: #212529; --btn-hover-bg: #e9ecef; --btn-hover-border-color: #6c757d;
    --btn-active-color: #212529; --btn-active-bg: #dee2e6; --btn-active-border-color: #6c757d;
    --btn-focus-shadow-rgb: 108, 117, 125;
}

/* boxes (amount, quantity, review, summary, issued cards) */
.gk-fe .gk-box,
.gk-fe .gk-summary {
    padding: 1.25rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, .375rem);
}

/* stepper: done steps are buttons back, the current one is filled. Neutral (the theme's text
   colour), not the secondary colour, which is often not part of the site's look */
.gk-fe .gk-stepper { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 0; margin: 0 0 1.5rem; }
.gk-fe .gk-step-btn {
    display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0;
    background: none; border: 0; color: var(--bs-secondary-color, #6c757d); font: inherit;
}
.gk-fe .gk-step-btn:disabled { cursor: default; opacity: 1; }
.gk-fe .gk-step-no {
    width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid currentColor; font-weight: 700; flex: 0 0 auto;
}
.gk-fe .gk-step-no svg { display: none; width: 1rem; height: 1rem; }
.gk-fe .gk-stepper li.active .gk-step-btn { color: var(--bs-body-color, #212529); font-weight: 600; }
.gk-fe .gk-stepper li.active .gk-step-no { background: var(--bs-body-color, #212529); border-color: var(--bs-body-color, #212529); color: var(--bs-body-bg, #fff); }
.gk-fe .gk-stepper li.done .gk-step-btn { color: var(--bs-body-color, #212529); cursor: pointer; }
.gk-fe .gk-stepper li.done .gk-step-btn:hover .gk-step-name { text-decoration: underline; }
.gk-fe .gk-stepper li.done .gk-step-num { display: none; }
.gk-fe .gk-stepper li.done .gk-step-no svg { display: block; }
@media (max-width: 575.98px) {
    /* phones: circles only, the step name is in the line below ("Trin 2 af 4: Levering") */
    .gk-fe .gk-stepper { gap: .5rem; margin-bottom: .5rem; }
    .gk-fe .gk-step-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
}

/* each step is a box with its heading inside, so the step column lines up with "Din ordre";
   boxes inside a step are white on the step's grey */
.gk-fe .gk-step {
    min-width: 0;
    margin: 0 0 1.5rem;
    padding: 1.25rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, .375rem);
}
.gk-fe .gk-step .gk-box { background: var(--bs-body-bg, #fff); }
/* Bootstrap's reboot floats the legend (and clears the next element), which keeps it inside the box */
.gk-fe .gk-step-title { float: left; width: 100%; margin-bottom: 1rem; }
.gk-fe .gk-step-title:focus { outline: none; }

/* step 1 */
.gk-fe .gk-amount-input { max-width: 16rem; }
.gk-fe .gk-divider { display: flex; align-items: center; gap: 1rem; color: var(--bs-secondary-color, #6c757d); }
.gk-fe .gk-divider::before,
.gk-fe .gk-divider::after { content: ""; flex: 1 1 auto; border-top: 1px solid var(--bs-border-color, #dee2e6); }
.gk-fe .gk-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.gk-fe .gk-product-image { aspect-ratio: 16 / 9; width: 100%; height: auto; object-fit: cover; }
.gk-fe .gk-product.selected {
    border-color: var(--bs-body-color, #212529);
    background: var(--bs-secondary-bg, #e9ecef);
    box-shadow: 0 0 0 .15rem var(--bs-body-color, #212529);
}
.gk-fe .gk-product-more summary { cursor: pointer; color: var(--bs-link-color, inherit); text-decoration: underline; }

/* "Læs mere" pop-up (purchase.js) - native <dialog>, so focus trap, Esc and the top layer come
   from the browser; above any fixed site header */
.gk-fe .gk-product-dialog {
    width: min(720px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0;
    border: 0; border-radius: var(--bs-border-radius-lg, .5rem);
    background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #212529);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .25); overflow: auto;
}
.gk-fe .gk-product-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.gk-fe .gk-product-dialog[open] { animation: gk-dialog-in .18s ease-out; }
.gk-fe .gk-product-dialog[open]::backdrop { animation: gk-backdrop-in .18s ease-out; }
@keyframes gk-dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gk-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .gk-fe .gk-product-dialog[open],
    .gk-fe .gk-product-dialog[open]::backdrop { animation: none; }
}
.gk-fe .gk-product-dialog-inner { position: relative; }
.gk-fe .gk-product-dialog-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gk-fe .gk-product-dialog-body { padding: 1.5rem; }
/* sticky in the scrolling dialog: stays reachable when the text is long */
.gk-fe .gk-product-dialog-close {
    position: sticky; top: .75rem; float: right; margin: .75rem .75rem -3rem 0; z-index: 1;
    padding: .6rem; border-radius: 50%; background-color: rgba(255, 255, 255, .9); opacity: 1;
}
.gk-fe .gk-product-dialog-text :last-child { margin-bottom: 0; }

/* step 2: delivery choices (btn-check radios with a label laid out as a row) */
.gk-fe .gk-choice {
    display: flex; align-items: center; gap: 1rem; text-align: start; padding: .875rem 1rem; min-height: 56px;
    white-space: normal;
}
/* everything in a choice takes the button's colour: a theme colour on <strong> (Danske Hoteller:
   grey) left a chosen title unreadable */
.gk-fe .gk-choice strong,
.gk-fe .gk-choice span { color: inherit !important; }
/* the chosen delivery and quick amount: neutral, not filled with the theme's secondary colour
   (Bootstrap's btn-outline-secondary:checked) - that colour is often not part of the site's look
   (Danske Hoteller: a dark blue found nowhere else). A light background, dark text and a heavier
   border mark the choice on any theme. */
.gk-fe .btn-check:checked + .gk-choice,
.gk-fe .btn-check:checked + .btn.gk-choice:hover,
.gk-fe .btn-check:checked + label.btn-outline-secondary {
    background-color: var(--bs-secondary-bg, #e9ecef) !important;
    color: var(--bs-body-color, #212529) !important;
    border-color: var(--bs-body-color, #212529) !important;
    box-shadow: inset 0 0 0 1px var(--bs-body-color, #212529);
}
.gk-fe .gk-choice-icon { flex: 0 0 auto; display: inline-flex; }
.gk-fe .gk-choice-text { flex: 1 1 auto; }
.gk-fe .gk-choice-price { flex: 0 0 auto; font-weight: 600; }
.gk-fe .gk-qty { width: 9.5rem; flex-wrap: nowrap; }
.gk-fe .gk-qty .btn { min-width: 44px; }

/* "Din ordre" */
.gk-fe .gk-summary dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .375rem 0; }
.gk-fe .gk-summary dt { font-weight: normal; }
.gk-fe .gk-summary dd { margin: 0; text-align: end; }
.gk-fe .gk-sum-total-row { border-top: 1px solid var(--bs-border-color, #dee2e6); margin-top: .25rem; padding-top: .625rem !important; font-weight: 700; }
.gk-fe .gk-sum-total-row dt { font-weight: 700; }
@media (min-width: 992px) {
    /* --gk-sticky-top: set by purchase.js to the height of a fixed/sticky site header + 1rem */
    .gk-fe .gk-summary { position: sticky; top: var(--gk-sticky-top, 1rem); transition: top .15s ease; }
}

/* step 4 review */
.gk-fe .gk-review-row + .gk-review-row { border-top: 1px solid var(--bs-border-color, #dee2e6); margin-top: .75rem; padding-top: .75rem; }

/* thank-you page */
.gk-fe .gk-thanks-icon svg { width: 3.5rem; height: 3.5rem; }
.gk-fe .gk-pay svg { vertical-align: -.2em; }

/* layout "center" (setting purchaseLayout): a narrower column, centred stepper */
.gk-fe.gk-buy-center { max-width: 1000px; margin-left: auto; margin-right: auto; }
.gk-fe.gk-buy-center .gk-stepper { justify-content: center; }
.gk-fe.gk-buy-center .gk-stepper-mobile { text-align: center; }

/* Tjek saldo (pi3) */
.gk-fe .gk-balance { font-size: 2.75rem; font-weight: 700; line-height: 1.1; color: var(--bs-body-color, #212529); font-variant-numeric: tabular-nums; }
.gk-fe .gk-balance-currency { font-size: 1.25rem; font-weight: 600; }
.gk-fe .gk-reader { max-width: 420px; }
.gk-fe .gk-movements td:last-child { font-variant-numeric: tabular-nums; }

/* sticky "Din ordre": bootstrap_package's .section has overflow:hidden, which makes it the sticky
   container (it never scrolls, so nothing sticks). clip cuts the same way without being a scroller.
   Only the section that holds the purchase flow. */
.section:has(.gk-fe .gk-summary),
.frame:has(.gk-fe .gk-summary) { overflow: clip; }

/* gift card page: heading block, centred - logo, title, number/expiry, actions */
.gk-fe .gk-receipt-head { text-align: center; margin-bottom: 1.5rem; }
.gk-fe .gk-receipt-logo { display: block; max-width: 220px; max-height: 90px; width: auto; height: auto; margin: 0 auto .75rem; }
.gk-fe .gk-receipt-seller { font-size: 1.125rem; font-weight: 600; letter-spacing: .02em; margin: 0 0 1.25rem; }
.gk-fe .gk-receipt-title { font-size: calc(1.6rem + .6vw) !important; font-weight: 700; margin-bottom: .5rem; }
.gk-fe .gk-receipt-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; color: var(--bs-secondary-color, #6c757d); margin-bottom: 1.25rem; }
.gk-fe .gk-receipt-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.gk-fe .gk-receipt-actions .btn { min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; }
.gk-fe.gk-receipt-lookup { max-width: 640px; margin: 0 auto; }

/* page layout "Gavekort-gavebevis" (PageTemplates/Layouts/GavekortPrint.html): no site header or
   footer, a quiet background, the content in a centred column */
.gk-printshell { min-height: 100vh; padding: 2.5rem 1rem 3rem; background: var(--bs-tertiary-bg, #f8f9fa); }
.gk-printshell-inner { max-width: 820px; margin: 0 auto; }
.gk-printshell .frame { padding-top: 0; padding-bottom: 0; }
.gk-printshell .frame-container, .gk-printshell .container { max-width: none; padding-left: 0; padding-right: 0; }
/* on the grey page the paper needs no box of its own */
.gk-printshell .gk-fe .gk-paper-wrap { background: none; border: 0; padding: 0; }
.gk-printshell .gk-fe .gk-paper { box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .14); }
@media (max-width: 575.98px) {
    .gk-printshell { padding-top: 1.5rem; }
}

/* gift card page: the A4 card as a "paper" on the grey background, scaled to the content width by
   receipt.js (without JS it scrolls sideways). Printing prints the card only. */
.gk-fe .gk-paper-wrap {
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, .375rem);
    padding: 1.5rem;
    overflow-x: auto;
    box-sizing: content-box;
}
.gk-fe .gk-paper-wrap.scaled { overflow: hidden; display: flex; justify-content: center; }
.gk-fe .gk-paper { background: #fff; box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .12); transform-origin: top center; width: max-content; }
.gk-fe .gk-paper-wrap.scaled .gk-paper { flex: 0 0 auto; }
/* Print = the card alone on one A4 sheet. Everything that neither holds the card nor is part of it is
   removed (display, not visibility: hidden elements would still take space and push the card off the
   page), and the boxes around the card lose what clipped it - the scaled wrap's JS height and
   overflow, and bootstrap_package's .section/.frame overflow:hidden. The card's own print size
   (18 x 26.7 cm, Partials/Receipt/PrintStyle) needs 5 mm margins to fit on one sheet of A4 AND of
   Letter (a printer's default paper may be Letter: 27.9 cm - 2 x 1 cm is shorter than the card). */
@media print {
    @page { size: A4; margin: 5mm; }
    body *:not(:has(.gk-paper)):not(.gk-paper):not(.gk-paper *) { display: none !important; }
    html, body, body *:has(.gk-paper) {
        overflow: visible !important;
        position: static !important;
        width: auto !important; max-width: none !important;
        height: auto !important; min-height: 0 !important; max-height: none !important;
        margin: 0 !important; padding: 0 !important;
        border: 0 !important; background: none !important; box-shadow: none !important;
        transform: none !important;
    }
    body *:has(.gk-paper) { display: block !important; }
    /* Out of the flow, at the top of the first sheet: a site script may push the content down with
       an INLINE "padding-top: …px !important" (a fixed header's height - Let's Eat's
       .bp-page-content), which no stylesheet can override. In the flow the card then started 4-5 cm
       down and ran onto a second sheet; absolutely placed (all ancestors are static, see above) the
       padding only leaves an empty, shorter-than-a-page document behind the card. */
    .gk-fe .gk-paper { position: absolute !important; top: 0; left: 0; right: 0; transform: none !important; box-shadow: none !important; width: auto; }
    .gk-fe .gk-paper .a4page { break-inside: avoid; page-break-inside: avoid; margin: 0 auto !important; }
    body *:has(.gk-paper)::before, body *:has(.gk-paper)::after { display: none !important; }
}

/* step buttons: under "Din ordre" on desktop (purchase.js unhides .gk-side-nav), inside each step on
   phones and without JS */
.gk-fe .gk-side-nav { display: none; }
@media (min-width: 992px) {
    .gk-fe.gk-has-side-nav .gk-side-nav:not([hidden]) { display: flex; }
    .gk-fe.gk-has-side-nav .gk-step-nav { display: none !important; }
}

/* the buyer's personal message: the small editor (settings-rte.js) on the purchase page */
.gk-fe .gk-rte-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .35rem; }
.gk-fe .gk-rte-toolbar .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 34px; padding: .2rem .45rem; border-radius: var(--bs-border-radius, .375rem); }
.gk-fe .gk-rte-toolbar .btn.active { background: var(--bs-secondary-bg, #e9ecef); }
.gk-fe .gk-rte-toolbar .gk-rte-size-sm { font-size: .8rem; font-weight: 700; }
.gk-fe .gk-rte-toolbar .gk-rte-size-lg { font-size: 1rem; font-weight: 700; }
.gk-fe .gk-rte-editor { min-height: 5.5rem; height: auto; overflow-wrap: anywhere; cursor: text; }
.gk-fe .gk-rte-editor:focus { outline: none; }
.gk-fe .gk-rte-editor p { margin: 0; }
.gk-fe .gk-fs-sm, .gk-fs-sm { font-size: .8em; }
.gk-fe .gk-fs-lg, .gk-fs-lg { font-size: 1.35em; line-height: 1.25; }

/* the hidden attribute always wins: themes force display on buttons (Koldingfjord: .btn-primary
   { display: inline-flex !important }), which showed hidden step buttons */
/* doubled selectors: the theme rule .btn-primary:not(.top-wrapper *):not(.gk-admin *) has specificity 0,3,0 */
.gk-fe.gk-fe [hidden][hidden] { display: none !important; }
/* a long word without spaces (e.g. a link) in the message must wrap, not run under the summary */
.gk-fe .gk-review-recipient, .gk-fe .gk-review-recipient * { overflow-wrap: anywhere; }
