/**
 * MLS Estimator - Frontend Form CSS
 *
 * Styling for the [mls_estimator_form] shortcode
 * All classes use mlsef- prefix per CSS-PREFIXING-STRATEGY.md
 *
 * @package BananaProperty\MlsEstimator\Public
 */

/* Form Container - matches lm-form-container */
.mlsef-estimator-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Form Element */
.mlsef-estimator-form {
    width: 100%;
}

/* Form Fields Grid - SINGLE COLUMN LAYOUT */
.mlsef-form-fields-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Individual Form Field */
.mlsef-form-field {
    display: flex;
    flex-direction: column;
}

/* Hidden Form Field */
.mlsef-form-field.mlsef-field-hidden {
    display: none;
}

.mlsef-form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

/* Input Fields - matches lm-input */
.mlsef-form-field select,
.mlsef-form-field input[type="number"],
.mlsef-form-field input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #ffffff;
    box-sizing: border-box;
}

/* Select specific styling for vertical centering */
.mlsef-form-field select {
    line-height: 1.2;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

/* Placeholder Styling */
.mlsef-estimator-form select,
.mlsef-estimator-form input::placeholder {
    color: #9ca3af;
}

/* Focus State */
.mlsef-estimator-form select:focus,
.mlsef-estimator-form input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Select Dropdown Arrow */
.mlsef-estimator-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

/* Submit Button Section */
.mlsef-form-submit {
    margin-top: 2rem;
}

/* Submit Button - matches lm-btn-primary */
.mlsef-estimator-form-submit-btn {
    width: 100%;
    padding: 1rem;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mlsef-estimator-form-submit-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mlsef-estimator-form-submit-btn:active {
    transform: translateY(0);
}

/* Messages Section */
.mlsef-form-messages {
    margin-top: 1.5rem;
}

.mlsef-form-loading {
    padding: 1rem;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.mlsef-form-error {
    padding: 1rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    border-radius: 6px;
    font-weight: 500;
}

/* Error State */
.mlsef-error {
    padding: 1rem;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Loading State */
.mlsef-estimator-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.mlsef-estimator-form.loading .mlsef-estimator-form-submit-btn::after {
    content: '...';
    animation: mlsef-loading 1s infinite;
}

@keyframes mlsef-loading {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Responsive - Single Column on Mobile */
@media (max-width: 768px) {
    .mlsef-estimator-form-wrapper {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Switch to single column on tablet and mobile */
    .mlsef-form-fields-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .mlsef-estimator-form-wrapper {
        padding: 1rem;
        margin: 0.5rem;
    }

    .mlsef-estimator-form select,
    .mlsef-estimator-form input {
        font-size: 0.9375rem;
        padding: 0.625rem;
    }

    .mlsef-estimator-form-submit-btn {
        padding: 0.875rem;
        font-size: 1rem;
    }
}

/* Focus Visible for Accessibility */
.mlsef-estimator-form select:focus-visible,
.mlsef-estimator-form input:focus-visible,
.mlsef-estimator-form-submit-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}
