/* ═══════════════════════════════════════════════════════════════
   AH Contact Form — Andrew Hansen (andrewhansen.au)
   Professional contact form with dark slate/modern branding
   ═══════════════════════════════════════════════════════════════ */

/* --- Reset & Wrapper --- */
.ahcf-wrapper {
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.ahcf-wrapper *,
.ahcf-wrapper *::before,
.ahcf-wrapper *::after {
    box-sizing: border-box;
}

/* --- Card Container --- */
.ahcf-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

/* --- Header --- */
.ahcf-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ahcf-header::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(ellipse at 30% 50%, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.ahcf-header::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -20%;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 70% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.ahcf-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    margin-bottom: 1rem;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ahcf-header-icon svg {
    width: 28px;
    height: 28px;
    color: #38bdf8;
}

.ahcf-title {
    color: #ffffff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    position: relative;
}

.ahcf-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
    position: relative;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Form --- */
.ahcf-form {
    padding: 2rem;
}

/* --- Row (side by side fields) --- */
.ahcf-row {
    display: flex;
    gap: 1rem;
}

@media (max-width: 540px) {
    .ahcf-row {
        flex-direction: column;
        gap: 0;
    }
}

.ahcf-row .ahcf-field {
    flex: 1;
}

/* --- Fields --- */
.ahcf-field {
    margin-bottom: 1.25rem;
}

.ahcf-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.ahcf-required {
    color: #ef4444;
    font-weight: 400;
}

.ahcf-optional {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.8rem;
}

.ahcf-field input[type="text"],
.ahcf-field input[type="email"],
.ahcf-field input[type="tel"],
.ahcf-field select,
.ahcf-field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    line-height: 1.4;
    font-family: inherit;
    color: #1e293b;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.ahcf-field input:focus,
.ahcf-field select:focus,
.ahcf-field textarea:focus {
    border-color: #38bdf8;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.ahcf-field input::placeholder,
.ahcf-field textarea::placeholder {
    color: #94a3b8;
}

.ahcf-field input.ahcf-error,
.ahcf-field select.ahcf-error,
.ahcf-field textarea.ahcf-error {
    border-color: #ef4444;
    background: #fef2f2;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.ahcf-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    text-align: center;
    text-align-last: center;
    line-height: 1.4;
    height: auto;
    min-height: 48px;
    cursor: pointer;
}

.ahcf-field textarea {
    resize: vertical;
    min-height: 120px;
    max-height: 400px;
    line-height: 1.6;
}

.ahcf-char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.ahcf-char-count.ahcf-char-warning {
    color: #f59e0b;
}

.ahcf-char-count.ahcf-char-over {
    color: #ef4444;
    font-weight: 600;
}

/* --- Honeypot (hidden) --- */
.ahcf-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* --- Consent Checkbox --- */
.ahcf-consent {
    margin-top: 0.5rem;
}

.ahcf-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    color: #475569 !important;
    cursor: pointer;
    line-height: 1.5;
}

.ahcf-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #1e293b;
    cursor: pointer;
}

.ahcf-checkbox-label a {
    color: #1e293b;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ahcf-checkbox-label a:hover {
    color: #38bdf8;
}

/* --- Submit Button --- */
.ahcf-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 2rem;
    margin-top: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.ahcf-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ahcf-submit:hover::before {
    opacity: 1;
}

.ahcf-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

.ahcf-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.ahcf-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.ahcf-spinner {
    width: 20px;
    height: 20px;
    animation: ahcf-spin 0.8s linear infinite;
}

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

/* --- Response Messages --- */
.ahcf-response {
    margin: 0 2rem 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: 0.925rem;
    line-height: 1.5;
}

.ahcf-response.ahcf-success {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    color: #166534;
}

.ahcf-response.ahcf-success::before {
    content: '✓ ';
    font-weight: 700;
}

.ahcf-response.ahcf-fail {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}

.ahcf-response.ahcf-fail::before {
    content: '✗ ';
    font-weight: 700;
}

/* --- Footer --- */
.ahcf-footer {
    padding: 1.25rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.ahcf-footer p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
}

.ahcf-footer a {
    color: #1e293b;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.ahcf-footer a:hover {
    color: #38bdf8;
}

/* --- Field error messages --- */
.ahcf-field-error {
    font-size: 0.78rem;
    color: #ef4444;
    margin-top: 0.25rem;
    display: none;
}

.ahcf-field-error.visible {
    display: block;
}

/* --- Responsive --- */
@media (max-width: 540px) {
    .ahcf-wrapper {
        padding: 0 0.5rem;
    }

    .ahcf-header {
        padding: 2rem 1.5rem 1.5rem;
    }

    .ahcf-title {
        font-size: 1.5rem;
    }

    .ahcf-form {
        padding: 1.5rem;
    }

    .ahcf-response {
        margin: 0 1.5rem 1rem;
    }

    .ahcf-footer {
        padding: 1rem 1.5rem;
    }
}
