/* ================================================================== */
/*  Quote Form — Front-end Styles                                      */
/*                                                                     */
/*  Uses CSS custom properties for easy theming.                       */
/*  Override these in your theme or via the custom CSS editor.         */
/* ================================================================== */

:root {
    --qf-font:            inherit;
    --qf-color:           #1d2327;
    --qf-color-light:     #6b7280;
    --qf-color-primary:   #6c5ce7;
    --qf-color-success:   #00b894;
    --qf-color-error:     #d63031;
    --qf-bg:              #ffffff;
    --qf-bg-input:        #ffffff;
    --qf-border:          #d1d5db;
    --qf-border-focus:    #6c5ce7;
    --qf-radius:          10px;
    --qf-radius-sm:       7px;
    --qf-gap:             20px;
    --qf-input-h:         46px;
    --qf-shadow-focus:    0 0 0 3px rgba(108, 92, 231, 0.18);
    --qf-shadow-card:     0 2px 16px rgba(0,0,0,0.07);
    /* Derived — auto-set when user picks a custom primary colour */
    --qf-btn-shadow:      0 2px 10px rgba(108, 92, 231, 0.22);
    --qf-btn-shadow-hover:0 4px 18px rgba(108, 92, 231, 0.35);
    --qf-btn-shadow-active:0 1px 6px rgba(108, 92, 231, 0.20);
}

/* ------------------------------------------------------------------ */
/*  Wrapper                                                            */
/* ------------------------------------------------------------------ */
.quote-form-wrapper {
    font-family: var(--qf-font);
    color: var(--qf-color);
    max-width: 760px;
    margin: 0 auto;
}

/* ------------------------------------------------------------------ */
/*  Form title                                                         */
/* ------------------------------------------------------------------ */
.quote-form-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--qf-color);
    margin: 0 0 20px;
    line-height: 1.3;
}

.quote-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--qf-gap);
    position: relative;
}

/* ------------------------------------------------------------------ */
/*  Two-column layout                                                  */
/* ------------------------------------------------------------------ */
.quote-form--two-col .quote-field {
    width: calc(50% - var(--qf-gap) / 2);
}

/* Fields that must always be full-width regardless of layout */
.quote-form--two-col .quote-field--textarea,
.quote-form--two-col .quote-field--html,
.quote-form--two-col .quote-field--heading,
.quote-form--two-col .quote-field--divider,
.quote-form--two-col .quote-field--submit,
.quote-form--two-col .quote-captcha {
    width: 100%;
}

/* Explicit half/full/third overrides always win */
.quote-form .quote-field--half  { width: calc(50% - var(--qf-gap) / 2) !important; }
.quote-form .quote-field--third { width: calc(33.333% - var(--qf-gap) * 2 / 3) !important; }
.quote-form .quote-field--full  { width: 100% !important; }

@media (max-width: 620px) {
    .quote-form--two-col .quote-field,
    .quote-field--half,
    .quote-field--third { width: 100% !important; }
}

/* ------------------------------------------------------------------ */
/*  Fields                                                             */
/* ------------------------------------------------------------------ */
.quote-field {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-sizing: border-box;
}

/* Labels */
.quote-field label {
    font-size: 14px;
    font-weight: 600;
    color: var(--qf-color);
    letter-spacing: 0.01em;
}

.quote-req {
    color: var(--qf-color-error);
    margin-left: 2px;
}

.quote-help {
    font-size: 12px;
    color: var(--qf-color-light);
    line-height: 1.5;
    margin-top: 2px;
}

/* ------------------------------------------------------------------ */
/*  Inputs                                                             */
/* ------------------------------------------------------------------ */
.quote-form input[type="text"],
.quote-form input[type="email"],
.quote-form input[type="tel"],
.quote-form input[type="url"],
.quote-form input[type="number"],
.quote-form input[type="date"],
.quote-form select,
.quote-form textarea {
    width: 100%;
    padding: 0 16px;
    height: var(--qf-input-h);
    font-size: 15px;
    font-family: inherit;
    color: var(--qf-color);
    background: var(--qf-bg-input);
    border: 1.5px solid var(--qf-border);
    border-radius: var(--qf-radius-sm);
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.quote-form textarea {
    height: auto;
    padding: 13px 16px;
    resize: vertical;
    line-height: 1.6;
    min-height: 120px;
}

.quote-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.quote-form input:focus,
.quote-form select:focus,
.quote-form textarea:focus {
    border-color: var(--qf-border-focus);
    box-shadow: var(--qf-shadow-focus);
}

.quote-form input::placeholder,
.quote-form textarea::placeholder {
    color: #b0b8c4;
    font-weight: 400;
}

/* Invalid state — custom inline validation */
.quote-form .quote-input--error,
.quote-field--invalid input,
.quote-field--invalid textarea,
.quote-field--invalid select {
    border-color: var(--qf-color-error) !important;
    box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.12) !important;
}

.quote-field--invalid .quote-dropzone {
    border-color: var(--qf-color-error);
    box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.12);
}

.quote-field-error {
    display: block;
    font-size: 12px;
    color: var(--qf-color-error);
    margin-top: 4px;
    line-height: 1.4;
    font-weight: 500;
    animation: quoteShakeIn 0.3s ease;
}

@keyframes quoteShakeIn {
    0% { opacity: 0; transform: translateX(-6px); }
    50% { transform: translateX(3px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ------------------------------------------------------------------ */
/*  Country / Dropdown field                                           */
/* ------------------------------------------------------------------ */
.quote-field--country select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* ------------------------------------------------------------------ */
/*  File upload — Drag & Drop zone                                     */
/* ------------------------------------------------------------------ */
.quote-dropzone {
    position: relative;
    border: 1.5px dashed var(--qf-border);
    border-radius: var(--qf-radius-sm);
    background: #fafbfc;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.quote-dropzone:hover,
.quote-dropzone--hover {
    border-color: var(--qf-color-primary);
    background: #f8f7ff;
}

.quote-dropzone--hover {
    border-style: solid;
    box-shadow: var(--qf-shadow-focus);
}

.quote-dropzone-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    pointer-events: none;
}

.quote-dropzone-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 20px;
    text-align: center;
}

.quote-dropzone-icon {
    color: var(--qf-color-primary);
    opacity: 0.4;
    line-height: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.quote-dropzone:hover .quote-dropzone-icon,
.quote-dropzone--hover .quote-dropzone-icon {
    opacity: 0.75;
    transform: translateY(-2px);
}

.quote-dropzone-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--qf-color);
    line-height: 1.4;
    margin-top: 4px;
}

.quote-dropzone-hint {
    font-size: 13px;
    color: var(--qf-color-light);
}

.quote-dropzone-browse {
    background: none;
    border: none;
    color: var(--qf-color-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.quote-dropzone-browse:hover {
    filter: brightness(0.82);
}

.quote-dropzone-accept {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

/* File list */
.quote-dropzone-files {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.quote-dropzone-files:empty {
    display: none;
}

/* Each file item */
.quote-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    font-size: 13px;
    color: var(--qf-color);
    line-height: 1.4;
    position: relative;
    transition: background 0.2s;
}

.quote-file-item:first-child {
    border-top: 1px solid #e5e7eb;
}

.quote-file-item:last-child {
    border-radius: 0 0 var(--qf-radius-sm) var(--qf-radius-sm);
}

.quote-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.quote-file-size {
    flex-shrink: 0;
    color: var(--qf-color-light);
    font-size: 12px;
}

/* Progress bar */
.quote-file-progress {
    flex: 0 0 80px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.quote-file-progress-bar {
    height: 100%;
    background: var(--qf-color-primary);
    border-radius: 2px;
    transition: width 0.15s ease;
}

.quote-file-item--uploading .quote-file-progress-bar {
    animation: quoteProgressPulse 1.5s ease-in-out infinite;
}

@keyframes quoteProgressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Status icon area */
.quote-file-status {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 0;
}

/* Remove / close button */
.quote-file-remove {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.quote-file-remove:hover {
    color: var(--qf-color-error);
    background: rgba(214, 48, 49, 0.08);
}

/* Error state */
.quote-file-item--error {
    background: #fff5f5;
}

.quote-file-error-text {
    color: var(--qf-color-error);
    font-size: 12px;
    font-weight: 500;
}

.quote-file-retry {
    border: none;
    background: none;
    color: var(--qf-color-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.quote-file-retry:hover {
    filter: brightness(0.82);
}

/* Done state — checkmark color via inline SVG in JS */
.quote-file-item--done {
    background: #f0fdf4;
}

/* Submit button disabled during upload */
.quote-btn--uploading {
    opacity: 0.6;
    cursor: wait;
}

/* ------------------------------------------------------------------ */
/*  Checkboxes & Radios                                                */
/* ------------------------------------------------------------------ */
.quote-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quote-option {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 400;
    line-height: 1.4;
}

.quote-option input[type="checkbox"],
.quote-option input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--qf-color-primary);
    cursor: pointer;
    border-radius: 4px;
    appearance: auto;
}

/* ------------------------------------------------------------------ */
/*  Submit button                                                      */
/* ------------------------------------------------------------------ */
.quote-submit {
    padding-top: 6px;
}

.quote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 32px;
    height: 50px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: var(--qf-color-primary);
    border: none;
    border-radius: var(--qf-radius-sm);
    cursor: pointer;
    transition: filter 0.2s, transform 0.1s, box-shadow 0.2s;
    letter-spacing: 0.02em;
    box-shadow: var(--qf-btn-shadow);
}

.quote-btn:hover {
    filter: brightness(0.88);
    box-shadow: var(--qf-btn-shadow-hover);
    transform: translateY(-1px);
}

.quote-btn:active {
    filter: brightness(0.82);
    transform: scale(0.98) translateY(0);
    box-shadow: var(--qf-btn-shadow-active);
}

.quote-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.quote-btn-text {
    display: inline;
}

.quote-btn-spinner {
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.quote-spinner-svg {
    animation: quoteSpinnerRotate 0.8s linear infinite;
}

@keyframes quoteSpinnerRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Loading overlay on the form */
.quote-form--loading {
    position: relative;
    pointer-events: none;
}

.quote-form--loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--qf-radius-sm);
    z-index: 10;
    animation: quoteFadeIn 0.2s ease;
}

@keyframes quoteFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/*  Messages                                                           */
/* ------------------------------------------------------------------ */
.quote-message {
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--qf-radius-sm);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.quote-message--success {
    background: #ecfdf5;
    color: #065f46;
    border: 1.5px solid #6ee7b7;
}

.quote-message--success::before {
    content: "✓";
    font-size: 16px;
    font-weight: 700;
    color: #00b894;
    flex-shrink: 0;
    margin-top: 1px;
}

.quote-message--error {
    background: #fff1f2;
    color: #991b1b;
    border: 1.5px solid #fca5a5;
}

.quote-message--error::before {
    content: "✕";
    font-size: 16px;
    font-weight: 700;
    color: var(--qf-color-error);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ------------------------------------------------------------------ */
/*  Honeypot (hidden from view)                                        */
/* ------------------------------------------------------------------ */
.quote-hp {
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* ------------------------------------------------------------------ */
/*  CAPTCHA                                                            */
/* ------------------------------------------------------------------ */
.quote-captcha {
    padding: 4px 0;
}

.quote-captcha .g-recaptcha,
.quote-captcha .h-captcha {
    transform-origin: left top;
}

@media (max-width: 400px) {
    .quote-captcha .g-recaptcha,
    .quote-captcha .h-captcha {
        transform: scale(0.85);
    }
}
