/**
 * LPINZ Quote Basket — Front-end Styles
 *
 * Namespaced under .lpinz-qb-* throughout.
 * Colour overrides use high-specificity chains to beat Uncode/WPBakery
 * theme colour inheritance.
 *
 * @package LPINZ_Quote_Basket
 */

/* ─── Nav "View Quote" button — [lpinz_quote_nav] shortcode ──────────────── */

/* Nav button — plain text link, no button styling, inherits theme nav colours */
.lpinz-qb-nav-btn {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    text-decoration: none !important;
    white-space: nowrap;
    display: inline;
    box-shadow: none !important;
}

.lpinz-qb-nav-btn:hover {
    background: none !important;
    color: inherit !important;
    text-decoration: none !important;
    opacity: 0.8;
}

.lpinz-qb-nav-count {
    font-weight: 700;
}

/* WP nav menu <li> with class lpinz-qb-nav-hidden — used when basket count is 0.
   JS (updateNavButton) will show/hide the <li> live; this hides it on first load. */
li.lpinz-qb-nav-hidden {
    display: none !important;
}

/* ─── Colour resets — override Uncode/WPBakery theme inheritance ─────────── */

.lpinz-qb-table-wrap,
.lpinz-qb-table-wrap .lpinz-qb-heading,
.lpinz-qb-table-wrap .lpinz-qb-table,
.lpinz-qb-table-wrap .lpinz-qb-table thead th,
.lpinz-qb-table-wrap .lpinz-qb-table tbody td,
.lpinz-qb-table-wrap .lpinz-qb-code,
.lpinz-qb-table-wrap .lpinz-qb-description,
.lpinz-qb-table-wrap .lpinz-qb-table .lpinz-qb-row td span {
    color: inherit !important;
}

.lpinz-qb-table-wrap .lpinz-qb-qty-input {
    color: inherit !important;
    background-color: #e8e8e8 !important; /* slightly darker qty box */
}

.lpinz-qb-basket-wrap,
.lpinz-qb-basket-wrap td,
.lpinz-qb-basket-wrap th,
.lpinz-qb-basket-wrap .lpinz-qb-basket-qty {
    color: inherit !important;
}

.lpinz-qb-empty,
.lpinz-qb-disabled {
    color: inherit !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUOTE TABLE — product page
   ═══════════════════════════════════════════════════════════════════════════ */

.lpinz-qb-table-wrap {
    margin: 1.5em 0;
    background-color: transparent;
    border-radius: 0;
    overflow: visible;
    padding-bottom: 0;
}

/* ── Table shell ── */
.lpinz-qb-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    border: none; /* outer border handled by .lpinz-qb-table-wrap */
}

/* ── Header row ── */
.lpinz-qb-table thead th {
    text-align: left;
    padding: 0.65em 0.85em;
    background-color: #1c3b6c3d;
    color: inherit !important;
    border-bottom: 2px solid #999;
    border-right: 1px solid #aaa;
    white-space: nowrap;
    font-weight: 600;
}

.lpinz-qb-table thead th:last-child {
    border-right: none;
}

/* ── Body rows — white background ── */
.lpinz-qb-table tbody .lpinz-qb-row td {
    padding: 0.65em 0.85em;
    border-bottom: 1px solid #aaa;
    border-right: 1px solid #bbb;
    vertical-align: middle;
    background-color: #ffffff;
}

/* Description cell — lighter font weight */
.lpinz-qb-table tbody .lpinz-qb-row td.lpinz-qb-col-description,
.lpinz-qb-table tbody .lpinz-qb-row td.lpinz-qb-col-description span {
    font-weight: 400 !important;
}

.lpinz-qb-table tbody .lpinz-qb-row td:last-child {
    border-right: none;
}

.lpinz-qb-table tbody .lpinz-qb-row:last-child td {
    border-bottom: none;
}

/* ── Qty column ── */
.lpinz-qb-col-qty {
    width: 130px;
    text-align: center;
    white-space: nowrap;
}

/* ── Quote column ── */
.lpinz-qb-col-quote {
    width: 150px;
    text-align: center;
    white-space: nowrap;
}

/* ── Stepper control: − [n] + pill ── */
.lpinz-qb-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #b8c4d1;
    border-radius: 30px;
    overflow: hidden;
    background: #b8c4d1;  /* button zone colour */
    transition: border-color 0.2s;
}

.lpinz-qb-stepper--error {
    border-color: #cc0000 !important;
    background: #fde8e8 !important;
}

.lpinz-qb-stepper-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 34px;
    font-size: 1em;
    font-weight: 700;
    line-height: 1;
    color: #0b2f4a !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    text-decoration: none !important;
}

.lpinz-qb-stepper-btn:hover {
    background: rgba(0,0,0,0.1);
}

.lpinz-qb-stepper-btn:focus {
    outline: 2px solid #fcc014;
    outline-offset: -2px;
}

/* Centre number field — white background */
.lpinz-qb-stepper-input {
    width: 40px;
    height: 34px;
    padding: 0;
    text-align: center;
    border: none;
    border-left: 1px solid rgba(28,59,108,0.3);
    border-right: 1px solid rgba(28,59,108,0.3);
    border-radius: 0;
    background: #ffffff !important;
    color: #0b2f4a !important;
    font-size: 0.95em;
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
    -moz-appearance: textfield;
    box-sizing: border-box;
}

.lpinz-qb-stepper-input:focus {
    outline: none;
    background: #fff !important;
}

/* Hide webkit spinner arrows — we use our own +/- buttons */
.lpinz-qb-stepper-input::-webkit-inner-spin-button,
.lpinz-qb-stepper-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADD TO QUOTE BUTTON
   Uses Uncode theme classes + our own wrapper for 20px top padding.
   The actual button appearance is driven by the theme's btn-* classes.
   We only set the padding offset here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Form footer no longer used for product table — kept for basket page only */
.lpinz-qb-form-footer {
    padding: 20px 0.85em 0.85em;
    background-color: transparent !important;
}

/* Per-row Add to Quote button — dark navy, solid fill */
.lpinz-qb-add-row-btn {
    display: inline-block;
    cursor: pointer;
    padding: 0.5em 1.2em;
    background-color: #1c3b6c !important;
    color: #ffffff !important;
    border: 2px solid #1c3b6c !important;
    border-radius: 6px !important;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}

.lpinz-qb-add-row-btn:hover,
.lpinz-qb-add-row-btn:focus {
    background-color: #0b2f4a !important;
    border-color: #0b2f4a !important;
    color: #ffffff !important;
    outline: none;
    text-decoration: none !important;
}

.lpinz-qb-add-row-btn::before,
.lpinz-qb-add-row-btn::after {
    display: none !important;
    content: none !important;
}

.lpinz-qb-add-row-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.lpinz-qb-add-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTICE MESSAGES
   ═══════════════════════════════════════════════════════════════════════════ */

.lpinz-qb-notice {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.75em 1em;
    border-radius: 4px;
    margin-bottom: 1em;
    border: 1px solid transparent;
    font-size: 0.95em;
}

.lpinz-qb-notice--success {
    background-color: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46 !important;
}

.lpinz-qb-notice--error {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b !important;
}

/* "View Quote" link inside the success notice */
.lpinz-qb-notice-link {
    display: inline-block;
    margin-left: auto;
    white-space: nowrap;
    font-weight: 700;
    text-decoration: underline;
    color: inherit !important;
    flex-shrink: 0;
}

.lpinz-qb-notice-link:hover {
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUOTE BASKET — view/summary page
   ═══════════════════════════════════════════════════════════════════════════ */

.lpinz-qb-basket-wrap {
    margin: 1.5em 0;
    padding: 0 0.5em;
}

.lpinz-qb-basket-heading,
.lpinz-qb-form-heading {
    margin-bottom: 0.75em;
}

/* ── Basket table wrapper ── */
.lpinz-qb-items {
    background-color: #ffffff; /* white — no grey tint */
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 1.5em;
    padding-left: 1.25em;
    padding-right: 1.25em;
    padding-top: 1em;
}

/* ── Basket table ── */
.lpinz-qb-basket-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    border: none; /* outer border handled by .lpinz-qb-items */
    background-color: transparent;
}

.lpinz-qb-basket-table thead th {
    text-align: left;
    padding: 0.65em 0.85em;
    background-color: #f4f7fa;
    color: inherit !important;
    border-bottom: 2px solid #999;
    border-right: 1px solid #aaa;
    white-space: nowrap;
    font-weight: 600;
}

.lpinz-qb-basket-table thead th:last-child {
    border-right: none;
}

.lpinz-qb-basket-table tbody td {
    padding: 0.65em 0.85em;
    border-bottom: 1px solid #aaa;
    border-right: 1px solid #bbb;
    vertical-align: middle;
    background-color: #ffffff;
    font-weight: 400;
}

.lpinz-qb-basket-table tbody td:last-child {
    border-right: none;
}

.lpinz-qb-basket-table tbody tr:last-child td {
    border-bottom: none;
}

.lpinz-qb-basket-table .lpinz-qb-col-qty {
    width: 90px;
    text-align: center;
}

.lpinz-qb-basket-table .lpinz-qb-col-remove {
    width: 50px;
    text-align: center;
}

/* Qty input in basket — matches stepper input style */
.lpinz-qb-basket-qty {
    background-color: #ffffff !important;
    border: 1px solid #b8c4d1 !important;
    border-radius: 4px;
    padding: 0.3em 0.4em;
    width: 60px;
    text-align: center;
    color: #0b2f4a !important;
    font-weight: 600;
}

/* Remove button */
.lpinz-qb-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    padding: 0.2em 0.4em;
    color: currentColor;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.lpinz-qb-remove-btn:hover {
    opacity: 1;
    color: #cc0000;
}

/* Row being removed */
.lpinz-qb-basket-row--removing {
    opacity: 0.35;
    transition: opacity 0.3s;
}

/* ── Continue Adding Items button ── */
.lpinz-qb-continue-wrap {
    margin: 0;
    padding: 0.85em 0;
    background-color: transparent !important;
}

a.lpinz-qb-continue-btn,
a.lpinz-qb-continue-btn:link,
a.lpinz-qb-continue-btn:visited {
    display: inline-block;
    cursor: pointer;
    padding: 0.65em 1.8em;
    background-color: #fcc014 !important;
    color: #1a1a1a !important;
    border: 2px solid #fcc014 !important;
    border-radius: 6px !important;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    line-height: 1.4;
    box-shadow: none !important;
}

a.lpinz-qb-continue-btn:hover,
a.lpinz-qb-continue-btn:focus {
    background-color: #e6ac00 !important;
    border-color: #e6ac00 !important;
    color: #1a1a1a !important;
    text-decoration: none !important;
    outline: none;
}

a.lpinz-qb-continue-btn::before,
a.lpinz-qb-continue-btn::after {
    display: none !important;
    content: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUOTE SUBMISSION FORM
   ═══════════════════════════════════════════════════════════════════════════ */

.lpinz-qb-form-wrap {
    margin-top: 2em;
    padding-top: 1.5em;
    padding-left: 1.25em;
    padding-right: 1.25em;
    padding-bottom: 1.5em;
    border-top: 2px solid #ccc;
}

.lpinz-qb-form-intro {
    margin-bottom: 1.25em;
    opacity: 0.8;
    font-size: 0.95em;
}

/* Required fields note */
.lpinz-qb-required-note {
    font-size: 0.85em;
    opacity: 0.7;
    margin-bottom: 1.25em;
    display: block;
}

.lpinz-qb-field-row {
    display: flex;
    gap: 1.25em;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.lpinz-qb-field-row .lpinz-qb-field {
    flex: 1 1 220px;
    min-width: 0;
}

.lpinz-qb-field {
    margin-bottom: 1.1em;
}

.lpinz-qb-field label {
    display: block;
    margin-bottom: 0.3em;
    font-weight: 600;
    font-size: 0.9em;
}

/* Visible, well-defined input fields — light grey background */
.lpinz-qb-field input[type="text"],
.lpinz-qb-field input[type="email"],
.lpinz-qb-field input[type="tel"],
.lpinz-qb-field textarea,
.lpinz-qb-quote-form textarea,
#lpinz-qb-quote-form textarea,
#lpinz-qb-quote-form #lpinz_qb_message {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6em 0.85em;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f2f2f2; /* light grey — not white, not transparent */
    color: #1a1a1a;
    font-size: 1em;
    transition: border-color 0.15s, background-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.lpinz-qb-field input[type="text"]:focus,
.lpinz-qb-field input[type="email"]:focus,
.lpinz-qb-field input[type="tel"]:focus,
.lpinz-qb-field textarea:focus,
.lpinz-qb-quote-form textarea:focus {
    outline: none;
    border-color: #fcc014;
    background: #fefbf0; /* very slight warm tint on focus */
    box-shadow: 0 0 0 2px rgba(252, 192, 20, 0.2);
}

.lpinz-qb-field textarea,
.lpinz-qb-quote-form textarea {
    resize: vertical;
    min-height: 110px;
}

.lpinz-qb-field .required {
    color: #cc0000;
    margin-left: 2px;
}

/* Submit button — yellow, no icon, rounded, matches Uncode btn style */
.lpinz-qb-submit-btn {
    display: inline-block;
    cursor: pointer;
    padding: 0.65em 1.8em;
    background-color: #fcc014;
    color: #1a1a1a !important;
    border: 2px solid #fcc014;
    border-radius: 30px;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    /* Remove any icon pseudo-elements injected by the theme */
    text-indent: 0;
}

.lpinz-qb-submit-btn::before,
.lpinz-qb-submit-btn::after {
    display: none !important;
}

.lpinz-qb-submit-btn:hover,
.lpinz-qb-submit-btn:focus {
    background-color: #e6ac00;
    border-color: #e6ac00;
    color: #1a1a1a !important;
    outline: none;
}

.lpinz-qb-submit-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Inline row error (shown briefly when qty = 0 on add) */
.lpinz-qb-row-error {
    padding: 0.5em 0.85em;
    margin-bottom: 0.5em;
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    color: #991b1b !important;
    font-size: 0.9em;
}

/* ── Empty state ── */
.lpinz-qb-empty {
    padding: 1.5em;
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
    text-align: center;
    opacity: 0.7;
}

/* ── Disabled message ── */
.lpinz-qb-disabled {
    padding: 1em;
    background: rgba(0,0,0,0.04);
    border-left: 4px solid rgba(0,0,0,0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

    /* Stack table rows vertically — hide header, show data-label as prefix */
    .lpinz-qb-table,
    .lpinz-qb-basket-table {
        border: none;
    }

    .lpinz-qb-table thead,
    .lpinz-qb-basket-table thead {
        display: none;
    }

    .lpinz-qb-table .lpinz-qb-row,
    .lpinz-qb-basket-table .lpinz-qb-basket-row {
        display: block;
        border-bottom: 1px solid #aaa;
    }

    .lpinz-qb-table .lpinz-qb-row:last-child,
    .lpinz-qb-basket-table .lpinz-qb-basket-row:last-child {
        border-bottom: none;
    }

    .lpinz-qb-table .lpinz-qb-row td,
    .lpinz-qb-basket-table .lpinz-qb-basket-row td {
        display: flex;
        justify-content: flex-start;   /* LEFT align on mobile */
        align-items: center;
        gap: 0.5em;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 0.5em 0.75em;
        text-align: left;
    }

    .lpinz-qb-table .lpinz-qb-row td:last-child,
    .lpinz-qb-basket-table .lpinz-qb-basket-row td:last-child {
        border-bottom: none;
    }

    /* Form fields — full width, no excessive padding */
    .lpinz-qb-field-row {
        flex-direction: column;
        gap: 0;
    }

    .lpinz-qb-field-row .lpinz-qb-field {
        flex: 1 1 100%;
    }

    .lpinz-qb-field input[type="text"],
    .lpinz-qb-field input[type="email"],
    .lpinz-qb-field input[type="tel"],
    .lpinz-qb-field textarea {
        padding: 0.55em 0.7em; /* tighter on mobile */
    }

    /* Basket wrap — remove any extra horizontal padding injected by WPBakery */
    .lpinz-qb-basket-wrap,
    .lpinz-qb-table-wrap {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STICKY “VIEW QUOTE SUMMARY” BAR — fixed to bottom of viewport
   ═══════════════════════════════════════════════════════════════════════════ */

#lpinz-qb-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25em;
    padding: 1.25em 2em;       /* ~double the original height */
    background-color: #175691;
    color: #ffffff;
    box-shadow: 0 -4px 20px rgba(11,47,74,0.28);
    font-size: 0.92em;
    font-weight: 500;
}

/* Left side: item count + clear link stacked */
.lpinz-qb-sticky-left {
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    flex-shrink: 0;
}

.lpinz-qb-sticky-msg {
    color: #ffffff;
    opacity: 0.9;
    white-space: nowrap;
    font-size: 1em;
}

.lpinz-qb-sticky-count {
    font-weight: 700;
    color: #f2c230;
}

/* "Clear / reset quote" text link */
.lpinz-qb-sticky-clear {
    font-size: 0.78em;
    color: rgba(255,255,255,0.55) !important;
    text-decoration: underline !important;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    text-align: left;
    line-height: 1;
    transition: color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.lpinz-qb-sticky-clear:hover {
    color: #ffffff !important;
}

/* Right side: action buttons row */
.lpinz-qb-sticky-actions {
    display: flex;
    align-items: center;
    gap: 0.75em;
    flex-shrink: 0;
}

/* "OR" divider between buttons */
.lpinz-qb-sticky-or {
    color: rgba(255,255,255,0.45);
    font-size: 0.8em;
    white-space: nowrap;
    font-style: italic;
}

/* Shared button base — site-style rounded corners (not pill) */
.lpinz-qb-sticky-btn,
.lpinz-qb-sticky-account-btn {
    display: inline-block;
    padding: 0.6em 1.5em;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    line-height: 1.4;
    border: 2px solid transparent;
}

/* View Quote Summary — yellow #f2c230 */
.lpinz-qb-sticky-btn {
    background-color: #f2c230;
    color: #1c3b6c !important;
    border-color: #f2c230;
}

.lpinz-qb-sticky-btn:hover {
    background-color: #d9a900;
    border-color: #d9a900;
    color: #1c3b6c !important;
    text-decoration: none !important;
}

/* Open an Account — ghost/outline style */
.lpinz-qb-sticky-account-btn {
    background-color: transparent;
    color: #ffffff !important;
    border-color: rgba(255,255,255,0.5);
}

.lpinz-qb-sticky-account-btn:hover {
    background-color: rgba(255,255,255,0.12);
    border-color: #ffffff;
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Push page body up so sticky bar doesn’t cover footer content */
body.lpinz-qb-has-sticky {
    padding-bottom: 90px;
}

@media (max-width: 768px) {
    #lpinz-qb-sticky-bar {
        flex-direction: column;
        gap: 0.75em;
        padding: 1em 1.25em;
        text-align: center;
    }

    .lpinz-qb-sticky-left {
        align-items: center;
    }

    .lpinz-qb-sticky-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5em;
    }

    .lpinz-qb-sticky-btn,
    .lpinz-qb-sticky-account-btn {
        flex: 1 1 auto;
        text-align: center;
        min-width: 130px;
    }

    body.lpinz-qb-has-sticky {
        padding-bottom: 150px;
    }
}
