/**
 * PostBox - Frontend Form Styles
 * @package PostBox
 *
 * Clean default styling. Override in your template with:
 * templates/{template}/html/com_postbox/form/default.php  (layout)
 * templates/{template}/css/postbox-override.css            (styles)
 */

/* ── Wrapper ─────────────────────────────────────────── */
.postbox-form-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
}

/* ── Form header ─────────────────────────────────────── */
.postbox-form-header {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 1.5rem 2rem;
}

.postbox-form-header + .postbox-form {
    border-radius: 0 0 8px 8px;
}

.postbox-form-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}

.postbox-form-description {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.postbox-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
}

/* ── Fields ──────────────────────────────────────────── */
.postbox-field {
    margin-bottom: 1.5rem;
}

.postbox-field label,
.postbox-field > fieldset > legend {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.postbox-field > fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.postbox-field > fieldset > legend {
    padding: 0;
    font-size: 0.875rem;
    float: none;
    width: auto;
}

/* ── Text inputs, email, textarea, select ────────────── */
.postbox-field input[type="text"],
.postbox-field input[type="email"],
.postbox-field textarea,
.postbox-field select {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    color: #1f2937;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.postbox-field input[type="text"]:focus,
.postbox-field input[type="email"]:focus,
.postbox-field textarea:focus,
.postbox-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.postbox-field textarea {
    resize: vertical;
    min-height: 120px;
}

.postbox-field select {
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.25rem;
}

/* ── Placeholder ─────────────────────────────────────── */
.postbox-field input::placeholder,
.postbox-field textarea::placeholder {
    color: #9ca3af;
}

/* ── Checkbox & radio options ────────────────────────── */
.postbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 400;
    color: #374151;
    padding: 0.25rem 0;
    cursor: pointer;
}

.postbox-option input[type="checkbox"],
.postbox-option input[type="radio"] {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: #3b82f6;
}

/* ── Required asterisk ───────────────────────────────── */
.postbox-required {
    color: #dc2626;
    font-weight: 700;
    margin-left: 0.125rem;
}

/* ── Consent field ───────────────────────────────────── */
.postbox-field--consent {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.postbox-field--consent .postbox-option {
    font-size: 0.8125rem;
    color: #6b7280;
}

/* ── Captcha ─────────────────────────────────────────── */
.postbox-captcha {
    margin-bottom: 1.5rem;
}

/* ── Error states ────────────────────────────────────── */
.postbox-field--error input,
.postbox-field--error textarea,
.postbox-field--error select {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.postbox-field-error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin-top: 0.25rem;
    min-height: 0;
}

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

/* ── Submit button ───────────────────────────────────── */
.postbox-submit {
    margin-top: 2rem;
}

.postbox-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
    color: #fff;
    background-color: #1d4ed8;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    min-width: 140px;
}

.postbox-button:hover {
    background-color: #1e40af;
}

.postbox-button:active {
    background-color: #1e3a8a;
}

.postbox-button:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

/* ── Messages (success / error) ──────────────────────── */
.postbox-message {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.postbox-message--success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.postbox-message--error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .postbox-form-header {
        padding: 1.25rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .postbox-form {
        padding: 1.25rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .postbox-form-header + .postbox-form {
        border-radius: 0;
    }
}
