/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.chatbot-container {
    background: #ffffff;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    border-radius: 0;
}

.chatbot-header {
    background: linear-gradient(135deg, #f3f4f6 0%, #9ca3af 100%);
    color: #374151;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.chatbot-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
}

.chatbot-logo {
    width: auto;
    height: 80px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
}


.chatbot-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #f3f4f6;
}

.chat-messages {
    flex: 1;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    margin-bottom: 0;
    padding: 16px 20px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.user-message {
    margin-left: auto;
    margin-right: 0;
    max-width: 70%;
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white !important;
    text-align: right;
    border-bottom-right-radius: 6px;
}

.user-message * {
    color: white !important;
}

.user-message,
.user-message span,
.user-message div,
.user-message p,
.user-message strong,
.user-message em,
.user-message code {
    color: white !important;
}

.bot-message {
    margin-left: 0;
    margin-right: auto;
    max-width: 70%;
    background: #ffffff;
    color: #1f2937;
    text-align: left;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
}

.message-header {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    font-weight: 500;
    color: #374151;
}

.message-body {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    color: #374151;
    font-weight: 500;
}

.message-footer {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    border-radius: 12px;
    padding: 16px 20px;
    color: #374151;
    font-weight: 500;
}

.form-container {
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 28px;
    margin-top: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.special-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.left-column {
    flex: 1;
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 28px;
    text-align: center;
    letter-spacing: -0.3px;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    font-size: 15px;
    letter-spacing: -0.1px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1f2937;
    font-weight: 500;
}

.form-input:focus {
    outline: none;
    border-color: #E64761;
    box-shadow: 0 0 0 4px rgba(230, 71, 97, 0.1);
    transform: translateY(-1px);
}

.form-input:hover {
    border-color: #9ca3af;
}

.form-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.form-radio-group {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #374151;
}

.checkbox-item:hover {
    border-color: #E64761;
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.15);
}

.checkbox-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.checkbox-item.checked {
    border-color: #E64761;
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white;
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.3);
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #374151;
}

.radio-item:hover {
    border-color: #E64761;
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.15);
}

.radio-item input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.radio-item.checked {
    border-color: #E64761;
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white;
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.3);
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    background: #ffffff;
    cursor: pointer;
    color: #1f2937;
    font-weight: 500;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #E64761;
    box-shadow: 0 0 0 4px rgba(230, 71, 97, 0.1);
    transform: translateY(-1px);
}

.form-select:hover {
    border-color: #9ca3af;
}

.date-range-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.date-range-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.date-picker-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.date-picker-label {
    font-size: 12px;
    font-weight: 600;
    color: white !important;
    white-space: nowrap;
}

.date-picker-input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.date-picker-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.date-range-item:hover {
    border-color: #E64761;
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.15);
}

.date-range-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.date-range-item.checked {
    border-color: #E64761;
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white;
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.3);
}

.date-range-text {
    font-size: 12px;
    white-space: nowrap;
    flex: 1;
}

.remove-date-button {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.remove-date-button:hover {
    background: #4b5563;
}

.add-date-button {
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    height: 60px;
    color: white !important;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0px;
    box-shadow: 0 2px 8px rgba(230, 71, 97, 0.3);
}

.add-date-button:hover {
    background: linear-gradient(135deg, #E64761  0%, #9d174d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.4);
}

.date-notice { display: none;
}

.form-footer {
    background: linear-gradient(135deg, #f3f4f6 0%, #f3f4f6 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 20px;
    color: #475569;
    font-weight: 500;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.view-only-field {
    background: linear-gradient(135deg, #E64761 0%, #9d174d 100%);
    border: 1px solid #f9a8d4;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(230, 71, 97, 0.1);
}

.view-only-label {
    font-weight: 700;
    color: white !important;
    margin-bottom: 8px;
    font-size: 15px;
    letter-spacing: -0.1px;
}

.view-only-value {
    color: white !important;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.view-only-existing {
    font-size: 13px;
    color: white !important;
    margin-bottom: 4px;
    font-style: italic;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.view-only-formula {
    font-size: 13px;
    color: white !important;
    margin-top: 6px;
    font-style: italic;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.submit-button {
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white !important;
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 24px;
    box-shadow: 0 4px 16px rgba(230, 71, 97, 0.3);
    letter-spacing: -0.2px;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(230, 71, 97, 0.4);
    background: linear-gradient(135deg, #E64761  0%, #9d174d 100%);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(230, 71, 97, 0.3);
}

.chatbot-footer {
    padding: 24px;
    background: linear-gradient(135deg, #f3f4f6 0%, #f3f4f6 100%);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.user-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1f2937;
    font-weight: 500;
}

.user-input:focus {
    border-color: #E64761;
    box-shadow: 0 0 0 4px rgba(230, 71, 97, 0.1);
    transform: translateY(-1px);
}

.user-input:hover {
    border-color: #9ca3af;
}

.send-button {
    background: linear-gradient(135deg, #E64761 0%, #E64761  100%);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.3);
    letter-spacing: -0.1px;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(230, 71, 97, 0.4);
    background: linear-gradient(135deg, #E64761  0%, #9d174d 100%);
}

.send-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(230, 71, 97, 0.3);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: #9ca3af;
    box-shadow: none;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6b7280;
    font-weight: 500;
    padding: 16px;
    background: linear-gradient(135deg, #f3f4f6 0%, #f3f4f6 100%);
    border-radius: 12px;
    margin: 16px 0;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #E64761;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-message {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #9ca3af;
    color: #6b7280;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.1);
}

.success-message {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    border: 1px solid #f9a8d4;
    color: #E64761 ;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(230, 71, 97, 0.1);
}

/* Markdown content styling */
.bot-message ul {
    margin: 10px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.bot-message li {
    margin: 5px 0;
    line-height: 1.5;
}

.bot-message strong {
    font-weight: 700;
    color: #1f2937;
    font-size: 1.05em;
}

.bot-message em {
    font-style: italic;
    color: #6b7280;
}

.bot-message br {
    line-height: 1.6;
}

.bot-message code {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #6b7280;
}

/* Enhanced bold text styling */
.bot-message strong {
    font-weight: 800;
    color: #111827;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.025em;
}

/* Form message styling */
.form-message {
    background: linear-gradient(135deg, #f3f4f6 0%, #f3f4f6 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.form-message[data-form-readonly="true"] {
    opacity: 0.7;
    background: linear-gradient(135deg, #f3f4f6 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e1;
}

.form-message[data-form-readonly="true"] .form-input,
.form-message[data-form-readonly="true"] .form-select,
.form-message[data-form-readonly="true"] .date-picker-input {
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.form-message[data-form-readonly="true"] .checkbox-item,
.form-message[data-form-readonly="true"] .radio-item,
.form-message[data-form-readonly="true"] .date-range-item {
    background-color: #f3f4f6;
    border-color: #cbd5e1;
    cursor: not-allowed;
}

.form-message[data-form-readonly="true"] .submit-button {
    background: #9ca3af !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.readonly-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6b7280;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.completed-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #E64761;
    color: white !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.form-message[data-form-completed="true"] {
    opacity: 0.8;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #E64761;
}

.form-message[data-form-completed="true"] .form-input,
.form-message[data-form-completed="true"] .form-select,
.form-message[data-form-completed="true"] .date-picker-input {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-message[data-form-completed="true"] .checkbox-item,
.form-message[data-form-completed="true"] .radio-item,
.form-message[data-form-completed="true"] .date-range-item {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
}

.form-message[data-form-completed="true"] .submit-button {
    background: #E64761 !important;
    color: white !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .chatbot-container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .chatbot-header {
        padding: 20px 16px;
    }
    
    .chatbot-header h1 {
        font-size: 24px;
    }
    
    .chatbot-body {
        padding: 16px;
    }
    
    .message {
        max-width: 85%;
        padding: 14px 16px;
    }
    
    .user-message {
        max-width: 80%;
    }
    
    .bot-message {
        max-width: 80%;
    }
    
    .form-container {
        padding: 20px;
        margin-top: 16px;
    }
    
    .form-title {
        font-size: 20px;
        margin-bottom: 24px;
    }
    
    .special-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .form-checkbox-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-radio-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-range-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-picker-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .date-picker-input {
        width: 100%;
    }
    
    .checkbox-item,
    .date-range-item {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 14px;
    }
    
    .chatbot-footer {
        padding: 16px;
    }
    
    .input-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .user-input {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .send-button {
        padding: 14px 20px;
        font-size: 14px;
        min-width: auto;
    }
}
