/*
 * Custom CSS for Nexus Cart Orderform
 *
 * This file allows you to customize the theme colors and styles for the Nexus Cart orderform.
 *
 * To customize colors:
 * - Replace the var() references with your own hex colors or other CSS values.
 * - For example, instead of --vl-primary: var(--zinc-900); use --vl-primary: #your-color;
 * - You can also override any CSS properties here.
 *
 * Note: Changes here will apply to the orderform's Shadow DOM.
 */

/* Add you custom styles here */
:host, :root {
    /* Primary colors */
    --vl-primary: var(--primary);
    --vl-primary-lifted: var(--primary-lifted);
    --vl-primary-accented: var(--primary-accented);

    /* Secondary colors */
    --vl-secondary: var(--secondary);
    --vl-secondary-lifted: var(--secondary-lifted);
    --vl-secondary-accented: var(--secondary-accented);

    /* Success colors */
    --vl-success: var(--success);
    --vl-success-lifted: var(--success-lifted);
    --vl-success-accented: var(--success-accented);

    /* Info colors */
    --vl-info: var(--info);
    --vl-info-lifted: var(--info-lifted);
    --vl-info-accented: var(--info-accented);

    /* Notice colors */
    --vl-notice: var(--notice);
    --vl-notice-lifted: var(--notice-lifted);
    --vl-notice-accented: var(--notice-accented);

    /* Warning colors */
    --vl-warning: var(--warning);
    --vl-warning-lifted: var(--warning-lifted);
    --vl-warning-accented: var(--warning-accented);

    /* Error colors */
    --vl-error: var(--error);
    --vl-error-lifted: var(--error-lifted);
    --vl-error-accented: var(--error-accented);

    /* Grayscale colors */
    --vl-grayscale: var(--grayscale);
    --vl-grayscale-lifted: var(--grayscale-lifted);
    --vl-grayscale-accented: var(--grayscale-accented);

    /* Neutral colors */
    --vl-neutral: var(--neutral);
    --vl-neutral-lifted: var(--neutral-lifted);
    --vl-neutral-accented: var(--neutral-accented);

    /* Text neutral colors */
    --vl-text-inverted: var(--text-inverted);
    --vl-text-muted: var(--text-muted);
    --vl-text-lifted: var(--text-lifted);
    --vl-text-accented: var(--text-accented);
    --vl-text: var(--text);

    /* Border neutral colors */
    --vl-border-muted: var(--border-muted);
    --vl-border: var(--border);
    --vl-border-lifted: var(--border-lifted);
    --vl-border-accented: var(--border-accented);

    /* Background neutral colors */
    --vl-bg: var(--bg);
    --vl-bg-muted: var(--bg-muted);
    --vl-bg-lifted: var(--bg-lifted);
    --vl-bg-accented: var(--bg-accented);
    --vl-bg-inverted: var(--bg-inverted);

    /* Additional custom properties */
    /* Font Sizes */
    --vl-text-xs: var(--text-xs);
    --vl-text-sm: var(--text-sm);
    --vl-text-md: var(--text-md);
    --vl-text-lg: var(--text-lg);

    /* Spacing */
    --vl-outline-sm: var(--outline-sm);
    --vl-outline-md: var(--outline-md);
    --vl-outline-lg: var(--outline-lg);

    /* Rounding */
    --vl-rounding-sm: var(--rounding-sm);
    --vl-rounding-md: var(--rounding-md);
    --vl-rounding-lg: var(--rounding-lg);

    /* Other */
    --vl-letter-spacing: var(--letter-spacing);
    --vl-disabled-opacity: var(--disabled-opacity);
}

/* ==================================================================
   FIX 1: cart drawer sits at its static position and runs off-screen
   ------------------------------------------------------------------
   CartBottomDrawer ships `fixed bottom-6 max-w-[53.5rem] mx-auto z-20`
   with no left/right. A fixed box with left/right auto is placed at its
   STATIC position (~538px in, inside .cart-body) and mx-auto is inert,
   because margin-inline:auto needs a resolved left AND right to
   distribute between: 538 + 856 = 1394 > 1349 viewport.
   ================================================================== */
.fixed.bottom-6.max-w-\[53\.5rem\] {
    left: 1rem;
    right: 1rem;
    width: auto;
}

/* >=992px the .vw-rail (258px) is in flow, so clear it. */
@media (min-width: 992px) {
    .fixed.bottom-6.max-w-\[53\.5rem\] {
        left: calc(258px + 1.5rem);
        right: 1.5rem;
    }
}

.fixed.bottom-6.max-w-\[53\.5rem\] .min-w-0,
.fixed.bottom-6.max-w-\[53\.5rem\] > * > * {
    min-width: 0;
}


/* ==================================================================
   FIX 2: let the shrink chain collapse (stops the viewport overflow)
   ------------------------------------------------------------------
   A flex item defaults to min-width:auto = its min-content size, and a
   domain name is one atomic token - so ONE ancestor with min-width:auto
   anywhere in the chain pins the whole subtree open and the row punches
   out of the viewport. Both the card and the flex-1 column inside it
   needed releasing; either one alone is not enough.
   ================================================================== */
.lg\:flex-nowrap > *,
.lg\:flex-nowrap > * .flex-1 {
    min-width: 0;
}

/* Result rows: WHMCS already put `truncate` on the name and `shrink-0`
   on the TLD, but left min-width:auto on the wrapper between them and
   the `min-w-0 flex-1` column, so the truncate could never engage and
   the name painted over the price block. */
.min-w-0.flex-1 > .flex.items-center.justify-between {
    min-width: 0;
}


/* ==================================================================
   FIX 3: show the WHOLE domain name - wrap, never truncate
   ------------------------------------------------------------------
   A card content box is ~322px; `amaroporanojahachay` at text-3xl is
   ~300px and `.de` ~39px = 339px. It cannot fit on one line. Truncating
   is correct CSS but wrong for a domain name - every character matters,
   so `amaroporanojahac...` is unbuyable.

   Wrap instead. `flex-wrap: wrap` lets the TLD drop to its own line, so
   the name keeps a full line to itself. `overflow-wrap: anywhere` is set
   ONLY on the name element - it is an inherited property, so putting it
   on any ancestor also breaks the TLD, and since name and TLD are
   separate flex items on a baseline row their fragments then interleave
   ("amaroporanojahacha.d / y e"). On the name alone it is a harmless
   last resort that only fires if the name by itself exceeds the card.
   ================================================================== */
.flex.flex-row.gap-0.items-baseline {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
}

.flex.flex-row.gap-0.items-baseline > .text-3xl.font-normal {
    min-width: 0;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.flex.flex-row.gap-0.items-baseline > .text-3xl.font-bold {
    flex-shrink: 0;
    white-space: nowrap;
    overflow-wrap: normal;
}


/* ==================================================================
   FIX 4: result rows on narrow screens
   ------------------------------------------------------------------
   `.min-w-0.flex-1` is `flex: 1 1 0%` - basis ZERO. The flex line's base
   total is therefore just the right-hand block, never exceeds the
   container, and so flex-wrap can never trigger; the name column simply
   gets crushed to "a.com" instead. Giving it a real basis lets the line
   overflow, which lets it wrap, which hands the name a full line and
   drops the price block underneath.
   ================================================================== */
@media (max-width: 40rem) {
    .bg-default.rounded-large.px-4 > .flex.flex-row.w-full.items-center.justify-between {
        flex-wrap: wrap;
    }

    .bg-default.rounded-large.px-4 .min-w-0.flex-1 {
        flex-basis: auto;
    }

    .bg-default.rounded-large.px-4 > .flex.flex-row.w-full.items-center.justify-between > .shrink-0.justify-end {
        margin-left: auto;
    }

    /* name now has room, so let it show in full */
    .min-w-0.flex-1 > .flex.items-center.justify-between > .truncate {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
