/* =================================================================
   HBC FORMS - Shared Form Library
   HAIBRID Consulting Brand Template

   Usage: Add class "hbc-webhook-form" to any form
   Variants: .hbc-form--card, .hbc-form--inline, .hbc-form--dark
   ================================================================= */

/* =================================================================
   CSS CUSTOM PROPERTIES (Brand Tokens)
   ================================================================= */
:root {
    /* HBC Brand Colors */
    --hbc-navy: #1a1a2e;
    --hbc-slate: #2d3b55;
    --hbc-steel: #64748b;
    --hbc-gold: #f4c430;
    --hbc-amber: #d4a017;
    --hbc-slate-blue: #4a6fa5;
    --hbc-white: #ffffff;
    --hbc-cloud: #f5f5f5;
    --hbc-mist: #fafafa;

    /* Semantic Colors */
    --hbc-error: #dc2626;
    --hbc-error-bg: #fef2f2;
    --hbc-error-border: #fecaca;
    --hbc-success: #16a34a;
    --hbc-success-bg: #f0fdf4;

    /* Typography */
    --hbc-font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --hbc-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --hbc-space-xs: 4px;
    --hbc-space-sm: 8px;
    --hbc-space-md: 16px;
    --hbc-space-lg: 24px;
    --hbc-space-xl: 32px;

    /* Form-specific */
    --hbc-input-padding: 12px 14px;
    --hbc-input-radius: 6px;
    --hbc-input-border: #d1d5db;
    --hbc-input-focus: var(--hbc-gold);
    --hbc-input-focus-shadow: rgba(244, 196, 48, 0.15);

    /* Transitions */
    --hbc-transition-fast: 150ms ease;
    --hbc-transition-normal: 200ms ease;
}

/* =================================================================
   BASE FORM STYLES
   ================================================================= */
.hbc-webhook-form {
    font-family: var(--hbc-font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--hbc-navy);
}

/* =================================================================
   FORM VARIANTS
   ================================================================= */

/* Card variant - white background with shadow (for landing pages) */
.hbc-form--card {
    background: var(--hbc-white);
    border-radius: 12px;
    padding: var(--hbc-space-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-width: 420px;
    margin: 0 auto;
}

/* Inline variant - no background (for embedded in page sections) */
.hbc-form--inline {
    background: transparent;
    padding: 0;
    max-width: 100%;
}

/* Dark variant - for forms on dark backgrounds */
.hbc-form--dark {
    color: var(--hbc-white);
}

.hbc-form--dark .hbc-form__label {
    color: rgba(255, 255, 255, 0.9);
}

/* =================================================================
   FORM TITLE
   ================================================================= */
.hbc-form__title {
    font-family: var(--hbc-font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--hbc-navy);
    margin: 0 0 var(--hbc-space-lg) 0;
    text-align: center;
}

.hbc-form--dark .hbc-form__title {
    color: var(--hbc-white);
}

/* =================================================================
   FORM FIELDS
   ================================================================= */
.hbc-form__field {
    margin-bottom: var(--hbc-space-md);
}

.hbc-form__field:last-of-type {
    margin-bottom: var(--hbc-space-lg);
}

/* Labels */
.hbc-form__label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: var(--hbc-space-xs);
}

.hbc-form__required {
    color: var(--hbc-error);
    margin-left: 2px;
}

.hbc-form__optional {
    font-weight: 400;
    color: var(--hbc-steel);
    font-size: 13px;
}

/* Inputs & Selects */
.hbc-form__input,
.hbc-form__select,
.hbc-form__textarea {
    width: 100%;
    padding: var(--hbc-input-padding);
    font-family: var(--hbc-font-body);
    font-size: 16px; /* Prevents iOS zoom */
    color: var(--hbc-navy);
    background-color: var(--hbc-white);
    border: 1px solid var(--hbc-input-border);
    border-radius: var(--hbc-input-radius);
    transition: border-color var(--hbc-transition-fast),
                box-shadow var(--hbc-transition-fast);
    box-sizing: border-box;
}

.hbc-form__input:focus,
.hbc-form__select:focus,
.hbc-form__textarea:focus {
    outline: none;
    border-color: var(--hbc-input-focus);
    box-shadow: 0 0 0 3px var(--hbc-input-focus-shadow);
}

.hbc-form__input::placeholder,
.hbc-form__textarea::placeholder {
    color: #9ca3af;
}

/* Select dropdown arrow */
.hbc-form__select {
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2"><polyline points="6,9 12,15 18,9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* Textarea */
.hbc-form__textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* Character counter */
.hbc-form__char-count {
    font-size: 12px;
    color: var(--hbc-steel);
    text-align: right;
    margin-top: var(--hbc-space-xs);
}

/* Error state on fields */
.hbc-form__input--error,
.hbc-form__select--error,
.hbc-form__textarea--error {
    border-color: var(--hbc-error);
}

.hbc-form__input--error:focus,
.hbc-form__select--error:focus,
.hbc-form__textarea--error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* =================================================================
   TURNSTILE WIDGET
   ================================================================= */
.hbc-form__turnstile {
    margin: var(--hbc-space-md) 0;
    display: flex;
    justify-content: center;
}

/* =================================================================
   SUBMIT BUTTON
   ================================================================= */
.hbc-form__submit {
    width: 100%;
    padding: 14px 24px;
    font-family: var(--hbc-font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--hbc-navy);
    background: var(--hbc-gold);
    border: none;
    border-radius: var(--hbc-input-radius);
    cursor: pointer;
    transition: background var(--hbc-transition-fast),
                transform 0.1s ease;
}

.hbc-form__submit:hover {
    background: var(--hbc-amber);
}

.hbc-form__submit:active {
    transform: scale(0.98);
}

.hbc-form__submit:disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
}

/* Button variants */
.hbc-form__submit--secondary {
    background: var(--hbc-slate-blue);
    color: var(--hbc-white);
}

.hbc-form__submit--secondary:hover {
    background: #3d5d8a;
}

.hbc-form__submit--navy {
    background: var(--hbc-navy);
    color: var(--hbc-white);
}

.hbc-form__submit--navy:hover {
    background: var(--hbc-slate);
}

/* Auto-width button */
.hbc-form__submit--auto {
    width: auto;
    min-width: 200px;
}

/* =================================================================
   PRIVACY NOTE / FOOTER TEXT
   ================================================================= */
.hbc-form__privacy {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin-top: var(--hbc-space-md);
    margin-bottom: 0;
}

.hbc-form__expectation {
    font-size: 14px;
    color: var(--hbc-steel);
    margin-top: var(--hbc-space-sm);
    line-height: 1.5;
}

/* =================================================================
   ERROR MESSAGE
   ================================================================= */
.hbc-form__error {
    display: none;
    padding: var(--hbc-space-md);
    margin-bottom: var(--hbc-space-md);
    font-size: 14px;
    color: var(--hbc-error);
    background-color: var(--hbc-error-bg);
    border: 1px solid var(--hbc-error-border);
    border-radius: var(--hbc-input-radius);
}

.hbc-form__error.is-visible {
    display: block;
}

/* =================================================================
   SUCCESS / CONFIRMATION
   ================================================================= */
.hbc-form__confirmation {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--hbc-space-xl) var(--hbc-space-lg);
}

.hbc-form__confirmation.is-visible {
    display: flex;
}

.hbc-form__confirmation-icon {
    margin-bottom: var(--hbc-space-lg);
}

.hbc-form__confirmation-icon svg {
    width: 48px;
    height: 48px;
    fill: var(--hbc-gold);
}

.hbc-form__confirmation h3 {
    font-family: var(--hbc-font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--hbc-navy);
    margin: 0 0 var(--hbc-space-md) 0;
}

.hbc-form__confirmation p {
    font-size: 16px;
    color: var(--hbc-slate);
    margin: 0 0 var(--hbc-space-md) 0;
    line-height: 1.6;
    max-width: 400px;
}

.hbc-form__confirmation a {
    font-weight: 600;
    color: var(--hbc-slate-blue);
    text-decoration: none;
    transition: color var(--hbc-transition-fast);
}

.hbc-form__confirmation a:hover {
    color: var(--hbc-navy);
    text-decoration: underline;
}

/* =================================================================
   LOADING STATE
   ================================================================= */
.hbc-form__submit--loading {
    position: relative;
    color: transparent !important;
}

.hbc-form__submit--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--hbc-navy);
    border-top-color: transparent;
    border-radius: 50%;
    animation: hbc-spin 0.8s linear infinite;
}

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

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 768px) {
    .hbc-form--card {
        padding: var(--hbc-space-lg);
        margin: 0 var(--hbc-space-md);
        border-radius: 8px;
    }

    .hbc-form__title {
        font-size: 20px;
    }

    .hbc-form__submit--auto {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hbc-form--card {
        padding: 20px;
    }

    .hbc-form__input,
    .hbc-form__select,
    .hbc-form__textarea {
        padding: 10px 12px;
    }
}
