/* Blazor's FocusOnNavigate (Routes.razor, Selector="h1") moves focus to the page's <h1> after each
   route change so screen-reader/keyboard users land on the title. It stamps tabindex="-1" on that
   heading, so it is never keyboard-tabbable — suppress its focus ring unconditionally. The earlier
   :not(:focus-visible) form was unreliable: browsers (and automation) sometimes resolve the
   programmatic focus as :focus-visible, leaving a stray outline drawn around the hero/page heading.
   Removing the ring here is safe (a tabindex=-1 target receives no keyboard Tab focus, so WCAG 2.4.7
   does not require a visible indicator on it). */
h1[tabindex="-1"]:focus,
h1[tabindex="-1"]:focus-visible {
    outline: none;
}

/* The shop-home hero bleeds to the viewport edges (100vw). Clip any sub-pixel /
   scrollbar-width horizontal overflow so the page body never scrolls sideways
   (per the frontend no-horizontal-scroll rule). */
html, body {
    overflow-x: hidden;
}

/* Smooth-scroll the in-page "Välj tid" anchor jump on the product detail page
   (the target sets scroll-margin-top to clear the fixed AppBar). */
html {
    scroll-behavior: smooth;
    /* Always reserve the vertical scrollbar's space so the layout width never changes
       when page height crosses the viewport. Without this, content that grows taller
       (e.g. selecting a category that reveals a sub-category chip row, or a longer
       product result set) makes the scrollbar appear, narrows the layout, and shifts
       the centred content + 100vw hero sideways — a horizontal jump on every such
       toggle. "stable" keeps the gutter present whether or not the scrollbar shows. */
    scrollbar-gutter: stable;
}

/* AppBar — keep it a single fixed-height row on narrow screens. The brand link
   shrinks and the (possibly long) school name truncates with an ellipsis rather
   than wrapping to a second line, and the auth button label never wraps. Without
   this the Dense AppBar grows taller on mobile, which also breaks the hero's
   flush-to-header offset. */
.storefront-appbar__brand {
    min-width: 0;
    overflow: hidden;
}

.storefront-appbar__title {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storefront-appbar__action {
    white-space: nowrap;
    flex-shrink: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64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zMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* FP-169 — storefront product image (responsive, with placeholder fallback). */
.product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--mud-palette-background-grey, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-image__placeholder {
    color: var(--mud-palette-text-disabled, #bdbdbd);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__image {
    border-top-left-radius: var(--mud-default-borderradius, 4px);
    border-top-right-radius: var(--mud-default-borderradius, 4px);
}

/* Whole-card click: a "stretched link" — the title link's ::after covers the
   entire card, so a click anywhere navigates to the detail page. The action
   button is lifted above the overlay so it stays independently clickable. */
.product-card {
    position: relative;
    cursor: pointer;
    transition: box-shadow 150ms ease;
}

.product-card:hover {
    box-shadow: var(--mud-elevation-8);
}

.product-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Positioning context for the image-overlay badge (block so the anchor wraps the
   image cleanly on desktop; the mobile row overrides display to flex). */
.product-card__image-link {
    display: block;
    position: relative;
}

/* Bundle "Paket" badge pinned to the thumbnail's top-left corner. z-index 2 keeps
   it above the whole-card stretched-link overlay. */
.product-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    margin: 0 !important;
    box-shadow: var(--mud-elevation-3);
}

/* Sold-out ("Fullbokad") banner — a full-width strip across the top of the card image. Overlaid
   (doesn't take a row in the card body); top corners rounded to follow the card. White on the themed
   error red (#C62828) ≈ 5:1. */
.product-card__banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: var(--mud-palette-error);
    color: var(--mud-palette-error-text, #ffffff);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 4px 8px;
    border-radius: var(--mud-default-borderradius, 4px) var(--mud-default-borderradius, 4px) 0 0;
    /* Separate the banner from the image beneath (e.g. a red-toned photo) so it always reads as a ribbon. */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Campaign ("Kampanj") badge — a pill on the image saying how much is off, so a shopper scanning the
   grid sees which items are on sale without reading every price.

   Bottom-left, because the top of the image is already taken: the "Fullbokad" ribbon spans it, the
   "Paket" badge sits top-left and the behörighet chips top-right — and a fully-booked lesson can also
   be on campaign, so the two markings must be able to coexist.

   Burnt orange, and a colour of its own rather than a reuse of a theme token. Red is out: the sold-out
   ribbon owns it, and a lesson can be both fully booked and on campaign. Green was tried and rejected —
   it is the storefront's "you save" language (the bundle savings chip) but it does not read as a sale
   marking, and it disappeared into a green-toned photo. The school's brand colour is out too: it is
   already on the permit chips and the buttons, so the one thing meant to stand out would blend in, and
   the badge must not change meaning because a school picked a different brand.

   #C2410C gives 5.2:1 with white — AA for text at this size. Declared as a token so both the pill and
   any future campaign marking move together. pointer-events:none keeps the pill out of the way of the
   whole-card stretched link beneath it. */
:root {
    --storefront-campaign: #c2410c;
    --storefront-campaign-text: #ffffff;
}

.campaign-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: var(--storefront-campaign);
    color: var(--storefront-campaign-text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
    padding: 3px 9px;
    border-radius: 999px;
    /* A white ring, then a drop shadow. The ring is not decoration: schools photograph their own
       articles, so sooner or later a pill lands on a photo of its own hue and the shadow alone does not
       rescue it (the same weakness the red ribbon above has on a red photo — it gets away with it by
       being a full-width strip). The ring guarantees the pill has an edge on any photograph. */
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.92), 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* Detail hero: a full-width photo makes the card-sized pill look lost. */
.campaign-badge--large {
    bottom: 12px;
    left: 12px;
    font-size: 0.9rem;
    padding: 5px 14px;
}

/* Detail-page image badges (Paket / permit category) — larger and with a stronger
   drop shadow so they pop against the photo. */
.detail-hero-image .mud-chip {
    height: 30px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: var(--mud-elevation-4);
}

/* Bigger, easier-to-tap breadcrumb links. */
.storefront-breadcrumbs .mud-breadcrumb-item,
.storefront-breadcrumbs .mud-breadcrumb-item .mud-typography {
    font-size: 1rem;
}

.storefront-breadcrumbs .mud-breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    padding: 6px 6px;
    border-radius: 6px;
}

.storefront-breadcrumbs .mud-breadcrumb-item a:hover {
    background: var(--mud-palette-action-default-hover);
}

/* Booking time/teacher options as friendly clickable cards (clock icon + time,
   or teacher avatar + name), with hover affordance — instead of plain text rows. */
.booking-times {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 8px;
}

.booking-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background: var(--mud-palette-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.booking-card:hover:not(:disabled) {
    border-color: var(--mud-palette-primary);
    box-shadow: var(--mud-elevation-2);
    background: var(--mud-palette-action-default-hover);
}

.booking-card:disabled {
    opacity: 0.6;
    cursor: default;
}

.booking-card__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.booking-card__title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-card--toggle .booking-card__title {
    flex: 1 1 auto;
}

.booking-card__meta {
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--mud-palette-text-secondary);
}

.booking-card__count {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
}

/* FP-321 — a multi-day course: one bookable card for the whole run, with a toggle that lists
   its days for information (the days are never booked on their own). */
.booking-course {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.booking-course__toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    min-height: 44px;
    padding: 0 8px;
    border: none;
    background: none;
    color: var(--mud-palette-primary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.booking-course__days {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 4px 28px;
    padding: 0;
    list-style: none;
}

.booking-course__days li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

/* Teacher cards are a responsive wrapping grid, indented under their time block. */
.booking-teachers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 4px 28px;
}

.booking-teachers .booking-card {
    flex: 1 1 240px;
    max-width: 360px;
}

/* Mobile: drop the nested "card" feel around the time list (the Välj tid heading +
   teacher select keep their padding) and let the cards use the full width. */
@media (max-width: 599.95px) {
    .storefront-booking {
        padding: 16px 12px !important;
    }

    .storefront-booking .mud-expand-panel-header {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    .booking-teachers {
        margin-left: 12px;
    }

    .booking-teachers .booking-card {
        flex-basis: 100%;
        max-width: none;
    }
}

.product-card__actions {
    position: relative;
    z-index: 2;
}

/* Clamp the listing description to two lines so cards keep a consistent height
   in the grid (the full text lives on the detail page). */
.product-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Desktop/tablet (sm+): pin the price block to the bottom of the card body so the price + VAT sit
   directly above the action button and line up across a row regardless of how long each card's title
   or description is. (On phones the card is a centred single row — handled in the xs block below.) */
@media (min-width: 600px) {
    .product-card .mud-card-content {
        display: flex;
        flex-direction: column;
    }

    /* !important beats MudBlazor's mt-3 utility (also !important) on the price element; the higher
       specificity here wins. Scoped to sm+, so the xs single-row layout keeps its own 4px rule. */
    .product-card .product-card__price {
        margin-top: auto !important;
    }
}

/* FP-261-addon — compact single-row product cards on phones (xs): a full-height
   thumbnail on the left, just the name + price (vertically centred) beside it, and
   an icon-only action button inline on the right. The whole row is no taller than
   its content, and the image stretches to match — so it never exceeds the image.
   From sm up the cards stay vertical (image on top). */
@media (max-width: 599.95px) {
    /* !important overrides MudBlazor's .flex-column / .align-* utility classes
       (which ship with !important) so the card can become a row on phones. */
    .product-card {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }

    /* Left thumbnail fills the row's full height as a fixed-width band. */
    .product-card__image-link {
        display: flex;
        flex: 0 0 104px;
        align-self: stretch;
    }

    .product-card .product-card__image {
        width: 104px;
        height: 100%;
        aspect-ratio: auto;
        border-radius: var(--mud-default-borderradius, 4px) 0 0 var(--mud-default-borderradius, 4px);
    }

    /* Details column: chips + name + short description + price, vertically centred. */
    .product-card .mud-card-content {
        flex: 1 1 auto !important;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        padding: 10px 12px !important;
    }

    /* The VAT caption is dropped on the row; the price already reads "inkl. moms"
       on the detail page. Chips + description stay so the row carries enough info. */
    .product-card .product-card__vat {
        display: none !important;
    }

    .product-card .product-card__chips {
        margin-bottom: 2px !important;
    }

    /* The row's thumbnail is a 104px band — tighten the campaign pill's inset and size so it reads as
       sitting on the image rather than filling it. "−25 %" is ~36px at this size, so it still fits. */
    .product-card .campaign-badge {
        bottom: 5px;
        left: 5px;
        font-size: 0.68rem;
        padding: 2px 7px;
    }

    /* Name on a single line (ellipsis if long) — the description carries the detail. */
    .product-card .product-card__title {
        margin: 0;
        font-size: 0.95rem;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-card .product-card__price {
        margin-top: 4px !important;
    }

    /* Icon action pinned inline on the right, vertically centred. */
    .product-card .product-card__actions {
        flex: 0 0 auto !important;
        align-self: center;
        padding: 0 8px;
    }
}

/* Cart count pill in the app bar. MudBlazor's overlap badge is offset with
   translate(50%, -50%), so on the dense, fixed app bar it overflows above the top edge
   and gets clipped. Pin it just inside the icon's top-right corner instead. The
   .mud-badge-root qualifier raises specificity above MudBlazor's own positioning rules. */
.mud-appbar .mud-badge-root .mud-badge.mud-badge-overlap {
    transform: none !important;
    top: 4px !important;
    right: 4px !important;
    bottom: auto !important;
    left: auto !important;
}

/* FP-283 — bundle contents render as a plain semantic <ul> (not a MudList, which emits an
   unnamed role="listbox" with role="option" items that nest the article links). Reset list chrome. */
.bundle-contents {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* FP-283 (WCAG 1.4.3) — MudBreadcrumbs renders the current (disabled) item in #bdbdbd (1.87:1 on
   white) and the link items in the brand colour. Force a contrast-compliant grey on both so the
   trail is readable regardless of the per-school brand colour. */
.storefront-breadcrumbs .mud-breadcrumb-item a,
.storefront-breadcrumbs .mud-breadcrumb-item .mud-typography {
    color: #4a4a4a;
}

/* FP-283 — brand-coloured TEXT and outlines on the white storefront use an AA-safe (≥4.5:1 on white)
   darkened variant of the brand colour. The server computes it (StorefrontConfigResponse.BrandColorOnLight)
   and the layout sets --storefront-brand-on-light per school; the default below applies until config loads
   or for the tenant-less shell. The raw brand colour stays reserved for FILLS (app bar, filled buttons),
   which compute their own contrasting text — so darkening here never touches those. */
.mud-layout {
    --storefront-brand-on-light: #1565c0;
}
/* MudBlazor's .mud-primary-text is an !important text-colour utility, so this override must also be
   !important (with higher specificity) to win — for both MudText and MudLink primary-coloured text. */
.mud-layout .mud-primary-text,
.mud-layout .mud-link.mud-primary-text {
    color: var(--storefront-brand-on-light) !important;
}
.mud-layout .mud-button-outlined.mud-button-outlined-primary {
    color: var(--storefront-brand-on-light);
    border-color: var(--storefront-brand-on-light);
}
/* Outlined primary chips (e.g. the category sub-filter chips) put the brand colour on a white fill —
   use the AA-safe darkened brand for the label + border. Filled chips are unaffected (white-on-brand). */
.mud-layout .mud-chip-outlined.mud-chip-color-primary {
    color: var(--storefront-brand-on-light);
    border-color: var(--storefront-brand-on-light);
}

/* FP-283 (WCAG 2.1 AA) — respect the OS "reduce motion" preference: drop animations,
   transitions, and smooth scrolling for users who request reduced motion. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.cart-button .mud-badge{
    pointer-events: none;
}

/* FP-166-addon — campaign discount price display. The effective price leads; the ordinary price is
   shown struck through. The <s> element + the visually-hidden "Ordinarie pris" label convey the meaning
   to assistive tech, so the discount is not communicated by colour alone (WCAG 2.1 AA). */
.product-card__price-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.product-card__price--original,
.detail-price--original {
    text-decoration: line-through;
    color: var(--mud-palette-text-secondary);
    font-size: 0.9rem;
}

/* Visually-hidden text exposed only to screen readers. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* FP-164-addon — the product-listing sort dropdown (PopoverClass="listing-sort-popover").
   The school brand primary can be a pale colour with poor contrast on white, and MudSelect renders
   the *selected* option's text in that primary colour — making it hard to read. Keep the selected
   option in normal readable text with a neutral grey selected-row tint instead of the brand tint.
   The popover renders at body level, so this lives in the global stylesheet (scoped ::deep can't reach it). */
.listing-sort-popover .mud-selected-item.mud-primary-text,
.listing-sort-popover .mud-selected-item.mud-primary-text .mud-list-item-text {
    color: var(--mud-palette-text-primary) !important;
}

.listing-sort-popover .mud-selected-item {
    background-color: var(--mud-palette-action-default-hover) !important;
}