/* Quote Products for WooCommerce — storefront styles (quote product pages + quote request page) */

/* Base styles for quote elements */
.wc-quote-request-page,
.wc-quote-notice,
.wc-quote-products-button {
    font-family: inherit;
}

/* WooCommerce Message Styles */
.woocommerce-message {
    color: #000000 !important;
    background-color: #f8f9fa !important;
    border-left: 4px solid #2ecc71 !important;
    padding: 1em !important;
    margin: 1em 0 !important;
    font-size: 1em !important;
}

/* Plugin-owned floating notice (used by QuoteUtils.showNotice).
 * Namespaced under .wc-quote-notice so themes can't accidentally
 * override text colour via their own .woocommerce-error rules. */
.wc-quote-notice {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 999999 !important;
    max-width: 400px !important;
    min-width: 240px !important;
    padding: 14px 18px !important;
    margin: 0 !important;
    background-color: #ffffff !important;
    color: #1f2937 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    font-family: inherit;
    border: 1px solid #e5e7eb !important;
    border-left-width: 4px !important;
    border-radius: 4px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
}

.wc-quote-notice.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.wc-quote-notice--success {
    border-left-color: #2ecc71 !important;
}

.wc-quote-notice--error {
    border-left-color: #e2401c !important;
    color: #7f1d1d !important;
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
}

/* Inline error/success blocks on the quote request page. Match the
 * toast look for visual consistency, but render inline so the message
 * persists past the toast auto-dismiss. */
.wc-quote-inline-error,
.wc-quote-inline-success {
    padding: 14px 18px !important;
    margin: 0 0 1.25em !important;
    border: 1px solid #e5e7eb !important;
    border-left-width: 4px !important;
    border-radius: 4px !important;
    font-size: 1em !important;
    line-height: 1.5 !important;
    background-color: #ffffff !important;
    color: #1f2937 !important;
}

.wc-quote-inline-error {
    color: #7f1d1d !important;
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
    border-left-color: #e2401c !important;
}

.wc-quote-inline-success {
    border-left-color: #2ecc71 !important;
}

.wc-quote-inline-actions {
    text-align: center;
    margin-top: 20px;
}

/* Quote Button Styles */
.wc-quote-request-page .quote-actions {
    margin-bottom: 1em;
    text-align: right;
}

/* All Quote Request Page Buttons */
.wc-quote-request-page .quote-request-form .button.alt,
.wc-quote-request-page .button.remove-from-quote {
    background-color: var(--quote-button-bg-color) !important;
    color: var(--quote-button-text-color) !important;
    padding: var(--quote-button-padding) !important;
    border: none !important;
    border-radius: var(--quote-button-border-radius) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    font-size: 1em !important;
    line-height: 1.5 !important;
}

/* Hover colours only on devices that really hover: phones keep :hover after a tap,
 * which left buttons (and the "added to quote" popup) in the hover colour. */
@media (hover: hover) {
    .wc-quote-request-page .quote-request-form .button.alt:hover,
    .wc-quote-request-page .button.remove-from-quote:hover {
        background-color: var(--quote-button-hover-bg-color) !important;
        color: var(--quote-button-hover-text-color) !important;
    }
}

.wc-quote-request-page .quote-request-form .button.alt:focus-visible,
.wc-quote-request-page .button.remove-from-quote:focus-visible,
.wc-quote-modal-button:focus-visible {
    outline: 2px solid var(--quote-button-bg-color, #333333);
    outline-offset: 2px;
}

/* "Clear all items": a quiet text link, so one mis-tap cannot empty the quote. */
.wc-quote-request-page .wc-quote-clear-link {
    display: inline;
    width: auto;
    margin: 0;
    padding: 0.25em 0;
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #666666 !important;
    font: inherit;
    font-size: 0.9em !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.wc-quote-request-page .wc-quote-clear-link:hover,
.wc-quote-request-page .wc-quote-clear-link:focus-visible {
    color: #333333 !important;
}

/* Line above the submit button (Appearance → "Text above the submit button"). */
.wc-quote-request-page .wc-quote-submit-note {
    margin: 0 0 1em;
    font-size: 0.95em;
    line-height: 1.5;
    color: #444444;
}

.wc-quote-request-page .wc-quote-submit-note a {
    color: inherit;
    text-decoration: underline;
    white-space: nowrap;
}

/* Field help link: the help text itself is the link. */
.wc-quote-request-page .field-help-link,
.wc-quote-request-page .field-help-text {
    display: inline-block;
    margin-top: 0.4em;
}

.wc-quote-request-page .field-help-link {
    text-decoration: underline;
}

/* Quote Request Page Styles */
.wc-quote-request-page {
    padding: 2em 0;
}

.wc-quote-request-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1em;
}

.wc-quote-request-page h1 {
    margin-bottom: 1em;
    text-align: center;
}

.wc-quote-request-page .quote-col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.wc-quote-request-page .quote-col-product {
    overflow-wrap: anywhere;
}

.wc-quote-request-page .quote-items {
    margin-bottom: 3em;
}

.wc-quote-request-page .shop_table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}

.wc-quote-request-page .shop_table th,
.wc-quote-request-page .shop_table td {
    padding: 1em;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 1em;
}

.wc-quote-request-page .quote-quantity {
    width: 80px;
    padding: 0.5em;
    font-size: 1em;
}

.wc-quote-request-page .quote-request-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 2em;
    background: #f9f9f9;
    border-radius: 4px;
}

.wc-quote-request-page .form-row {
    margin-bottom: 1.5em;
}

.wc-quote-request-page label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: bold;
    font-size: 18px;
}

.wc-quote-request-page input[type="text"],
.wc-quote-request-page input[type="email"],
.wc-quote-request-page input[type="tel"],
.wc-quote-request-page textarea,
.wc-quote-request-page select {
    width: 100% !important;
    padding: 0.8em !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 18px;
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 35px !important;
    box-sizing: border-box !important;
    color: #333 !important;
    background-color: #fff !important;
}

.wc-quote-request-page select {
    padding-right: 30px !important;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><path d="M5 6l5 5 5-5 2 1-7 7-7-7 2-1z" fill="%23555"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 16px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.wc-quote-request-page select option {
    font-size: 18px;
    padding: 8px;
    color: #333;
    background-color: #fff;
}

/* Force font size on all select elements */
.wc-quote-request-page select,
.wc-quote-request-page select option {
    font-size: 18px !important;
}

/* Override any other styles that might affect our form elements */
.wc-quote-request-page .form-row * {
    font-size: 18px !important;
}

.wc-quote-request-page .empty-quote {
    text-align: center;
    padding: 2em;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 1em;
}

/* Quote Request Page Styles */
.wc-quote-request-page .shop_table td a.product-link {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wc-quote-request-page .shop_table td a.product-link:hover {
    color: var(--quote-button-bg-color);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .wc-quote-request-page {
        padding: 10px;
    }

    .wc-quote-request-page .container {
        padding: 0;
        width: 100%;
    }

    .wc-quote-request-page .quote-items {
        margin-bottom: 2em;
    }

    .wc-quote-request-page {
        padding-top: 0;
    }

    .wc-quote-request-page h1 {
        margin-top: 0;
        margin-bottom: 0.6em;
    }

    /* Fit the screen: product names wrap, the Remove button keeps its width. */
    .wc-quote-request-page .shop_table {
        width: 100%;
        table-layout: auto;
    }

    .wc-quote-request-page .shop_table th,
    .wc-quote-request-page .shop_table td {
        padding: 0.7em 0.5em;
        font-size: 0.9em;
    }

    .wc-quote-request-page .shop_table .quote-col-product {
        padding-left: 0;
    }

    .wc-quote-request-page .shop_table .quote-col-actions {
        padding-right: 0;
    }

    .wc-quote-request-page .quote-quantity {
        width: 60px;
        padding: 0.4em;
    }

    .wc-quote-request-page .quote-request-form {
        padding: 1.5em;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .wc-quote-request-page .form-row {
        margin-bottom: 1.2em;
    }

    .wc-quote-request-page label {
        font-size: 0.9em;
    }

    .wc-quote-request-page input[type="text"],
    .wc-quote-request-page input[type="email"],
    .wc-quote-request-page input[type="tel"],
    .wc-quote-request-page textarea {
        padding: 0.6em;
        font-size: 0.9em;
    }

    .wc-quote-request-page .quote-actions {
        text-align: right;
        margin: 0.5em 0 1.5em;
    }

    .wc-quote-request-page .button.remove-from-quote {
        padding: 0.4em 0.8em !important;
        font-size: 0.85em !important;
    }

    /* Headings inside the form line up with the fields. */
    .wc-quote-request-page .quote-request-form h2,
    .wc-quote-request-page .quote-request-form h3 {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .wc-quote-request-page .shop_table td a.product-link {
        font-size: 0.9em;
        display: block;
        padding: 0.2em 0;
    }
}

/* Per-product quote notice (above the quote button) */
.wc-quote-product-notice {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f8f8;
    border-left: 4px solid #000;
}

.wc-quote-product-notice p {
    margin: 0;
    color: #000;
}

.wc-quote-product-notice a {
    color: #000;
    text-decoration: underline;
}

/* Hide WooCommerce's own add-to-cart button on quote products only (classic + block templates).
 * .wc-quote-product is added by the plugin to the product wrapper / Add to Cart blocks. */
.wc-quote-product .single_add_to_cart_button,
.wc-quote-product.wp-block-add-to-cart-with-options .wp-block-woocommerce-product-button,
.wc-quote-product .wp-block-add-to-cart-with-options .wp-block-woocommerce-product-button,
.wc-quote-product .wp-block-woocommerce-add-to-cart-with-options-quantity-selector {
    display: none !important;
}

.wc-quote-products-button-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    width: 100%;
}

/* Appearance → "Use these colours on product page buttons" */
.wc-quote-products-button-wrapper--styled .wc-quote-products-button {
    background-color: var(--quote-button-bg-color) !important;
    color: var(--quote-button-text-color) !important;
    border-color: var(--quote-button-bg-color) !important;
    border-radius: var(--quote-button-border-radius) !important;
}

@media (hover: hover) {
    .wc-quote-products-button-wrapper--styled .wc-quote-products-button:hover {
        background-color: var(--quote-button-hover-bg-color) !important;
        color: var(--quote-button-hover-text-color) !important;
        border-color: var(--quote-button-hover-bg-color) !important;
    }
}

.wc-quote-products-button-wrapper .wc-quote-product-notice {
    flex-basis: 100%;
    margin: 0 0 10px;
}

/* Radio and Checkbox Styles */
.radio-label,
.checkbox-label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
    cursor: pointer;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

/* Select Field Styles */
select[name*="quote_fields"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
}

/* File Upload Styles */
.quote-file-upload {
    display: block;
    position: relative;
    border: 2px dashed #ddd;
    padding: 20px;
    text-align: center;
    margin: 10px 0;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f9f9f9;
}

.quote-file-upload:hover {
    border-color: #0073aa;
    background-color: #f0f0f0;
}

.wc-quote-request-page .quote-file-upload input[type="file"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.quote-file-upload .file-name {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9em;
}

/* Required Field Indicator */
.wc-quote-request-page .required {
    color: #e2401c;
    margin-left: 3px;
}

/* Quote Modal Styles */
.wc-quote-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Default, will be overridden by JavaScript */
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wc-quote-modal-overlay.active {
    opacity: 1;
}

.wc-quote-modal {
    background-color: var(--quote-modal-bg-color, #ffffff);
    color: var(--quote-modal-text-color, #333333);
    border-radius: var(--quote-modal-border-radius, 8px);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 999999;
}

.wc-quote-modal-overlay.active .wc-quote-modal {
    transform: scale(1);
}

.wc-quote-modal-header {
    margin-bottom: 20px;
}

.wc-quote-modal-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: var(--quote-modal-text-color, #333333);
}

.wc-quote-modal-message {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 25px 0;
    color: var(--quote-modal-text-color, #333333);
}

.wc-quote-modal-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.wc-quote-modal-button {
    flex: 1;
    min-width: 150px;
    max-width: 100%;
    padding: var(--quote-button-padding, 10px) 20px;
    background-color: var(--quote-button-bg-color, #333333);
    color: var(--quote-button-text-color, #ffffff);
    border: none;
    border-radius: var(--quote-button-border-radius, 4px);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
}

/* Buttons will automatically distribute evenly with flex: 1 */

.wc-quote-modal-button.secondary {
    background-color: #f0f0f0;
    color: #333333;
}

.wc-quote-modal-button.danger {
    background-color: #e2401c;
    color: #ffffff;
}

@media (hover: hover) {
    .wc-quote-modal-button:hover {
        background-color: var(--quote-button-hover-bg-color, #555555);
        color: var(--quote-button-hover-text-color, #ffffff);
    }

    .wc-quote-modal-button.secondary:hover {
        background-color: #e0e0e0;
        color: #000000;
    }

    .wc-quote-modal-button.danger:hover {
        background-color: #c0341a;
        color: #ffffff;
    }
}

/* Responsive modal styles */
@media (max-width: 768px) {
    .wc-quote-modal {
        padding: 20px;
        width: 95%;
    }

    .wc-quote-modal-title {
        font-size: 20px;
    }

    .wc-quote-modal-message {
        font-size: 14px;
    }

    .wc-quote-modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .wc-quote-modal-button {
        width: 100%;
        min-width: auto;
        flex: none;
    }
}

/* Required checkbox groups (server + client validation) */
.wc-quote-checkbox-group.error {
    outline: 2px solid #c00;
    outline-offset: 4px;
    border-radius: 2px;
}

/* Visually hidden table header text (not every theme defines .screen-reader-text). */
.wc-quote-request-page .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
