/* Simple form CSS with proper label alignment */

/* Spinner animation */
@keyframes wpq-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wpq-spinning {
    animation: wpq-spin 1s linear infinite;
    display: inline-block;
}

.wpq-spinner {
    opacity: 0.7;
}

/* Container */
.wcpq-container,
.wpq-quote-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Form container */
.wcpq-form-container,
.wpq-form-box {
    max-width: 1000px;
    margin: 40px 0;
    padding: 40px;
    background: var(--wcpq-surface);
    border: 1px solid var(--wcpq-border);
    border-radius: 8px;
    box-shadow: var(--wcpq-shadow-md);
}

/* Form header */
.wpq-form-top {
    text-align: start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--wcpq-border);
}

.wpq-form-heading {
    font-size: 24px;
    margin-bottom: 10px;
}

.wpq-form-subheading {
    color: var(--wcpq-text-muted);
    font-size: 14px;
}

/* Form fields layout - Flexible grid system */
.wpq-quote-wrapper .wpq-fields-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Each field wrapper - vertical stacked layout */
.wpq-quote-wrapper .wpq-field-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

/* Full width field wrapper for textarea */
.wpq-quote-wrapper .wpq-field-wrapper.wpq-full-width {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

/* Label wrapper */
.wpq-label-wrapper {
    width: 100%;
    padding-bottom: 8px;
}

/* Labels */
.wpq-field-label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: var(--wcpq-text);
    line-height: 1.4;
}

/* Input wrapper - takes full width */
.wpq-input-wrapper {
    width: 100%;
    position: relative;
}

/* Inputs */
.wpq-quote-wrapper .wpq-text-input,
.wpq-quote-wrapper .wpq-text-area {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--wcpq-border);
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
    min-height: 42px;
    line-height: 1.5;
}

/* Ensure select fields have same height as input fields */
.wpq-quote-wrapper select.wpq-text-input {
    height: 42px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-inline-end: 36px;
    cursor: pointer;
}

/*
 * Focus ring: a transparent outline, not `outline: none`.
 *
 * The border and box-shadow below are the visible ring in normal rendering.
 * Windows High Contrast / forced-colors mode strips both, so blanking the
 * outline would leave a focused field with no indicator at all there. A
 * transparent outline is invisible normally and forced to a system colour in
 * that mode.
 */
.wpq-quote-wrapper .wpq-text-input:focus,
.wpq-quote-wrapper .wpq-text-area:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: var(--wcpq-success);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--wcpq-success) 25%, transparent);
}

.wpq-text-area {
    min-height: 100px;
    resize: vertical;
}

/* Error messages and counters below input */
.wpq-field-error,
.wpq-counter {
    display: block;
    font-size: 12px;
    margin-top: 5px;
}

.wpq-field-error {
    color: var(--wcpq-error);
}

.wpq-counter {
    text-align: end;
    color: var(--wcpq-text-muted);
}

/* Required and optional indicators */
.wpq-label-required {
    color: var(--wcpq-error);
}

.wpq-label-optional {
    color: var(--wcpq-text-muted);
    font-size: 12px;
}

/* Checkbox section */
.wpq-check-wrapper {
    margin-bottom: 20px;
}

.wpq-check-box {
    margin-inline-end: 8px;
}

/* Submit section */
.wpq-submit-area {
    text-align: start;
    margin-top: 20px;
}

.wpq-form-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--wcpq-text-muted);
}

/* Navigation area for quote history link */
.wpq-nav-area {
    margin-top: 15px;
}

/* Tablet - 2 columns */
@media (max-width: 992px) {
    .wpq-quote-wrapper .wpq-fields-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile - 1 column */
@media (max-width: 576px) {
    .wpq-quote-wrapper .wpq-fields-group {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .wpq-form-container,
    .wpq-form-box {
        padding: 20px 15px;
    }
}

/* Products display area - let WooCommerce handle the layout */
.wpq-products-area {
    margin-bottom: 40px;
}

/* Just ensure products display well within our container */
.wpq-products-display {
    margin-bottom: 20px;
}

/* Let WooCommerce handle its own responsive grid - no overrides needed */

/* ========================================
   Pro Form Fields - Added by Pro Plugin
   ======================================== */

/* Ensure Pro fields follow same layout rules */
.wpq-field-wrapper.wcpq-pro-field {
    /* Inherits grid positioning from .wpq-field-wrapper */
}

/* Pro field specific styles - Company, Budget, File Upload, CAPTCHA */
.wpq-field-wrapper input[name="wcpq_company"],
.wpq-field-wrapper select#wcpq_budget,
.wpq-field-wrapper input#wcpq_captcha {
    /* Inherits all styles from .wpq-text-input */
}

/* File upload field */
.wpq-field-wrapper input.wpq-file-input {
    padding: 10px 12px;
    background-color: var(--wcpq-surface-subtle);
    border: 2px dashed var(--wcpq-border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.wpq-field-wrapper input.wpq-file-input:hover {
    background-color: var(--wcpq-surface-subtle);
    border-color: var(--wcpq-success);
}

/*
 * Standard and WebKit selectors stay in separate rules: a selector list with
 * one pseudo-element a browser does not know is dropped whole.
 */
.wpq-field-wrapper input.wpq-file-input::file-selector-button {
    padding: 6px 12px;
    background: var(--wcpq-accent);
    color: var(--wcpq-on-accent);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-inline-end: 10px;
}

.wpq-field-wrapper input.wpq-file-input::-webkit-file-upload-button {
    padding: 6px 12px;
    background: var(--wcpq-accent);
    color: var(--wcpq-on-accent);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-inline-end: 10px;
}

.wpq-field-wrapper input.wpq-file-input::file-selector-button:hover {
    background: var(--wcpq-accent-hover);
}

.wpq-field-wrapper input.wpq-file-input::-webkit-file-upload-button:hover {
    background: var(--wcpq-accent-hover);
}

/* File upload hint */
.wpq-field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--wcpq-text-muted);
    line-height: 1.4;
}

/*
 * CAPTCHA field - narrow, but wide enough for its own placeholder.
 *
 * A one- or two-digit answer does not need a full-width field, so keeping it
 * short is right. 150px was too short: "Enter your answer" rendered as "Enter
 * your answe", with the last letter clipped.
 *
 * Measuring it said otherwise - the text needed 121px and 124px was free - but
 * this is a number input, and its spinner takes width out of the visible area
 * without appearing in that arithmetic. The screenshot was right and the
 * measurement was wrong, which is exactly why the screenshot gets looked at.
 *
 * In ch rather than px, so the field grows with whatever font size a theme
 * sets instead of clipping again at a larger one.
 */
input#wcpq_captcha {
    max-width: 21ch;
    min-width: 21ch;
}

/* Pro field error messages */
.wpq-field-error.wcpq-company-error,
.wpq-field-error.wcpq-budget-error,
.wpq-field-error.wcpq-attachment-error,
.wpq-field-error.wcpq-captcha-error {
    /* Inherits from .wpq-field-error */
}