/**
 * Pardot Form Handler - Frontend Styles
 * 
 * Horizontal layout matching LDRA's existing form style.
 */

.pfh-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.pfh-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Field containers - horizontal layout */
.pfh-field {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    align-items: start;
}

/* Labels on the left */
.pfh-field > label {
    font-weight: 400;
    font-size: 0.9375rem;
    color: #333;
    padding-top: 0.625rem;
    text-align: left;
}

.pfh-required {
    color: #dc3232;
    margin-left: 2px;
}

/* Inputs on the right */
.pfh-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

.pfh-input:focus {
    border-color: #0073aa;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.25);
}

.pfh-input::placeholder {
    color: #999;
}

/* Select dropdowns */
.pfh-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Textarea */
.pfh-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkboxes - stay in right column */
.pfh-field-checkbox {
    grid-template-columns: 200px 1fr;
    align-items: start;
}

.pfh-checkbox-wrapper {
    grid-column: 2;
}

.pfh-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal !important;
}

.pfh-checkbox-label input[type="checkbox"] {
    margin-top: 0.25rem;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.pfh-checkbox-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #555;
}

.pfh-checkbox-text a {
    color: #0073aa;
    text-decoration: underline;
}

.pfh-checkbox-text a:hover {
    color: #005177;
}

/* Submit button */
.pfh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    background-color: #0073aa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.pfh-button:hover {
    background-color: #005177;
}

.pfh-button:focus {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.4);
}

.pfh-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading/submitting states */
.pfh-loading,
.pfh-submitting {
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
}

.pfh-field-submit {
    grid-template-columns: 200px 1fr;
    align-items: center;
    margin-top: 0.5rem;
}

.pfh-field-submit > label {
    /* Empty label column */
}

/* Validation states — class-driven, not browser pseudo-classes */
.pfh-input.pfh-invalid {
    border-color: #dc3232;
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.15);
}

.pfh-product-groups.pfh-group-invalid {
    outline: 2px solid #dc3232;
    outline-offset: 6px;
    border-radius: 2px;
}

/* Validation summary box */
.pfh-validation-summary {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.pfh-validation-summary strong {
    display: block;
    margin-bottom: 0.5rem;
}

.pfh-validation-summary ul {
    margin: 0;
    padding-left: 1.25rem;
}

.pfh-validation-summary ul li {
    margin-bottom: 0.25rem;
}

.pfh-validation-summary ul li:last-child {
    margin-bottom: 0;
}

/* Hide conditional fields initially */
.pfh-field-region,
.pfh-field-zip {
    /* JavaScript handles display */
}

/* Help text for multi-select */
.pfh-help-text {
    margin: 4px 0 0 0;
    font-size: 0.875rem;
    color: #666;
    font-style: italic;
    grid-column: 2;
}

/* Responsive - stack on mobile */
@media (max-width: 768px) {
    .pfh-field {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    .pfh-field > label {
        padding-top: 0;
    }
    
    .pfh-field-checkbox,
    .pfh-field-submit {
        grid-template-columns: 1fr;
    }
    
    .pfh-checkbox-wrapper,
    .pfh-help-text {
        grid-column: 1;
    }
    
    .pfh-form-wrapper {
        padding: 0 1rem;
    }
    
    .pfh-input {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .pfh-button {
        width: 100%;
    }
    
    .pfh-field-checkbox > label:first-child {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pfh-input {
        border-width: 2px;
    }
    
    .pfh-button {
        border: 2px solid #fff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pfh-input,
    .pfh-button {
        transition: none;
    }
}

/* Product Interest Hierarchical Checkboxes */
.pfh-product-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pfh-product-group {
    /* No border - cleaner look */
}

.pfh-product-group-header {
    font-weight: 700;
    color: #333;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.pfh-product-group-items {
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.pfh-product-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.pfh-product-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.pfh-product-checkbox label {
    cursor: pointer;
    font-weight: normal !important;
    margin: 0;
    padding: 0;
    font-size: 0.9375rem;
    color: #333;
}

/* Form Messages (AJAX) */
.pfh-message {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.pfh-message strong {
    display: block;
    margin-bottom: 0.25rem;
}

.pfh-message-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.pfh-message-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}
