/* DHE Repair Submission Form
 * All styles namespaced under .dhe-repair so they can't collide with the WordPress theme.
 * Change --dhe-primary at the top to recolor the whole form. */

.dhe-repair {
    /* DHE brand palette — matches the Elementor globals on dhecs.com */
    --dhe-primary:        #1B365C;  /* Navy — headings, legends, fieldset borders */
    --dhe-primary-hover:  #244A7D;
    --dhe-accent:         #F2845C;  /* Coral — CTAs, submit button */
    --dhe-accent-hover:   #D96D45;
    --dhe-text:           #0D0D0D;  /* Near-black body text */
    --dhe-text-muted:     #586F8C;  /* Blue-gray secondary */
    --dhe-border:         #C7CFD9;  /* Light blue-gray hairline */
    --dhe-border-focus:   #1B365C;
    --dhe-focus-ring:     rgba(126, 161, 196, 0.35); /* #7EA1C4 at 35% */
    --dhe-bg:             #FFFFFF;
    --dhe-bg-muted:       #F4F6F9;  /* Subtle blue-gray section fill */
    --dhe-danger:         #B91C1C;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--dhe-text);
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 16px;
    box-sizing: border-box;
}
.dhe-repair *,
.dhe-repair *::before,
.dhe-repair *::after { box-sizing: border-box; }

.dhe-repair h1 {
    color: var(--dhe-primary);
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
    margin: 0 0 24px;
}

.dhe-repair form { margin: 0; }

/* Grid: two columns on wide screens, single column on mobile */
.dhe-repair .fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.dhe-repair .fields > li { margin: 0; padding: 0; }
.dhe-repair .fields > li.wide { grid-column: 1 / -1; }

@media (max-width: 640px) {
    .dhe-repair .fields { grid-template-columns: 1fr; }
    .dhe-repair .fields > li { grid-column: 1 / -1; }
}

/* Fieldset grouping */
.dhe-repair fieldset {
    border: 1px solid var(--dhe-border);
    border-radius: 8px;
    padding: 16px 20px 20px;
    margin: 0 0 20px;
    background: var(--dhe-bg-muted);
}
.dhe-repair fieldset legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--dhe-primary);
    font-size: 15px;
}

/* Labels */
.dhe-repair label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--dhe-text);
}
.dhe-repair .req::after {
    content: " *";
    color: var(--dhe-danger);
    font-weight: 700;
}

/* Inputs */
.dhe-repair input[type="text"],
.dhe-repair input[type="email"],
.dhe-repair input[type="tel"],
.dhe-repair input[type="password"],
.dhe-repair select,
.dhe-repair textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--dhe-text);
    background: var(--dhe-bg);
    border: 1px solid var(--dhe-border);
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dhe-repair input:focus,
.dhe-repair select:focus,
.dhe-repair textarea:focus {
    outline: none;
    border-color: var(--dhe-border-focus);
    box-shadow: 0 0 0 3px var(--dhe-focus-ring);
}
.dhe-repair textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.4;
}

/* Checkbox rows */
.dhe-repair .check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.dhe-repair .check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--dhe-primary);
    cursor: pointer;
}
.dhe-repair .check label {
    font-weight: 400;
    margin-bottom: 0;
    line-height: 1.4;
    cursor: pointer;
}

/* Submit row */
.dhe-repair .submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-end;
    margin-top: 24px;
}
/* Wrapper lets the tooltip anchor correctly (disabled buttons don't fire :hover
   on the button itself in some browsers; the wrapper always does). */
.dhe-repair .submit-wrap {
    position: relative;
    display: inline-block;
}
.dhe-repair #submit-form-btn {
    background: var(--dhe-accent);
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.dhe-repair #submit-form-btn:hover:not(:disabled) { background: var(--dhe-accent-hover); }
.dhe-repair #submit-form-btn:active:not(:disabled) { transform: translateY(1px); }
.dhe-repair #submit-form-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* While the form is actively posting, show the wait cursor instead of not-allowed */
.dhe-repair.is-busy #submit-form-btn { cursor: wait; }

/* Custom tooltip — appears above the submit button when disabled by validation.
   Uses data-tooltip on the wrapper so the tooltip shows even though the button
   itself is :disabled (pointer events still reach the wrapper). */
.dhe-repair .submit-wrap[data-tooltip]::before,
.dhe-repair .submit-wrap[data-tooltip]::after {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.dhe-repair .submit-wrap[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--dhe-primary);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 320px;
    white-space: normal;
    width: max-content;
    text-align: center;
    line-height: 1.35;
    z-index: 10;
}
.dhe-repair .submit-wrap[data-tooltip]::after {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--dhe-primary);
    z-index: 10;
}
.dhe-repair .submit-wrap[data-tooltip]:hover::before,
.dhe-repair .submit-wrap[data-tooltip]:hover::after {
    opacity: 1;
}

/* Spinner */
.dhe-repair #spinner {
    display: none;
    width: 22px; height: 22px;
    border: 3px solid rgba(242, 132, 92, 0.2);
    border-top-color: var(--dhe-accent);
    border-radius: 50%;
    animation: dhe-spin 0.8s linear infinite;
}
@keyframes dhe-spin { to { transform: rotate(360deg); } }

.dhe-repair.is-busy form { opacity: 0.5; pointer-events: none; }

.dhe-repair h2.questions-heading {
    color: var(--dhe-primary);
    font-size: clamp(32px, 5vw, 50px);
    line-height: 1.1;
    margin: 48px 0 12px;
}

/* ---------- Success panel (replaces the form after a successful submit) ---------- */
.dhe-repair-success {
    background: #ffffff;
    border: 1px solid var(--dhe-border);
    border-radius: 12px;
    padding: 32px 28px;
    text-align: center;
    margin: 0 auto 24px;
    max-width: 640px;
}
.dhe-repair-success .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #E8F5EE;
    color: #1F7A4D;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
}
.dhe-repair-success h2 {
    color: var(--dhe-primary);
    font-size: 26px;
    font-weight: 600;
    margin: 0 0 12px;
    line-height: 1.2;
}
.dhe-repair-success .ticket-ref {
    font-size: 16px;
    font-weight: 600;
    color: var(--dhe-primary);
    background: var(--dhe-bg-muted);
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    margin: 0 0 16px;
}
.dhe-repair-success .ticket-ref:empty { display: none; }
.dhe-repair-success .detail {
    color: var(--dhe-text);
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}
.dhe-repair-success .cta {
    border-top: 1px solid var(--dhe-border);
    padding-top: 20px;
    margin-top: 20px;
}
.dhe-repair-success .cta p {
    font-size: 14px;
    color: var(--dhe-text-muted);
    margin: 0 0 6px;
}
.dhe-repair-success .phone {
    display: inline-block;
    font-size: 22px;
    font-weight: 600;
    color: var(--dhe-accent);
    text-decoration: none;
    margin: 4px 0;
}
.dhe-repair-success .phone:hover { color: var(--dhe-accent-hover); }
.dhe-repair-success .hours {
    font-size: 13px;
    color: var(--dhe-text-muted);
    margin: 6px 0 0;
}
.dhe-repair-success .dhe-link-btn {
    background: none;
    border: 0;
    color: var(--dhe-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 12px 8px;
    margin-top: 16px;
    text-decoration: underline;
}
.dhe-repair-success .dhe-link-btn:hover { color: var(--dhe-primary-hover); }

/* ---------- Error banner ---------- */
.dhe-repair-error {
    background: #FEF1F1;
    border: 1px solid #F4B4B4;
    border-left: 4px solid var(--dhe-danger);
    color: #7A1818;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
}
.dhe-repair-error strong { color: var(--dhe-danger); margin-right: 4px; }
