/**
 * Conversational Forms Frontend Styles
 */

/* Form Container */
.ai-chat-sjpro-form {
    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 Branding Header */
.ai-chat-sjpro-form-branding {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}
.ai-chat-sjpro-form-logo {
    max-height: 60px;
    max-width: 180px;
    width: auto;
    height: auto;
    margin: 0 auto 12px;
    display: block;
    object-fit: contain;
}
.ai-chat-sjpro-form-contact-info {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}
.ai-chat-sjpro-form-contact-info a {
    color: inherit;
    text-decoration: none;
}
.ai-chat-sjpro-form-contact-info a:hover {
    text-decoration: underline;
}

/* Form Field Wrapper */
.ai-chat-sjpro-form-field {
    margin-bottom: 20px;
}

.ai-chat-sjpro-form-field.hidden {
    display: none;
}

.ai-chat-sjpro-form-field.required label::after {
    content: " *";
    color: #d63638;
}

/* Labels */
.ai-chat-sjpro-form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
    font-size: 14px;
}

/* Input Fields */
.ai-chat-sjpro-form-field input[type="text"],
.ai-chat-sjpro-form-field input[type="email"],
.ai-chat-sjpro-form-field input[type="tel"],
.ai-chat-sjpro-form-field input[type="url"],
.ai-chat-sjpro-form-field input[type="number"],
.ai-chat-sjpro-form-field input[type="date"],
.ai-chat-sjpro-form-field input[type="time"],
.ai-chat-sjpro-form-field textarea,
.ai-chat-sjpro-form-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-sjpro-form-field input:focus,
.ai-chat-sjpro-form-field textarea:focus,
.ai-chat-sjpro-form-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.ai-chat-sjpro-form-field input:disabled,
.ai-chat-sjpro-form-field textarea:disabled,
.ai-chat-sjpro-form-field select:disabled {
    background: #f0f0f1;
    cursor: not-allowed;
}

/* Textarea */
.ai-chat-sjpro-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select */
.ai-chat-sjpro-form-field select {
    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='%23646970' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.ai-chat-sjpro-form-field select[multiple] {
    height: auto;
    min-height: 120px;
    padding-right: 12px;
    background-image: none;
}

/* Radio and Checkbox Groups */
.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group.inline,
.checkbox-group.inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.radio-label input,
.checkbox-label input {
    width: auto !important;
    margin: 0;
}

/* File Upload */
.ai-chat-sjpro-form-field input[type="file"] {
    padding: 10px;
    border: 2px dashed #c3c4c7;
    background: #f6f7f7;
    cursor: pointer;
}

.ai-chat-sjpro-form-field input[type="file"]:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 5px;
    font-size: 24px;
    color: #f0c14b;
    cursor: pointer;
}

.star-rating .star {
    transition: transform 0.2s;
}

.star-rating .star:hover {
    transform: scale(1.2);
}

/* Range Slider */
.ai-chat-sjpro-form-field input[type="range"] {
    width: calc(100% - 60px);
    display: inline-block;
    vertical-align: middle;
}

.range-value {
    display: inline-block;
    margin-left: 10px;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #2271b1;
}

/* Section Break */
.section-break {
    margin: 30px 0;
    padding: 20px 0;
    border-top: 2px solid #f0f0f1;
    border-bottom: 2px solid #f0f0f1;
}

.section-break h3 {
    margin: 0 0 10px 0;
    color: #1d2327;
}

.section-break p {
    margin: 0;
    color: #646970;
}

/* Calculation Field */
.calculation-field {
    padding: 15px;
    background: #f6f7f7;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    color: #2271b1;
}

.calculation-prefix,
.calculation-suffix {
    color: #646970;
}

.calculation-result {
    color: #2271b1;
}

/* Help Text */
.field-help {
    font-size: 12px;
    color: #646970;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Error Messages */
.field-error {
    display: block;
    font-size: 12px;
    color: #d63638;
    margin-top: 5px;
}

/* Submit Button */
.ai-chat-sjpro-form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f1;
}

.ai-chat-sjpro-submit-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-chat-sjpro-submit-btn:hover {
    background: #135e96;
}

.ai-chat-sjpro-submit-btn:disabled {
    background: #c3c4c7;
    cursor: not-allowed;
}

/* Form Message */
.ai-chat-sjpro-form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    font-weight: 500;
}

.ai-chat-sjpro-form-message.success {
    background: #edfaef;
    color: #008a20;
    border: 1px solid #00a32a;
}

.ai-chat-sjpro-form-message.error {
    background: #fcf0f1;
    color: #d63638;
    border: 1px solid #d63638;
}

/* Modal Trigger Button */
.ai-chat-sjpro-modal-trigger {
    display: inline-block;
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-chat-sjpro-modal-trigger:hover {
    background: #135e96;
}

/* Modal Styles */
.ai-chat-sjpro-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-chat-sjpro-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideIn 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ai-chat-sjpro-modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #646970;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.ai-chat-sjpro-modal-close:hover {
    color: #1d2327;
}

/* Form List Cards (used in admin/pages) */
.ai-chat-sjpro-form-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.ai-chat-sjpro-form-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ai-chat-sjpro-form-card h4 {
    margin: 0 0 10px 0;
    color: #2271b1;
}

.ai-chat-sjpro-form-card p {
    margin: 0 0 15px 0;
    color: #646970;
    font-size: 14px;
}

.ai-chat-sjpro-form-card code {
    display: block;
    background: #f6f7f7;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #1d2327;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .ai-chat-sjpro-form {
        padding: 15px;
    }

    .radio-group.inline,
    .checkbox-group.inline {
        flex-direction: column;
        gap: 10px;
    }

    .ai-chat-sjpro-modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
}

/* Print Styles */
@media print {
    .ai-chat-sjpro-submit-btn,
    .ai-chat-sjpro-modal-trigger,
    .ai-chat-sjpro-modal-close {
        display: none !important;
    }

    .ai-chat-sjpro-form {
        box-shadow: none;
        border: 1px solid #000;
    }
}
