/**
 * Aian Form - Public Styles
 */

/* ── CSS Variables ───────────────────────────────────────────────── */
.aian-form-container {
    --aian-primary       : #2271b1;
    --aian-primary-dark  : #1a5a8e;
    --aian-success-bg    : #ecfdf5;
    --aian-success-text  : #065f46;
    --aian-success-border: #a7f3d0;
    --aian-error-bg      : #fef2f2;
    --aian-error-text    : #991b1b;
    --aian-error-border  : #fecaca;
    --aian-border        : #d1d5db;
    --aian-text          : #333333;
    --aian-text-muted    : #9ca3af;
    --aian-radius        : 6px;

    max-width: 650px;
    margin: 20px 0;
    box-sizing: border-box;
}

.aian-form-container * {
    box-sizing: border-box;
}

/* ── Form Wrapper ────────────────────────────────────────────────── */
.aian-form {
    background: #ffffff;
    padding: 32px;
    border-radius: var(--aian-radius);
    box-shadow: 0 2px 18px rgba(0,0,0,0.08);
}

.aian-form-title {
    margin: 0 0 26px;
    font-size: 24px;
    font-weight: 600;
    color: #1e1e1e;
    line-height: 1.3;
}

/* ── Field Wrapper ───────────────────────────────────────────────── */
.aian-field {
    margin-bottom: 20px;
}

.aian-field:last-of-type {
    margin-bottom: 0;
}

/* ── Label ───────────────────────────────────────────────────────── */
.aian-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: var(--aian-text);
    line-height: 1.4;
}

.aian-required {
    color: #e74c3c;
    margin-left: 2px;
}

/* ── Inputs ──────────────────────────────────────────────────────── */
.aian-input,
.aian-textarea,
.aian-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--aian-border);
    border-radius: var(--aian-radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--aian-text);
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aian-input:focus,
.aian-textarea:focus,
.aian-select:focus {
    border-color: var(--aian-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.15);
}

.aian-input::placeholder,
.aian-textarea::placeholder {
    color: var(--aian-text-muted);
}

.aian-input--error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.12) !important;
}

/* ── Phone input override ────────────────────────────────────────── */
.aian-input--phone {
    padding-left: 52px;
}

/* ── Textarea ────────────────────────────────────────────────────── */
.aian-textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.6;
}

/* ── Select ──────────────────────────────────────────────────────── */
.aian-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Radio & Checkbox ────────────────────────────────────────────── */
.aian-choice-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 14px;
    color: var(--aian-text);
    cursor: pointer;
    line-height: 1.4;
}

.aian-choice-label:last-child {
    margin-bottom: 0;
}

.aian-radio,
.aian-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--aian-primary);
    flex-shrink: 0;
}

.aian-choice-text {
    flex: 1;
}

/* ── Submit Area ─────────────────────────────────────────────────── */
.aian-form-submit {
    margin-top: 26px;
}

.aian-submit-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--aian-primary);
    color: #ffffff;
    padding: 12px 32px;
    border: none;
    border-radius: var(--aian-radius);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    min-width: 140px;
}

.aian-submit-btn:hover {
    background: var(--aian-primary-dark);
    box-shadow: 0 4px 12px rgba(34,113,177,0.3);
}

.aian-submit-btn:active {
    transform: scale(0.98);
}

.aian-submit-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.aian-submit-btn__text {
    transition: opacity 0.15s;
}

.aian-submit-btn__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: aian-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes aian-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Messages ────────────────────────────────────────────────────── */
.aian-form-message {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: var(--aian-radius);
    font-size: 14px;
    line-height: 1.5;
    display: none;
}

.aian-form-message--success {
    display: block;
    background: var(--aian-success-bg);
    color: var(--aian-success-text);
    border: 1px solid var(--aian-success-border);
}

.aian-form-message--error {
    display: block;
    background: var(--aian-error-bg);
    color: var(--aian-error-text);
    border: 1px solid var(--aian-error-border);
}

/* ── Admin error (logged-in only) ────────────────────────────────── */
.aian-form-error {
    background: #fff;
    border: 1px solid #e74c3c;
    border-left: 4px solid #e74c3c;
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: var(--aian-radius);
    color: #721c24;
    font-size: 13px;
}

/* ── Honeypot ────────────────────────────────────────────────────── */
.aian-hp-field {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media ( max-width: 768px ) {
    .aian-form {
        padding: 20px;
    }

    .aian-form-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .aian-input,
    .aian-textarea,
    .aian-select {
        font-size: 16px;
        padding: 10px 12px;
    }

    .aian-submit-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
    .aian-form-container {
        max-width: 100%;
    }

    .aian-form {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}