/**
 * brandinghub Form Component Frontend Styles
 */

/* Form Container */
.brandinghub-form {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.brandinghub-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.brandinghub-form input[type="text"],
.brandinghub-form input[type="email"],
.brandinghub-form input[type="tel"],
.brandinghub-form input[type="url"],
.brandinghub-form select,
.brandinghub-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.brandinghub-form input:focus,
.brandinghub-form select:focus,
.brandinghub-form textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Field Validation States */
.brandinghub-form .field-success {
    border-color: #28a745;
}

.brandinghub-form .field-error {
    border-color: #dc3545;
}

.brandinghub-form .field-validation {
    margin-top: 5px;
    font-size: 14px;
    min-height: 20px;
}

.brandinghub-form .field-validation.success {
    color: #28a745;
}

.brandinghub-form .field-validation.error {
    color: #dc3545;
}

.brandinghub-form .error-message {
    display: inline-block;
}

.brandinghub-form .success-message {
    color: #28a745;
    font-weight: bold;
}

/* Email Suggestions */
.brandinghub-form .email-suggestions {
    margin-top: 5px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
}

.brandinghub-form .email-suggestion {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.brandinghub-form .email-suggestion:hover {
    text-decoration: underline;
}

/* Submit Button */
.brandinghub-form .submit-button {
    background: #0073aa;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 100%;
}

.brandinghub-form .submit-button:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.brandinghub-form .submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.brandinghub-form .submit-button.submitting {
    position: relative;
    color: transparent;
}

.brandinghub-form .submit-button.submitting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading Overlay */
.brandinghub-form.form-loading {
    pointer-events: none;
}

.brandinghub-form .loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 1000;
}

.brandinghub-form .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.brandinghub-form .loading-overlay span {
    color: #666;
    font-weight: 500;
}

/* Form Messages */
.brandinghub-form .form-messages {
    margin-bottom: 20px;
}

.brandinghub-form .form-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: 500;
}

.brandinghub-form .form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.brandinghub-form .form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.brandinghub-form .form-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.brandinghub-form .form-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .brandinghub-form {
        margin: 0 15px;
        padding: 15px;
    }

    .brandinghub-form input,
    .brandinghub-form select,
    .brandinghub-form textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.brandinghub-form .form-message {
    animation: fadeIn 0.3s ease-out;
}

/* HubSpot Form Integration */
.hubspot-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.hubspot-form-container .hs-form {
    font-family: inherit;
}

.hubspot-form-container .hs-form-field {
    margin-bottom: 20px;
}

.hubspot-form-container .hs-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.hubspot-form-container .hs-input {
    width: 100% !important;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.hubspot-form-container .hs-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.hubspot-form-container .hs-button {
    background: #0073aa !important;
    color: white !important;
    padding: 12px 30px !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    width: 100% !important;
}

.hubspot-form-container .hs-button:hover {
    background: #005a87 !important;
}

.hubspot-form-container .hs-error-msg {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .brandinghub-form {
        background: #1a1a1a;
        color: #fff;
    }

    .brandinghub-form label {
        color: #fff;
    }

    .brandinghub-form input,
    .brandinghub-form select,
    .brandinghub-form textarea {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .brandinghub-form input:focus,
    .brandinghub-form select:focus,
    .brandinghub-form textarea:focus {
        border-color: #0073aa;
    }

    .brandinghub-form .email-suggestions {
        background: #2a2a2a;
        border-color: #444;
    }

    .brandinghub-form .loading-overlay {
        background: rgba(26, 26, 26, 0.9);
    }
}
