/* =========================================================================
 * TDW Desktop Mega-Menu
 *
 * Strategi for tema-håndtering:
 *   Flatsome's .nav-dropdown kommer i to varianter — default (lys) og .dark.
 *   I stedet for at hardcode farver lader vi tekst arve fra parent (color: inherit)
 *   og target kun specifikke elementer (badges, billeder, separatorer) hvor vi
 *   reelt har brug for en eksplicit farve.
 *
 *   For elementer der SKAL adapte (border-color, hover-bg, secondary text):
 *   bruger vi currentColor + opacity, eller separate rules under .dark.
 * ========================================================================= */

.tdw-dm {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
    gap: 32px;
    padding: 24px;
    color: inherit;                /* arv fra .nav-dropdown */
}

.tdw-dm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
    align-content: start;
}
@media (max-width: 1100px) {
    .tdw-dm { grid-template-columns: 1fr; }
    .tdw-dm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Brand card -------------------------------------------------------- */

.tdw-dm-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    color: inherit !important;
    text-decoration: none !important;
    transition: background-color .15s, transform .15s;
    min-height: 56px;
}
/* Hover: brug currentColor med lav opacity. Virker i både light og dark. */
.tdw-dm-card:hover,
.tdw-dm-card:focus-visible {
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}
.dark .tdw-dm-card:hover,
.dark .tdw-dm-card:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

.tdw-dm-card-thumb {
    /* Ingen baggrundsfarve — logoer der har brug for hvid bg har det bagt ind i
       selve PNG'en (samme princip som mobil-menuen). Transparente logoer
       blender med dropdown'ens mørke baggrund. */
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;      /* contain i stedet for 80% — undgår beskæring af brede logoer */
    flex-shrink: 0;
}

.tdw-dm-card-thumb-empty {
    background-color: rgba(127, 127, 127, 0.08);
}

.tdw-dm-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}
.tdw-dm-card-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;                /* tekstfarve arves fra dropdown */
}

/* ---- Badges ------------------------------------------------------------ */

.tdw-dm-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tdw-dm-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.4;
    white-space: nowrap;
}
.tdw-dm-badge-popular {
    background: #d63638;
    color: #fff;
}
.tdw-dm-badge-new {
    background: #2271b1;
    color: #fff;
}
.tdw-dm-badge-sale {
    background: #f0b849;
    color: #1a1a1a;
}

/* ---- Featured / bestseller spotlight ----------------------------------- */

.tdw-dm-featured {
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding-left: 24px;
    display: flex;
    flex-direction: column;
}
.dark .tdw-dm-featured {
    border-left-color: rgba(255, 255, 255, 0.1);
}
@media (max-width: 1100px) {
    .tdw-dm-featured {
        border-left: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding-left: 0;
        padding-top: 16px;
    }
    .dark .tdw-dm-featured {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}
.tdw-dm-featured-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.6;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.dark .tdw-dm-featured-heading {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.tdw-dm-featured-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: inherit !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 8px;
    margin: -8px;
    transition: background-color .15s;
    position: relative;
}
.tdw-dm-featured-card:hover,
.tdw-dm-featured-card:focus-visible {
    background: rgba(0, 0, 0, 0.04);
}
.dark .tdw-dm-featured-card:hover,
.dark .tdw-dm-featured-card:focus-visible {
    background: rgba(255, 255, 255, 0.05);
}
.tdw-dm-featured-image {
    /* Produktbilleder har typisk hvid baggrund bagt ind. Vi bruger contain
       så hele billedet vises uden beskæring. */
    aspect-ratio: 1;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    border-radius: 6px;
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
}

.tdw-dm-featured-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.tdw-dm-featured-sale-badge {
    align-self: flex-start;
    background: #f0b849;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 4px;
}
.tdw-dm-featured-brand {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.6;
}
.tdw-dm-featured-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tdw-dm-featured-price {
    font-size: 14px;
    font-weight: 700;
    color: inherit;
    margin-top: 2px;
}
.tdw-dm-featured-price .woocommerce-Price-amount,
.tdw-dm-featured-price ins,
.tdw-dm-featured-price del {
    color: inherit;
    text-decoration: none;
}
.tdw-dm-featured-price del {
    opacity: 0.5;
    font-weight: 400;
    margin-right: 6px;
}
.tdw-dm-featured-price ins {
    text-decoration: none;
}
.tdw-dm-featured-cta {
    font-size: 12px;
    color: inherit;
    opacity: 0.75;
    margin-top: 4px;
    font-weight: 500;
}
.tdw-dm-featured-card:hover .tdw-dm-featured-cta {
    opacity: 1;
}


/* ---- Featured slider (bestseller fra top brands) ---------------------- *
 * Manuel navigation via pile + dots. Hvert slide er et fuldt Flatsome
 * product-kort med WVS variation picker — vi rører ikke produkt-logikken.
 * ---------------------------------------------------------------------- */

.tdw-dm-featured[data-tdw-dm-slider] {
    /* Override de gamle .tdw-dm-featured-* styles fra non-slider versionen */
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.dark .tdw-dm-featured[data-tdw-dm-slider] {
    border-left-color: rgba(255, 255, 255, 0.1);
}
@media (max-width: 1100px) {
    .tdw-dm-featured[data-tdw-dm-slider] {
        border-left: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        padding-left: 0;
        padding-top: 16px;
    }
    .dark .tdw-dm-featured[data-tdw-dm-slider] {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* Header med kun titel — pile er flyttet til bunden */
.tdw-dm-featured-header {
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 4px;
}
.dark .tdw-dm-featured-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
.tdw-dm-featured-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.7;
    margin: 0;
    /* Tillad wrap så brand-navne kan vises uden ellipsis. min-width:0 så
       containerens flex-children ikke forstrækker grænsen. */
    word-break: break-word;
    min-width: 0;
}
.tdw-dm-featured-brand-name {
    color: inherit;
    opacity: 1;
    font-weight: 700;
}

/* Controls-række i bunden: [‹]  [dots]  [›]
   Layout: tre auto-sized celler centreret som gruppe. Brug 'fit-content'
   container med margin: 0 auto så hele blokken kommer i midten af kolonnen
   uden at flexbox skubber pilene udad. */
.tdw-dm-featured-controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    /* gap på .tdw-dm-featured wrapper håndterer afstand til kortet ovenfor */
}
/* Wrap controls i en container der centrerer hele blokken. Vi tilføjer
   denne ved at lave .tdw-dm-featured til en flex-column med center-aligned
   children. Featured er allerede flex-column, så vi tilføjer align-items: */
.tdw-dm-featured[data-tdw-dm-slider] {
    align-items: stretch;          /* default for resten af content */
}
.tdw-dm-featured[data-tdw-dm-slider] > .tdw-dm-featured-controls {
    align-self: center;            /* centrerer kun controls-rækken */
}
.tdw-dm-featured-arrow {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s, transform .15s;
    flex-shrink: 0;
    opacity: 0.75;
}
.tdw-dm-featured-arrow svg {
    display: block;
}
.tdw-dm-featured-arrow:hover,
.tdw-dm-featured-arrow:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    opacity: 1;
    transform: scale(1.05);
}
.tdw-dm-featured-arrow:active {
    transform: scale(0.95);
}

/* Slide-container — alle slides stacked, kun .is-active er synlig */
.tdw-dm-featured-slides {
    position: relative;
}
.tdw-dm-featured-slide {
    display: none;
}
.tdw-dm-featured-slide.is-active {
    display: block;
    animation: tdwDmFade .25s ease-out;
}
@keyframes tdwDmFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Counter "X / Y" i midten mellem pilene */
.tdw-dm-featured-counter {
    font-size: 12px;
    font-weight: 500;
    color: inherit;
    opacity: 0.7;
    min-width: 36px;
    text-align: center;
    font-variant-numeric: tabular-nums;     /* tal-bredde fast så centrering ikke wobbler */
    user-select: none;
}
.tdw-dm-featured-counter [data-tdw-dm-current] {
    font-weight: 700;
    opacity: 1;
}

/* Tynd progress-bar under controls — viser auto-rotation countdown */
.tdw-dm-featured-progress {
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
    margin-top: 4px;
}
.tdw-dm-featured-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    transform-origin: left center;
    transform: scaleX(0);
    animation: tdwDmFill var(--tdw-progress-duration, 5s) linear infinite;
}
/* Pause animationen når brugeren hover'er sliderens content */
.tdw-dm-featured-controls.is-paused ~ .tdw-dm-featured-progress .tdw-dm-featured-progress-bar,
[data-tdw-dm-slider]:hover .tdw-dm-featured-progress-bar {
    animation-play-state: paused;
}
/* Skjul progress-bar når der kun er 1 slide */
.tdw-dm-featured-controls.is-no-auto ~ .tdw-dm-featured-progress {
    display: none;
}
@keyframes tdwDmFill {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ---- Product card inde i slider ---------------------------------------
 * Wrapper class .tdw-dm-product-card lader os over-style størrelsen uden at
 * røre Flatsome's egen content-product CSS. Vi tvinger compact-layout passende
 * til mega-menu konteksten.
 * ---------------------------------------------------------------------- */

.tdw-dm-product-card {
    /* Reset Flatsome's loop-product padding så card fylder slide-pladsen */
    margin: 0;
    padding: 0;
}
.tdw-dm-product-card .product-small {
    margin: 0;
}
.tdw-dm-product-card .box-image {
    /* Constrain billede-størrelse i menu konteksten */
    max-width: 220px;
    margin: 0 auto;
}
.tdw-dm-product-card .box-text {
    padding: 12px 0 0;
    text-align: left;
}
.tdw-dm-product-card .name {
    font-size: 14px !important;
    line-height: 1.35 !important;
    font-weight: 600 !important;
}
.tdw-dm-product-card .price-wrapper {
    margin-top: 4px;
    font-size: 14px;
}
.tdw-dm-product-card .price-wrapper .price {
    color: inherit;
}
/* WC's ins/del kan have weird colors arvet — tving til at matche dark theme */
.dark .tdw-dm-product-card .price ins,
.dark .tdw-dm-product-card .price del,
.dark .tdw-dm-product-card .price .amount {
    color: inherit !important;
}
/* WVS variation picker — ensartet placering + spacing */
.tdw-dm-product-card .woo-variation-items-wrapper {
    list-style: none;
    margin: 8px 0;
    padding: 0;
}
.tdw-dm-product-card .add-to-cart-button {
    margin-top: 8px;
}
.tdw-dm-product-card .button.add_to_cart_button,
.tdw-dm-product-card .button.product_type_variable {
    width: 100%;
    margin: 0;
}

/* =========================================================================
 * TDW Desktop Mega-Menu — SECTION ROWS variant
 *
 * Brugt af: Interiør, Eksteriør, Bilvask, Tilbehør (alle ikke-Mærker roots).
 *
 * Layout: vertikalt stablede sektion-rows. Hver row har:
 *   - Compact thumbnail til venstre (160x100, 16:10 aspect)
 *   - Body til højre med heading + links samlet i én blok
 *
 * Designprincipper:
 *   - Tæt typografi, ikke airy whitespace
 *   - Heading sits naturligt over links (samme kolonne, ikke separat)
 *   - Links bruger 2 kolonner (auto-flow med max 6 i 3 columns hvis plads)
 *   - Subtle hover states — hvid text + lille translateX på links
 *   - Tynd primær-farve underline på heading (matcher brand)
 *
 * Class prefix: .tdw-dg ("desktop groups").
 * ========================================================================= */

.tdw-dg {
    display: flex;
    flex-direction: column;
    padding: 20px 28px;
    color: inherit;
}

/* Section divider — tynd og diskret */
.tdw-dg-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 0;
}

/* ---- Section row -------------------------------------------------------- */
.tdw-dg-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 24px;
    padding: 18px 0;
    align-items: start;
}

/* Når der ikke er billede, drop venstre kolonne helt */
.tdw-dg-row:not(.tdw-dg-row--has-image) {
    grid-template-columns: 1fr;
}

/* ---- Thumbnail ---------------------------------------------------------- */
.tdw-dg-row__media {
    display: block;
    width: 160px;
    aspect-ratio: 16 / 10;
    border-radius: 4px;
    overflow: hidden;
    line-height: 0;
    background-color: rgba(255, 255, 255, 0.04);
    position: relative;
}

.tdw-dg-row__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.tdw-dg-row__media:hover .tdw-dg-row__image {
    transform: scale(1.05);
}

/* Subtle gradient overlay på image så det matcher dark theme bedre */
.tdw-dg-row__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.25) 100%);
    pointer-events: none;
}

/* ---- Body (heading + links) -------------------------------------------- */
.tdw-dg-row__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 14px;
}

/* ---- Heading ----------------------------------------------------------- */
.tdw-dg-row__heading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    padding-bottom: 10px;
    border-bottom: 2px solid #fff;          /* solid full underline matches brand premium */
    align-self: flex-start;
    transition: color 0.2s ease, border-color 0.2s ease;
    line-height: 1.2;
}

.tdw-dg-row__heading:hover {
    color: #fff;
    border-bottom-color: var(--fs-color-primary, #11519B);
}

.tdw-dg-row__heading-arrow {
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.85;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.tdw-dg-row__heading:hover .tdw-dg-row__heading-arrow {
    transform: translateX(3px);
    opacity: 1;
}

/* ---- Links grid -------------------------------------------------------- */
.tdw-dg-row__links {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 28px;
}

/* Auto-collapse hvis der er 1-2 children (undgå tomme kolonner) */
.tdw-dg-row__links:has(> li:nth-child(1):last-child) {
    grid-template-columns: 1fr;
}
.tdw-dg-row__links:has(> li:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Når mega-menu containeren er smal (< 1099px) — fald til 2 kolonner */
@media (max-width: 1099px) {
    .tdw-dg-row__links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tdw-dg-row__item {
    margin: 0 !important;
    list-style: none !important;
    display: block;
}

/* Override af Flatsome's default li-styling i nav-dropdown */
.nav-dropdown .tdw-dg-row__item {
    margin-left: 0 !important;
}

.tdw-dg-row__link {
    display: block;
    padding: 5px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tdw-dg-row__link:hover,
.tdw-dg-row__link:focus-visible {
    color: #fff;
    transform: translateX(3px);
}

.tdw-dg-row__link-text {
    /* simpelt span — ingen styling nødvendig */
}

