/**
 * Zedden Product Experience — Quote Styles
 *
 * Styles for quote cart, form, and button components.
 */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --zpx-primary: #1e3a5f;
    --zpx-primary-hover: #2d4a6f;
    --zpx-accent: #2563eb;
    --zpx-accent-hover: #1d4ed8;
    --zpx-success: #10b981;
    --zpx-error: #ef4444;
    --zpx-warning: #f59e0b;
    --zpx-text: #111827;
    --zpx-text-muted: #6b7280;
    --zpx-border: #e5e7eb;
    --zpx-bg: #ffffff;
    --zpx-bg-alt: #f9fafb;
    --zpx-radius: 8px;
    --zpx-radius-sm: 4px;
    --zpx-button-bg: var(--zpx-primary);
    --zpx-button-bg-hover: var(--zpx-primary-hover);
    --zpx-button-text: #fff;
    --zpx-button-radius: var(--zpx-radius);
    --zpx-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --zpx-transition: 0.2s ease;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.zpx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    border: none;
    border-radius: var(--zpx-button-radius);
    cursor: pointer;
    transition: all var(--zpx-transition);
}

.zpx-btn--primary {
    background: var(--zpx-button-bg);
    color: var(--zpx-button-text);
}

.zpx-btn--primary:hover {
    background: var(--zpx-button-bg-hover);
}

.zpx-btn--secondary {
    background: var(--zpx-bg);
    color: var(--zpx-text);
    border: 1px solid var(--zpx-border);
}

.zpx-btn--secondary:hover {
    background: var(--zpx-bg-alt);
    border-color: var(--zpx-text-muted);
}

.zpx-btn--large {
    padding: 16px 32px;
    font-size: 16px;
}

.zpx-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Quote Button (Product Page)
   ========================================================================== */

.zpx-quote-button-wrap {
    margin: 16px 0;
}

.zpx-quote-button {
    position: relative;
    width: 100%;
    min-height: 54px;
    padding: 14px 24px;
    background: var(--zpx-button-bg);
    color: var(--zpx-button-text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--zpx-button-radius);
    cursor: pointer;
    transition: all var(--zpx-transition);
    overflow: hidden;
}

.zpx-quote-button:hover:not(:disabled) {
    background: var(--zpx-button-bg-hover);
    transform: translateY(-1px);
}

.zpx-quote-button:disabled {
    cursor: wait;
}

.zpx-quote-button__loading,
.zpx-quote-button__success {
    display: none;
}

.zpx-quote-button.is-loading .zpx-quote-button__text {
    visibility: hidden;
}

.zpx-quote-button.is-loading .zpx-quote-button__loading {
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.zpx-quote-button.is-success {
    background: var(--zpx-success);
}

.zpx-quote-button.is-success .zpx-quote-button__text {
    visibility: hidden;
}

.zpx-quote-button.is-success .zpx-quote-button__success {
    display: flex;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.zpx-quote-status {
    display: block;
    min-height: 24px;
    padding-top: 8px;
    font-size: 14px;
    color: var(--zpx-success);
}

.zpx-quote-status.is-error {
    color: var(--zpx-error);
}

/* ==========================================================================
   Quote Cart
   ========================================================================== */

.zpx-cart {
    max-width: 900px;
    margin: 0 auto;
}

.zpx-cart__empty {
    padding: 60px 20px;
    text-align: center;
    background: var(--zpx-bg-alt);
    border-radius: var(--zpx-radius);
}

.zpx-cart__empty p {
    margin: 0 0 20px;
    color: var(--zpx-text-muted);
    font-size: 16px;
}

.zpx-cart__table {
    width: 100%;
    border-collapse: collapse;
    background: var(--zpx-bg);
    border-radius: var(--zpx-radius);
    overflow: hidden;
    box-shadow: var(--zpx-shadow);
}

.zpx-cart__table thead {
    background: var(--zpx-bg-alt);
}

.zpx-cart__table th {
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--zpx-text-muted);
    text-align: left;
    border-bottom: 1px solid var(--zpx-border);
}

.zpx-cart__table td {
    padding: 20px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--zpx-border);
}

.zpx-cart__table tbody tr:last-child td {
    border-bottom: none;
}

.zpx-cart__col-price,
.zpx-cart__col-qty,
.zpx-cart__col-total {
    text-align: center;
}

.zpx-cart__col-remove {
    width: 50px;
    text-align: center;
}

/* Product cell */
.zpx-cart__product {
    display: flex;
    align-items: center;
    gap: 16px;
}

.zpx-cart__product-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: var(--zpx-bg-alt);
    border-radius: var(--zpx-radius-sm);
}

.zpx-cart__product-name {
    display: block;
    color: var(--zpx-text);
    font-weight: 600;
    text-decoration: none;
}

.zpx-cart__product-name:hover {
    color: var(--zpx-accent);
}

.zpx-cart__product-config {
    margin-top: 4px;
    font-size: 13px;
    color: var(--zpx-text-muted);
}

/* Quantity control */
.zpx-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--zpx-border);
    border-radius: var(--zpx-radius-sm);
    overflow: hidden;
}

.zpx-qty__btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--zpx-bg-alt);
    border: none;
    font-size: 18px;
    color: var(--zpx-text);
    cursor: pointer;
    transition: background var(--zpx-transition);
}

.zpx-qty__btn:hover {
    background: var(--zpx-border);
}

.zpx-qty__input {
    width: 50px;
    height: 36px;
    padding: 0;
    border: none;
    border-left: 1px solid var(--zpx-border);
    border-right: 1px solid var(--zpx-border);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.zpx-qty__input::-webkit-inner-spin-button,
.zpx-qty__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove button */
.zpx-cart__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--zpx-text-muted);
    cursor: pointer;
    border-radius: var(--zpx-radius-sm);
    transition: all var(--zpx-transition);
}

.zpx-cart__remove:hover {
    background: #fef2f2;
    color: var(--zpx-error);
}

/* Subtotal */
.zpx-cart__subtotal-row td {
    background: var(--zpx-bg-alt);
    padding: 16px;
}

.zpx-cart__subtotal-label {
    text-align: right;
    font-weight: 600;
    color: var(--zpx-text);
}

.zpx-cart__subtotal-value {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--zpx-primary);
}

/* Actions */
.zpx-cart__actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
}

.zpx-cart__note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef3c7;
    border-radius: var(--zpx-radius-sm);
    font-size: 13px;
    color: #92400e;
}

/* ==========================================================================
   Quote Form Page
   ========================================================================== */

.zpx-quote-page {
    max-width: 1000px;
    margin: 0 auto;
}

.zpx-quote-page__empty {
    padding: 60px 20px;
    text-align: center;
    background: var(--zpx-bg-alt);
    border-radius: var(--zpx-radius);
}

.zpx-quote-page__layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

/* Summary sidebar */
.zpx-quote-page__summary {
    position: sticky;
    top: 24px;
    padding: 24px;
    background: var(--zpx-bg-alt);
    border-radius: var(--zpx-radius);
    order: 2;
}

.zpx-quote-page__summary-title {
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--zpx-text);
}

.zpx-quote-page__items {
    margin-bottom: 20px;
}

.zpx-quote-page__item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--zpx-border);
    font-size: 14px;
}

.zpx-quote-page__item:last-child {
    border-bottom: none;
}

.zpx-quote-page__item-name {
    color: var(--zpx-text);
}

.zpx-quote-page__item-config {
    display: block;
    color: var(--zpx-text-muted);
    font-size: 12px;
}

.zpx-quote-page__item-qty {
    color: var(--zpx-text-muted);
}

.zpx-quote-page__item-price {
    font-weight: 600;
    color: var(--zpx-text);
}

.zpx-quote-page__subtotal {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-top: 2px solid var(--zpx-border);
    font-size: 16px;
    font-weight: 600;
    color: var(--zpx-primary);
}

.zpx-quote-page__disclaimer {
    margin: 16px 0 0;
    font-size: 12px;
    color: var(--zpx-text-muted);
    font-style: italic;
}

.zpx-quote-page__edit-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--zpx-accent);
    font-size: 14px;
    text-decoration: none;
}

.zpx-quote-page__edit-link:hover {
    text-decoration: underline;
}

/* Form */
.zpx-quote-page__form-wrap {
    order: 1;
}

.zpx-quote-page__form-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--zpx-text);
}

.zpx-quote-page__form-intro {
    margin: 0 0 32px;
    color: var(--zpx-text-muted);
    font-size: 15px;
}

/* Form elements */
.zpx-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.zpx-form__field {
    margin-bottom: 20px;
}

.zpx-form__field--half {
    margin-bottom: 0;
}

.zpx-form__label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--zpx-text);
}

.zpx-form__required {
    color: var(--zpx-error);
}

.zpx-form__input,
.zpx-form__textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--zpx-text);
    background: var(--zpx-bg);
    border: 1px solid var(--zpx-border);
    border-radius: var(--zpx-radius-sm);
    transition: border-color var(--zpx-transition), box-shadow var(--zpx-transition);
}

.zpx-form__input:focus,
.zpx-form__textarea:focus {
    outline: none;
    border-color: var(--zpx-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.zpx-form__input.is-invalid,
.zpx-form__textarea.is-invalid {
    border-color: var(--zpx-error);
}

.zpx-form__error {
    display: block;
    min-height: 20px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--zpx-error);
}

.zpx-form__actions {
    margin-top: 32px;
}

.zpx-form__actions .zpx-btn {
    width: 100%;
}

.zpx-form__actions .zpx-btn__loading {
    display: none;
}

.zpx-form__actions .zpx-btn.is-loading .zpx-btn__text {
    visibility: hidden;
}

.zpx-form__actions .zpx-btn.is-loading .zpx-btn__loading {
    display: flex;
    position: absolute;
}

.zpx-form__privacy {
    margin-top: 16px;
    font-size: 13px;
    color: var(--zpx-text-muted);
    text-align: center;
}

.zpx-form__privacy a {
    color: var(--zpx-accent);
}

/* Success message */
.zpx-quote-page__success {
    padding: 60px 40px;
    text-align: center;
    background: var(--zpx-bg);
    border-radius: var(--zpx-radius);
    box-shadow: var(--zpx-shadow);
}

.zpx-quote-page__success[hidden] {
    display: none;
}

.zpx-quote-page__success-icon {
    margin-bottom: 24px;
    color: var(--zpx-success);
}

.zpx-quote-page__success h2 {
    margin: 0 0 16px;
    font-size: 28px;
    color: var(--zpx-text);
}

.zpx-quote-page__success p {
    margin: 0 0 12px;
    color: var(--zpx-text-muted);
    font-size: 16px;
}

.zpx-quote-page__success .zpx-btn {
    margin-top: 24px;
}

/* ==========================================================================
   Spinner
   ========================================================================== */

.zpx-spinner {
    animation: zpx-spin 0.8s linear infinite;
}

@keyframes zpx-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .zpx-quote-page__layout {
        grid-template-columns: 1fr;
    }

    .zpx-quote-page__summary {
        position: static;
        order: 1;
    }

    .zpx-quote-page__form-wrap {
        order: 2;
    }

    .zpx-form__row {
        grid-template-columns: 1fr;
    }

    .zpx-form__field--half {
        margin-bottom: 20px;
    }

    .zpx-cart__table thead {
        display: none;
    }

    .zpx-cart__table,
    .zpx-cart__table tbody,
    .zpx-cart__table tr,
    .zpx-cart__table td {
        display: block;
    }

    .zpx-cart__item {
        position: relative;
        padding: 20px;
        border-bottom: 1px solid var(--zpx-border);
    }

    .zpx-cart__col-product {
        padding: 0 0 12px;
        border: none;
    }

    .zpx-cart__col-price,
    .zpx-cart__col-qty,
    .zpx-cart__col-total {
        display: inline-block;
        width: auto;
        padding: 8px 0;
        text-align: left;
        border: none;
    }

    .zpx-cart__col-price::before,
    .zpx-cart__col-qty::before,
    .zpx-cart__col-total::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--zpx-text-muted);
    }

    .zpx-cart__col-remove {
        position: absolute;
        top: 20px;
        right: 20px;
        width: auto;
        padding: 0;
        border: none;
    }

    .zpx-cart__actions {
        flex-direction: column;
    }
}

/* =========================================================================
   Product-page quote form (options + quantity + button)
   Defensive layout: neutralises theme button width/margin/position and wraps
   at any width so the qty field and button can never overlap.
   ========================================================================= */
.zpx-quote-add,
.zpx-quote-add * {
    box-sizing: border-box;
}

.zpx-quote-add {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
    max-width: 480px;
}

.zpx-quote-add__options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.zpx-quote-option-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zpx-quote-option-label,
.zpx-quote-qty-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--zpx-text-muted);
}

.zpx-quote-option {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
    color: var(--zpx-text);
    background: var(--zpx-bg);
    border: 1px solid var(--zpx-border);
    border-radius: var(--zpx-radius-sm);
    transition: border-color var(--zpx-transition), box-shadow var(--zpx-transition);
}

.zpx-quote-option:focus {
    outline: none;
    border-color: var(--zpx-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.zpx-quote-add__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.zpx-quote-add__row > .zpx-quote-qty-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    width: 96px;
    min-width: 0;
    margin: 0;
    float: none;
    position: static;
}

.zpx-quote-qty {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
    color: var(--zpx-text);
    background: var(--zpx-bg);
    border: 1px solid var(--zpx-border);
    border-radius: var(--zpx-radius-sm);
    text-align: center;
}

.zpx-quote-qty:focus {
    outline: none;
    border-color: var(--zpx-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.zpx-quote-add__row > .zpx-quote-button {
    flex: 1 1 200px;
    min-width: 160px;
    width: auto !important;   /* neutralise theme full-width buttons */
    margin: 0 !important;     /* neutralise theme button margins that cause overlap */
    float: none;
    position: static;
}
