/* ==========================================================================
   AP Maskiner — header-søgning (resultater i #ap-search-products)
   Selvstændig styling, så den ikke afhænger af header-snippet'ens egen CSS.
   Alle farver ligger som custom properties og kan overskrives udefra.
   ========================================================================== */

.apm-hs {
    --apm-hs-blue:   #2F5D8D;
    --apm-hs-orange: #F85E2D;
    --apm-hs-ink:    #14181D;
    --apm-hs-muted:  #6B7684;
    --apm-hs-line:   rgba(20, 24, 29, 0.10);
    --apm-hs-hover:  rgba(47, 93, 141, 0.06);
    --apm-hs-radius: 14px;
    --apm-hs-ease:   cubic-bezier(0.23, 1, 0.32, 1);

    font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
    color: var(--apm-hs-ink);
}

.apm-hs *,
.apm-hs *::before,
.apm-hs *::after { box-sizing: border-box; }

/* ── Beskeder / tomme tilstande ─────────────────────────────────────────── */
.apm-hs__msg {
    margin: 0;
    padding: 4px 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--apm-hs-muted);
}

.apm-hs__msg--error { color: var(--apm-hs-orange); }

/* ── Resultatliste ──────────────────────────────────────────────────────── */
.apm-hs__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.apm-hs-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border-radius: var(--apm-hs-radius);
    text-decoration: none;
    color: inherit;
    background-color: transparent;
    transition: background-color 220ms ease, transform 260ms var(--apm-hs-ease);
    animation: apm-hs-in 320ms var(--apm-hs-ease) both;
}

.apm-hs__list > .apm-hs-card:nth-child(1) { animation-delay: 0ms; }
.apm-hs__list > .apm-hs-card:nth-child(2) { animation-delay: 40ms; }
.apm-hs__list > .apm-hs-card:nth-child(3) { animation-delay: 80ms; }
.apm-hs__list > .apm-hs-card:nth-child(4) { animation-delay: 120ms; }
.apm-hs__list > .apm-hs-card:nth-child(5) { animation-delay: 160ms; }
.apm-hs__list > .apm-hs-card:nth-child(6) { animation-delay: 200ms; }

@keyframes apm-hs-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) and (pointer: fine) {
    .apm-hs-card:hover,
    .apm-hs-card:focus-visible {
        background-color: var(--apm-hs-hover);
        outline: none;
    }
    .apm-hs-card:hover .apm-hs-card__arrow,
    .apm-hs-card:focus-visible .apm-hs-card__arrow {
        background-color: var(--apm-hs-orange);
        color: #fff;
        transform: translateX(2px);
    }
    .apm-hs-card:hover .apm-hs-card__title {
        color: var(--apm-hs-blue);
    }
}

.apm-hs-card__img {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background-color: rgba(20, 24, 29, 0.05);
    display: block;
}

.apm-hs-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apm-hs-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.apm-hs-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--apm-hs-muted);
    line-height: 1.2;
}

.apm-hs-card__tag {
    color: var(--apm-hs-orange);
}

.apm-hs-card__price {
    color: var(--apm-hs-blue);
    letter-spacing: 0.02em;
}

.apm-hs-card__title {
    font-family: 'Oswald', 'Source Sans 3', system-ui, sans-serif;
    font-size: 1.0625rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.005em;
    color: var(--apm-hs-ink);
    transition: color 200ms ease;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apm-hs__mark {
    background-color: rgba(248, 94, 45, 0.18);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

.apm-hs-card__intro {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--apm-hs-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apm-hs-card__arrow {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(20, 24, 29, 0.05);
    color: var(--apm-hs-muted);
    transition: background-color 240ms ease, color 240ms ease, transform 320ms var(--apm-hs-ease);
}

.apm-hs-card__arrow svg { width: 13px; height: 13px; }

/* ── "Se alle resultater" ───────────────────────────────────────────────── */
.apm-hs__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--apm-hs-line);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--apm-hs-blue);
    text-decoration: none;
    transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease;
}

.apm-hs__more svg { width: 14px; height: 14px; }

@media (hover: hover) and (pointer: fine) {
    .apm-hs__more:hover,
    .apm-hs__more:focus-visible {
        background-color: var(--apm-hs-blue);
        border-color: var(--apm-hs-blue);
        color: #fff;
        outline: none;
    }
}

/* ── Skeletons ──────────────────────────────────────────────────────────── */
.apm-hs__skels {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.apm-hs__skel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
}

.apm-hs__skel-img {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    flex: 0 0 auto;
}

.apm-hs__skel-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.apm-hs__skel-line {
    height: 12px;
    border-radius: 6px;
    width: 70%;
    display: block;
}

.apm-hs__skel-line--short { width: 40%; }

.apm-hs__skel-img,
.apm-hs__skel-line {
    background: linear-gradient(90deg,
        rgba(20, 24, 29, 0.06) 25%,
        rgba(20, 24, 29, 0.11) 37%,
        rgba(20, 24, 29, 0.06) 63%);
    background-size: 400% 100%;
    animation: apm-hs-shimmer 1.4s ease infinite;
}

@keyframes apm-hs-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ── Mørk søgemodal (hvis panelet er mørkt) ─────────────────────────────── */
.apm-hs.apm-hs--dark {
    --apm-hs-ink:   #ffffff;
    --apm-hs-muted: rgba(255, 255, 255, 0.62);
    --apm-hs-line:  rgba(255, 255, 255, 0.16);
    --apm-hs-hover: rgba(255, 255, 255, 0.07);
}

.apm-hs.apm-hs--dark .apm-hs-card__img,
.apm-hs.apm-hs--dark .apm-hs-card__arrow {
    background-color: rgba(255, 255, 255, 0.08);
}

.apm-hs.apm-hs--dark .apm-hs__more { color: #fff; }

/* ── Responsivt ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .apm-hs-card { gap: 12px; padding: 8px; }
    .apm-hs-card__img,
    .apm-hs__skel-img { width: 54px; height: 54px; }
    .apm-hs-card__title { font-size: 1rem; }
    .apm-hs-card__intro { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .apm-hs-card { animation: none; }
    .apm-hs__skel-img,
    .apm-hs__skel-line { animation: none; }
    .apm-hs *,
    .apm-hs *::before,
    .apm-hs *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   PRODUKTOMRÅDER (#ap-search-cats)
   ========================================================================== */
.apm-hs-cats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.apm-hs-cat {
    list-style: none;
    animation: apm-hs-in 300ms var(--apm-hs-ease) both;
}

.apm-hs-cats > .apm-hs-cat:nth-child(1) { animation-delay: 0ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(2) { animation-delay: 35ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(3) { animation-delay: 70ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(4) { animation-delay: 105ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(5) { animation-delay: 140ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(6) { animation-delay: 175ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(7) { animation-delay: 210ms; }
.apm-hs-cats > .apm-hs-cat:nth-child(8) { animation-delay: 245ms; }

.apm-hs-cat__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 200ms ease;
}

.apm-hs-cat__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}

.apm-hs-cat__parent {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--apm-hs-muted);
    line-height: 1.2;
}

.apm-hs-cat__name {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--apm-hs-ink);
    transition: color 200ms ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apm-hs-cat__count {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--apm-hs-muted);
    white-space: nowrap;
}

.apm-hs-cat__arrow {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--apm-hs-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 200ms ease, transform 280ms var(--apm-hs-ease), color 200ms ease;
}

.apm-hs-cat__arrow svg { width: 12px; height: 12px; }

@media (hover: hover) and (pointer: fine) {
    .apm-hs-cat__link:hover,
    .apm-hs-cat__link:focus-visible {
        background-color: var(--apm-hs-hover);
        outline: none;
    }
    .apm-hs-cat__link:hover .apm-hs-cat__name,
    .apm-hs-cat__link:focus-visible .apm-hs-cat__name {
        color: var(--apm-hs-blue);
    }
    .apm-hs-cat__link:hover .apm-hs-cat__arrow,
    .apm-hs-cat__link:focus-visible .apm-hs-cat__arrow {
        opacity: 1;
        transform: translateX(0);
        color: var(--apm-hs-orange);
    }
}

/* Skeleton-variant til kategori-kolonnen (kun én linje pr. række) */
.apm-hs__skel--row {
    padding: 11px 10px;
}

.apm-hs__skel--row .apm-hs__skel-line {
    width: 80%;
}

@media (prefers-reduced-motion: reduce) {
    .apm-hs-cat { animation: none; }
    .apm-hs-cat__arrow { opacity: 1; transform: none; }
}

/* ==========================================================================
   NYHEDER (#ap-search-news)
   ========================================================================== */
.apm-hs__label {
    margin: 0 0 8px;
    padding: 0 2px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--apm-hs-muted);
}

.apm-hs-newslist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.apm-hs-news {
    list-style: none;
    animation: apm-hs-in 300ms var(--apm-hs-ease) both;
}

.apm-hs-newslist > .apm-hs-news:nth-child(1) { animation-delay: 0ms; }
.apm-hs-newslist > .apm-hs-news:nth-child(2) { animation-delay: 40ms; }
.apm-hs-newslist > .apm-hs-news:nth-child(3) { animation-delay: 80ms; }
.apm-hs-newslist > .apm-hs-news:nth-child(4) { animation-delay: 120ms; }
.apm-hs-newslist > .apm-hs-news:nth-child(5) { animation-delay: 160ms; }

.apm-hs-news__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 200ms ease;
}

.apm-hs-news__img {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(20, 24, 29, 0.05);
    display: block;
}

.apm-hs-news__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apm-hs-news__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.apm-hs-news__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--apm-hs-muted);
    line-height: 1.2;
}

.apm-hs-news__cat {
    color: var(--apm-hs-orange);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.apm-hs-news__title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--apm-hs-ink);
    transition: color 200ms ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
    .apm-hs-news__link:hover,
    .apm-hs-news__link:focus-visible {
        background-color: var(--apm-hs-hover);
        outline: none;
    }
    .apm-hs-news__link:hover .apm-hs-news__title,
    .apm-hs-news__link:focus-visible .apm-hs-news__title {
        color: var(--apm-hs-blue);
    }
}

.apm-hs.apm-hs--dark .apm-hs-news__img {
    background-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
    .apm-hs-news__img { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
    .apm-hs-news { animation: none; }
}
