/**
 * Leave a Message — floating widget
 *
 * @since 2.5.0
 */

/* ── Container ─────────────────────────────────────────────── */
.nbb2b-lm-widget {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 999999;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    direction: ltr;
}

/* ── Collapsed bar ─────────────────────────────────────────── */
.nbb2b-lm-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 200px;
    height: 40px;
    /* background-color set via inline dynamic CSS */
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    border-radius: 6px 6px 0 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
}

.nbb2b-lm-bar:hover {
    transform: translateY(-1px);
}

.nbb2b-lm-bar.nbb2b-lm-bar--open {
    display: none;
}

.nbb2b-lm-icon,
.nbb2b-lm-arrow {
    flex-shrink: 0;
}

.nbb2b-lm-text {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Expanded panel ────────────────────────────────────────── */
.nbb2b-lm-panel {
    width: 350px;
    background: #ffffff !important;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: nbb2bLmSlideUp 0.25s ease-out;
    color: #333 !important;
}

@keyframes nbb2bLmSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Panel header */
.nbb2b-lm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: inherit;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    font-weight: 600;
    color: #333 !important;
}

.nbb2b-lm-close {
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 4px !important;
    color: #999 !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.15s, background 0.15s !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: inherit !important;
    line-height: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.nbb2b-lm-close:hover {
    color: #333 !important;
    background: #f0f0f0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Panel body / form area */
.nbb2b-lm-panel-body {
    padding: 16px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Form fields ───────────────────────────────────────────── */
.nbb2b-lm-field {
    margin-bottom: 14px;
}

.nbb2b-lm-field:last-child {
    margin-bottom: 0;
}

.nbb2b-lm-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #444 !important;
}

.nbb2b-lm-required {
    color: #e53e3e;
}

.nbb2b-lm-field input[type="text"],
.nbb2b-lm-field input[type="email"],
.nbb2b-lm-field input[type="tel"],
.nbb2b-lm-field textarea,
.nbb2b-lm-field select {
    width: 100% !important;
    padding: 8px 10px !important;
    border: 1px solid #d0d0d0 !important;
    border-radius: 5px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #333 !important;
    background: #fff !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
    box-sizing: border-box !important;
}

.nbb2b-lm-field input:focus,
.nbb2b-lm-field textarea:focus,
.nbb2b-lm-field select:focus {
    outline: none;
    border-color: var(--cxb-primary-color, #0A7AFF);
    box-shadow: 0 0 0 2px rgba(10, 122, 255, 0.15);
}

.nbb2b-lm-field textarea {
    resize: vertical;
    min-height: 60px;
}

/* Checkbox group */
.nbb2b-lm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.nbb2b-lm-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 4px;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #555 !important;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.nbb2b-lm-checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ── Submit button ─────────────────────────────────────────── */
.nbb2b-lm-submit-wrap {
    margin-top: 16px;
    margin-bottom: 0 !important;
}

.nbb2b-lm-submit-btn {
    display: block !important;
    width: 100% !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    /* background-color & border-color set via inline dynamic CSS */
    border: 2px solid !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s !important;
    text-align: center !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    min-height: 0 !important;
    outline: none !important;
    margin: 0 !important;
}

.nbb2b-lm-submit-btn:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
}

/* ── Result message ────────────────────────────────────────── */
.nbb2b-lm-message {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.45;
}

.nbb2b-lm-message--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.nbb2b-lm-message--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Quote basket summary (shown above form when items exist) ── */
.nbb2b-qs {
    background: #f0f7ff;
    border: none;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

/* ── Single product layout ── */
.nbb2b-qs-single-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nbb2b-qs-single-thumb {
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
}
.nbb2b-qs-single-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nbb2b-qs-single-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nbb2b-qs-single-qty-label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0 !important;
}
.nbb2b-qs-qty-input {
    width: 80px !important;
    padding: 4px 6px !important;
    border: 1px solid #c0d0e0 !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    text-align: center !important;
    color: #333 !important;
    background: #fff !important;
}
.nbb2b-qs-qty-input:focus {
    outline: none;
    border-color: var(--cxb-primary-color, #0A7AFF) !important;
    box-shadow: 0 0 0 2px rgba(10, 122, 255, 0.15);
}

/* ── Multi product header ── */
.nbb2b-qs-multi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.nbb2b-qs-multi-header .nbb2b-qs-text {
    font-size: 12px;
    font-weight: 500;
    color: #1a5276;
    flex: 1;
    min-width: 0;
}
.nbb2b-qs-input-qty-btn {
    flex-shrink: 0;
    padding: 4px 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #fff !important;
    background: var(--cxb-primary-color, #0A7AFF) !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    white-space: nowrap;
    line-height: 1.4 !important;
    transition: opacity 0.15s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    min-height: 0 !important;
    min-width: 0 !important;
    outline: none !important;
    margin: 0 !important;
}
.nbb2b-qs-input-qty-btn:hover {
    opacity: 0.85 !important;
}

/* ── Product table (expandable) ── */
.nbb2b-qs-product-table {
    margin-top: 10px;
    padding-top: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
.nbb2b-qs-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12px;
    border: none !important;
}
.nbb2b-qs-table th,
.nbb2b-qs-table td {
    border: none !important;
}
.nbb2b-qs-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding: 4px 6px 6px;
}
.nbb2b-qs-table th:nth-child(1) { width: 55%; }
.nbb2b-qs-table th:nth-child(2) { width: 30%; }
.nbb2b-qs-table th:nth-child(3) { width: 15%; }
.nbb2b-qs-table td {
    padding: 6px;
    vertical-align: middle;
    overflow: hidden;
}
.nbb2b-qs-table tbody tr:nth-child(even) {
    background-color: #f5f7fa;
}
.nbb2b-qs-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
.nbb2b-qs-table-product {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.nbb2b-qs-table-product span {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #333;
}
.nbb2b-qs-table-img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.nbb2b-qs-table-qty {
    width: 30%;
}
.nbb2b-qs-table-qty .nbb2b-qs-qty-input {
    width: 72px !important;
    padding: 3px 4px !important;
    font-size: 12px !important;
}
.nbb2b-qs-table-del {
    width: 15%;
    text-align: center;
}
.nbb2b-qs-table-remove {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}
.nbb2b-qs-table-remove:hover {
    color: #fff;
    background: rgba(220, 38, 38, 0.85);
}
.nbb2b-qs-done-btn {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 6px 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    color: #555 !important;
    background: #e8f0f8 !important;
    background-image: none !important;
    border: 1px solid #d0e3f7 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: background 0.15s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    min-width: 0 !important;
    outline: none !important;
    line-height: 1.4 !important;
    float: none !important;
    position: relative !important;
    box-sizing: border-box !important;
}
.nbb2b-qs-done-btn:hover {
    background: #d8e8f5 !important;
}
.nbb2b-qs-count {
    font-weight: 700;
}
.nbb2b-qs-thumbs {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: visible;
    padding: 4px 4px 0;
}
.nbb2b-qs-thumb-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
    position: relative;
}
.nbb2b-qs-thumb-wrap.nbb2b-qs-deletable {
    cursor: pointer;
}
.nbb2b-qs-del {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.50);
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    pointer-events: none;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}
.nbb2b-qs-thumb-wrap:hover .nbb2b-qs-del {
    opacity: 1;
    pointer-events: auto;
}
.nbb2b-qs-del:hover {
    background: rgba(220, 38, 38, 0.85);
}
/* On touch devices show the button by default (no hover) */
@media (hover: none) {
    .nbb2b-qs-del {
        opacity: 1;
        pointer-events: auto;
    }
}
.nbb2b-qs-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
    flex-shrink: 0;
    display: block;
}
.nbb2b-qs-thumb-empty {
    display: inline-block;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    border: 1px dashed #ccc;
    background: #f0f0f0;
    flex-shrink: 0;
}
.nbb2b-qs-qty {
    font-size: 10px;
    color: #1a5276;
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
    line-height: 1.2;
}
.nbb2b-qs-more {
    font-size: 18px;
    font-weight: 700;
    color: #888;
    flex-shrink: 0;
    padding: 0 4px;
    line-height: 50px;
}

/* ── Elementor form integration ─────────────────────────────── */
.nbb2b-lm-elementor-form {
    /* Let Elementor's own styles control the form layout.
       Constrain width so nothing overflows the panel. */
    max-width: 100%;
    overflow: hidden;
}

/* Elementor forms sometimes use wide padding — tighten inside the popup */
.nbb2b-lm-elementor-form .elementor-form {
    padding: 0 !important;
}

.nbb2b-lm-elementor-form .elementor-widget-container {
    padding: 0 !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 420px) {
    .nbb2b-lm-panel {
        width: calc(100vw - 16px);
        right: 8px;
    }
}

/* ── reCAPTCHA in floating panel ──────────────────────────── */
.nbb2b-lm-recaptcha-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

/* Scale down v2 widget on narrow screens to fit the panel */
@media (max-width: 420px) {
    .nbb2b-lm-recaptcha-wrap .g-recaptcha {
        transform: scale(0.88);
        transform-origin: center top;
    }
}

/* ── Cloudflare Turnstile in floating panel ─────────────────── */
.nbb2b-lm-turnstile-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

/* Scale down Turnstile widget on narrow screens to fit the panel */
@media (max-width: 420px) {
    .nbb2b-lm-turnstile-wrap .cf-turnstile {
        transform: scale(0.88);
        transform-origin: center top;
    }
}
