/* Horizontal Form Component Styles - Fixed Version */
.horizontal-form-section {
    width: 100%;
    background: var(--gray-50);
    padding: var(--spacing-12) var(--spacing-12);
}

/* Form row - horizontal layout WITHOUT wrapping */
.horizontal-form .form-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: nowrap; /* Changed from wrap to nowrap */
}

/* Form fields - adjusted to prevent wrapping */
.horizontal-form .form-field {
    flex: 1 1 0; /* Changed to allow shrinking below min-width */
    min-width: 0; /* Changed from 200px to 0 to allow flexibility */
}

/* Ensure inputs match your design system */
.horizontal-form .form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--gray-100);
    min-width: 120px; /* Add minimum width to inputs themselves */
}

.horizontal-form .form-control:focus {
    background-color: var(--gray-200);
}

/* Submit button container */
.horizontal-form .form-submit {
    flex: 0 0 auto;
}

/* Ensure button styling matches your design */
.horizontal-form .btn-medium {
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Privacy notice */
.horizontal-form .privacy-notice {
    text-align: center;
    font-size: .75rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--spacing-4);
}

.horizontal-form .privacy-notice a {
    color: var(--primary-600);
    text-decoration: underline;
}

/* Section header */
.horizontal-form-section .form-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.horizontal-form-section .form-section-header h2 {
    margin-bottom: 16px;
    font-size: 32px;
    font-weight: 700;
}

.horizontal-form-section .form-section-header p {
    font-size: 18px;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Background color variations */
.horizontal-form-section.py-8 { padding: 32px 0; }
.horizontal-form-section.py-12 { padding: 48px 0; }
.horizontal-form-section.py-16 { padding: 64px 0; }
.horizontal-form-section.py-20 { padding: 80px 0; }

/* Responsive - Only wrap on smaller screens */
@media (max-width: 1024px) {
    .horizontal-form .form-row {
        flex-wrap: wrap; /* Allow wrapping on tablets */
    }
    
    .horizontal-form .form-field {
        flex: 1 1 calc(50% - 4px); /* 2 fields per row on tablet */
        min-width: 200px;
    }
    
    .horizontal-form .form-submit {
        flex: 1 1 100%; /* Full width button on tablet */
        margin-top: 8px;
    }
    
    .horizontal-form .btn-medium {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .horizontal-form .form-row {
        flex-direction: column;
    }
    
    .horizontal-form .form-field {
        min-width: 100%;
        flex: 1 1 100%;
    }
    
    .horizontal-form .form-submit {
        width: 100%;
        margin-top: 0;
    }
    
    .horizontal-form .btn-medium {
        width: 100%;
    }
}

/* === Contact Form 7 Horizontal Form Integration === */
.horizontal-form .wpcf7-form {

    flex-direction: row;
    gap: 8px;
    align-items: stretch;
    flex-wrap: nowrap;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .horizontal-form .wpcf7-form {
        display: grid;
        grid-template-columns: 4fr 1fr;
        .wpcf7-spinner {
            display: none;
        }
        p {
            margin: 0;
        }
        .form-fields-grid p {
            margin: 0;
            display: grid;
            grid-gap: 0.5rem;
            grid-template-columns: repeat(4, 1fr);
            br {
                display: none;
            }
        }
        .wpcf7-submit {
            width: 100%;
        }
        .privacy-notice,
        .wpcf7-response-output {
            grid-column: span 2;
        }
    }
}

.horizontal-form .wpcf7-form .wpcf7-form-control-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.horizontal-form .wpcf7-form input[type="text"],
.horizontal-form .wpcf7-form input[type="email"],
.horizontal-form .wpcf7-form input[type="tel"],
.horizontal-form .wpcf7-form input[type="url"],
.horizontal-form .wpcf7-form input[type="number"],
.horizontal-form .wpcf7-form textarea,
.horizontal-form .wpcf7-form select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--gray-100);
    min-width: 120px;
    border: none;
    border-radius: 0;
    color: var(--secondary-700);
    line-height: var(--line-height-normal);
    outline: none;
    height: 60px;
    font-size: 1rem;
    box-sizing: border-box;
}

.horizontal-form .wpcf7-form input[type="text"]:focus,
.horizontal-form .wpcf7-form input[type="email"]:focus,
.horizontal-form .wpcf7-form input[type="tel"]:focus,
.horizontal-form .wpcf7-form input[type="url"]:focus,
.horizontal-form .wpcf7-form input[type="number"]:focus,
.horizontal-form .wpcf7-form textarea:focus,
.horizontal-form .wpcf7-form select:focus {
    background-color: var(--gray-200);
}

.horizontal-form .wpcf7-form input[type="submit"] {
    flex: 0 0 auto;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-3) var(--spacing-7);
    font-family: var(--font-primary);
    font-size: var(--font-size-btn-medium);
    font-weight: var(--font-weight-black);
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s ease;
    background-color: var(--primary-600);
    color: var(--gray-50);
    border: none;
    letter-spacing: var(--letter-spacing-wide);
}

.horizontal-form .wpcf7-form input[type="submit"]:hover {
    background-color: var(--primary-500);
}

.horizontal-form .wpcf7-not-valid-tip {
    color: var(--tertiary-300, #D7B37D);
    font-size: var(--font-size-small);
    margin-top: 0.25rem;
    display: block;
}

.horizontal-form .wpcf7-not-valid {
    border: 2px solid var(--tertiary-300, #D7B37D) !important;
}

.horizontal-form .wpcf7-response-output {
    margin: 1rem 0 0 0;
    padding: 0.75rem;
    border: 2px solid;
    text-align: center;
    font-size: var(--font-size-small);
    border-radius: 0;
}

.horizontal-form .wpcf7-mail-sent-ok {
    color: var(--primary-300);
    border-color: var(--primary-300);
    background: rgba(125, 188, 140, 0.1);
}

.horizontal-form .wpcf7-mail-sent-ng,
.horizontal-form .wpcf7-validation-errors,
.horizontal-form .wpcf7-spam-blocked {
    color: var(--tertiary-300);
    border-color: var(--tertiary-300);
    background: rgba(215, 179, 125, 0.1);
}

/* Responsive - Only wrap on smaller screens */
@media (max-width: 1024px) {
    .horizontal-form .wpcf7-form {
        flex-wrap: wrap;
    }
    .horizontal-form .wpcf7-form .wpcf7-form-control-wrap {
        flex: 1 1 calc(50% - 4px);
        min-width: 200px;
    }
    .horizontal-form .wpcf7-form input[type="submit"] {
        flex: 1 1 100%;
        margin-top: 8px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .horizontal-form .wpcf7-form {
        flex-direction: column;
    }
    .horizontal-form .wpcf7-form .wpcf7-form-control-wrap {
        min-width: 100%;
        flex: 1 1 100%;
    }
    .horizontal-form .wpcf7-form input[type="submit"] {
        width: 100%;
        margin-top: 0;
    }
}