/**
 * Weasel Contact Form Header Styles
 * Theme-based contact form styles that can be updated via theme updates
 */

/* Fix for horizontal rules */
hr.est-rule {
    background-color: #dadada !important;
}

h2.est-title {
    margin-bottom: 20px !important;
}

/* Accessibility helpers */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.est-help {
    font-size: .85rem;
    color: #2d2d2d;
    opacity: .9;
    margin-top: 4px;
}

.est-fs .est-help {
    margin-top: 0px;
    margin-bottom: 4px;
}

/* Container and card */
.est-wrap {
    background: #fff;
    padding: 16px;
}

.est-card {
    background: var(--e-global-color-accent, #4BA3FF);
    border-radius: 12px;
    padding: 22px 22px 26px;
    max-width: 680px;
    margin: 0 auto;
    color: #222;
    position: relative;
}

/* Headings / divider */
.est-title {
    margin: 0 0 6px !important;
    color: #1a2a3e !important;
    font-weight: 800 !important;
    font-size: 30px !important;
    line-height: 1.2 !important;
}

.est-subhead {
    display: block;
    margin: 6px 0 0 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #242424 !important;
}

.est-rule {
    border: 0;
    height: 2px;
    background: #d9d9d9;
    margin: 10px 0 16px;
}

/* Inputs */
.est-block {
    display: block;
    margin: 10px 0;
}

.est-label {
    display: block;
    font-weight: 700;
    margin: 0 0 0px;
}

.est-label + .est-help {
    margin-top: 0px;
    margin-bottom: 4px;
}

input[type=text],
input[type=email],
input[type=tel],
textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
    font: inherit;
    line-height: 1.4;
}

select {
    width: auto;
    min-width: 260px;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
    font: inherit;
    line-height: 1.4;
}

textarea {
    min-height: 120px;
}

::placeholder {
    color: #6d6d6d;
    opacity: 1;
}

/* Radios as chips */
.est-fs {
    border: 0;
    padding: 0;
    margin: 14px 0;
}

.est-fs legend {
    font-weight: 700;
    margin-bottom: 0px;
    color: #333;
}

.est-chip-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.est-chip-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.est-chip-grid {
    display: grid;
    grid-template-columns: 200px 200px;
    gap: 10px 12px;
    width: fit-content;
    max-width: 400px;
}

.est-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #e2e2e2;
    border-radius: 3px;
    padding: 3px 13px 3px 3px; /* Total 10px extra padding on the right */
    border: 1px solid #d0d0d0;
    min-width: 100px;
    width: fit-content;
}

.est-chip-grid .est-chip {
    width: 200px;
}

.est-chip input {
    margin: 0;
    accent-color: #007bff;
}

.est-chip span {
    font-size: 14px;
    white-space: nowrap;
}

.est-chip:has(input:checked) {
    background: #feffbb;
}

/* Buttons */
.est-btn {
    font-weight: 800;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1;
}

.est-btn-yellow {
    background: linear-gradient(#ffcc66, #f39c12);
    color: #000;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
}

.est-btn-yellow:hover {
    filter: brightness(1.03);
}

.est-btn-outline {
    background: #fff;
    color: #000;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,.35);
}

.est-btn-submit {
    background: var(--e-global-color-primary, #213A52);
    color: #fff;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
    width: 100px;
}

.est-btn-submit:hover {
    filter: brightness(1.1);
}

.est-btn-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* Error styles & focus */
:focus {
    outline: 3px solid #2b90ff;
    outline-offset: 2px;
}

.est-subhead:focus {
    outline: none;
}

.est-err {
    border-color: #d93025 !important;
    box-shadow: 0 0 0 2px rgba(217,48,37,.15);
}

.est-error-msg {
    color: #d93025;
    font-size: .85rem;
    margin-top: 6px;
}

.est-error-summary {
    background: #fff;
    border-left: 4px solid #d93025;
    padding: 10px 12px;
    margin: 10px 0;
    border-radius: 8px;
    color: #111;
}

/* Layout */
.est-hidden {
    display: none !important;
}

.est-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.est-grid-2:has(#phone) {
    grid-template-columns: 35% 1fr;
}

.est-grid-2:has(#street) {
    grid-template-columns: 2fr 1fr;
}

@media (max-width: 640px) {
    .est-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .est-grid-2:has(#phone) {
        grid-template-columns: 1fr;
    }
    
    .est-grid-2:has(#street) {
        grid-template-columns: 1fr;
    }
    
    .est-card {
        padding: 18px 16px 22px;
    }
    
    .est-title {
        font-size: 26px !important;
    }
    
    .est-chip-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 100%;
    }
}

/* Thank-you */
#thankyouPanel {
    text-align: center;
}

#thankyouPanel .est-title {
    color: #1a2a3e !important;
    margin-bottom: 8px;
}

/* Honeypot (bot trap) */
.est-hp {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Disclaimer */
.est-disclaimer {
    font-size: 12px;
    color: #666;
    margin-top: 15px;
    line-height: 1.4;
}

/* ============================================ */
/* ADA Compliance Enhancements                 */
/* ============================================ */

/* Skip link for keyboard users */
.est-skip-link {
    position: absolute;
    left: -9999px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 999999;
}

.est-skip-link:focus {
    position: absolute;
    left: 6px;
    top: 6px;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Enhanced keyboard navigation for chip inputs */
.est-chip:has(input:focus-visible) {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
    background: #e8f4ff;
}

/* Better error field focus visibility */
.est-err:focus {
    outline: 3px solid #d93025;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(217, 48, 37, 0.1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .est-chip:has(input:checked) {
        outline: 3px solid currentColor;
        outline-offset: 1px;
    }
    
    .est-btn {
        border: 2px solid currentColor;
    }
    
    .est-err {
        outline: 2px solid currentColor;
    }
    
    .est-card {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for all interactive elements */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

/* Ensure minimum touch target size (44x44px) */
.est-chip {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
}

.est-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Better visual indicators for disabled elements */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* Ensure sufficient color contrast for help text */
.est-help {
    color: #595959; /* Darker gray for better contrast */
}

/* Loading state indicator */
[aria-busy="true"] {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

[aria-busy="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}