/**
 * PMG Forms - Frontend Styles
 *
 * NJDog.com theme: dark green background, white labels, gold button.
 * Matches WPForms Snippet #42 styling for consistency.
 * Mobile-first responsive design.
 */

/* === Base Form Wrapper === */
.pmg-form-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
}

/* === Form Element === */
.pmg-form {
    background-color: transparent;
    border-radius: 0;
    padding: 32px;
    color: #ffffff;
}

/* === Form Heading === */
.pmg-form-heading {
    color: #ffffff;
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 24px 0;
    text-align: left;
}

/* === Form Row (side-by-side fields) === */
.pmg-form-row {
    display: flex;
    gap: 16px;
}

.pmg-form-half {
    flex: 1;
}

/* === Form Fields === */
.pmg-form-field {
    margin-bottom: 20px;
}

.pmg-form-field label {
    display: block;
    font-size: 16px;
    font-weight: normal;
    margin-bottom: 6px;
    color: #ffffff;
    text-align: left;
}

.pmg-form-field .required {
    color: #d63637;
}

.pmg-form-field input[type="text"],
.pmg-form-field input[type="email"],
.pmg-form-field input[type="tel"],
.pmg-form-field input[type="url"],
.pmg-form-field input[type="number"],
.pmg-form-field select,
.pmg-form-field textarea {
    width: 100%;
    padding: 14px 12px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    line-height: 1.5;
    color: #333333;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    height: 43px;
}

.pmg-form-field textarea {
    height: auto;
}

.pmg-form-field input::placeholder,
.pmg-form-field textarea::placeholder {
    color: #b0b0b0;
}

.pmg-form-field input:focus,
.pmg-form-field select:focus,
.pmg-form-field textarea:focus {
    outline: none;
    border-color: #064A36;
    box-shadow: 0 0 0 3px rgba(6, 74, 54, 0.2);
}

/* Select dropdown arrow */
.pmg-form-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: #ffffff;
    padding-right: 40px;
}

.pmg-form-field select option {
    background-color: #ffffff;
    color: #333333;
}

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

/* === Range Slider === */
.pmg-range-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pmg-range-wrapper input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    outline: none;
}

.pmg-range-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #F2AE14;
    cursor: pointer;
    border: 2px solid #fff;
}

.pmg-range-wrapper input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #F2AE14;
    cursor: pointer;
    border: 2px solid #fff;
}

.pmg-range-output {
    min-width: 80px;
    text-align: center;
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
}

/* === Checkbox === */
.pmg-checkbox-field label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.pmg-checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 2px;
    accent-color: #1a5f3f;
}

.pmg-checkbox-field span {
    font-size: 14px;
    line-height: 1.4;
    color: #ffffff;
}

/* === Submit Button === */
.pmg-form-submit {
    margin-top: 8px;
}

.pmg-submit-btn {
    display: block;
    width: 100%;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    background-color: #c8972e;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
    min-height: 41px; /* Touch target */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pmg-submit-btn:hover {
    background-color: #b08526;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(200, 151, 46, 0.4);
}

.pmg-submit-btn:active {
    transform: translateY(0);
}

.pmg-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pmg-submit-btn .pmg-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pmg-submit-btn .pmg-btn-loading::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pmg-spin 0.8s linear infinite;
}

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

/* === Field Errors === */
.pmg-field-error {
    display: block;
    font-size: 13px;
    color: #ffb3b3;
    margin-top: 4px;
    min-height: 0;
}

.pmg-field-error:empty {
    display: none;
}

.pmg-form-field.has-error input,
.pmg-form-field.has-error select,
.pmg-form-field.has-error textarea {
    border-color: #d63637;
    box-shadow: 0 0 0 3px rgba(214, 54, 55, 0.15);
}

/* === Form Messages === */
.pmg-form-messages {
    margin-top: 16px;
    text-align: center;
}

.pmg-form-messages .pmg-success {
    background-color: transparent;
    border: none;
    color: #ffffff;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 18px;
}

.pmg-form-messages .pmg-error {
    background-color: rgba(255, 107, 107, 0.15);
    border: 1px solid #ff6b6b;
    color: #ffb3b3;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
}

.pmg-form-messages .pmg-error .pmg-retry-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    font-size: 14px;
    color: #fff;
    background: #c8972e;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* === Error Banner (Step 2 missing email) === */
.pmg-form-error-banner {
    background-color: rgba(255, 107, 107, 0.15);
    border: 1px solid #ff6b6b;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: #ffb3b3;
}

.pmg-form-error-banner a {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 24px;
    background: #c8972e;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}

/* === reCAPTCHA === */
.pmg-recaptcha-field {
    display: flex;
    justify-content: center;
}

/* === Responsive === */
@media (max-width: 768px) {
    .pmg-form {
        padding: 20px 16px;
    }

    .pmg-form-row {
        flex-direction: column;
        gap: 0;
    }

    .pmg-form-half {
        width: 100%;
    }

    .pmg-form-heading {
        font-size: 20px;
    }

    .pmg-submit-btn {
        font-size: 15px;
        padding: 12px 20px;
    }

    .pmg-range-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pmg-range-output {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .pmg-form {
        padding: 16px 12px;
    }
}
