<?php
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

ob_start();

// Set the content type to CSS
header("Content-type: text/css");

$settings_design = get_option('_doobert_chatbot_design_settings');

$bubble_icon_bk = isset($settings_design['bubble_icon_bk']) ? sanitize_hex_color($settings_design['bubble_icon_bk']) : '#ffffff';
$bubble_icon_hover_bk = isset($settings_design['bubble_icon_hover_bk']) ? sanitize_hex_color($settings_design['bubble_icon_hover_bk']) : '#8ca7b7';
$bubble_icon_ic_bk = isset($settings_design['bubble_icon_ic_bk']) ? sanitize_hex_color($settings_design['bubble_icon_ic_bk']) : '#3181b0';
$bubble_icon_border = isset($settings_design['bubble_icon_border']) ? sanitize_hex_color($settings_design['bubble_icon_border']) : '#3181b0';
$bubble_icon_ic_hover_bk = isset($settings_design['bubble_icon_ic_hover_bk']) ? sanitize_hex_color($settings_design['bubble_icon_ic_hover_bk']) : '#ffffff';

$header_bk_color = isset($settings_design['header_bk_color']) ? sanitize_hex_color($settings_design['header_bk_color']) : '#3181b0';
$header_font_color = isset($settings_design['header_font_color']) ? sanitize_hex_color($settings_design['header_font_color']) : '#ffffff';
$close_icon_bk_color = isset($settings_design['close_icon_bk_color']) ? sanitize_hex_color($settings_design['close_icon_bk_color']) : '#ffffff';
$close_icon_front_color = isset($settings_design['close_icon_front_color']) ? sanitize_hex_color($settings_design['close_icon_front_color']) : '#3181b0';
$close_icon_border_color = isset($settings_design['close_icon_border_color']) ? sanitize_hex_color($settings_design['close_icon_border_color']) : '#3181b0';
$header_logo = isset($settings_design['header_logo']) ? sanitize_url($settings_design['header_logo']) : '';

$body_logo = isset($settings_design['body_logo']) ? sanitize_url($settings_design['body_logo']) : '';
$cb_body_bk = isset($settings_design['cb_body_bk']) ? sanitize_hex_color($settings_design['cb_body_bk']) : '#ffffff';
$cb_default_msg_color = isset($settings_design['cb_default_msg_color']) ? sanitize_hex_color($settings_design['cb_default_msg_color']) : '#3181b0';
$cb_body_chat_bk = isset($settings_design['cb_body_chat_bk']) ? sanitize_hex_color($settings_design['cb_body_chat_bk']) : '#e6e7ec';
$cb_body_chat_front_color = isset($settings_design['cb_body_chat_front_color']) ? sanitize_hex_color($settings_design['cb_body_chat_front_color']) : '#000000';
$cb_body_user_bk = isset($settings_design['cb_body_user_bk']) ? sanitize_hex_color($settings_design['cb_body_user_bk']) : '#3181b0';
$cb_body_user_front_color = isset($settings_design['cb_body_user_front_color']) ? sanitize_hex_color($settings_design['cb_body_user_front_color']) : '#ffffff';
$scroll_bar_color = isset($settings_design['scroll_bar_color']) ? sanitize_hex_color($settings_design['scroll_bar_color']) : '#3181b0';

$send_message_bk = isset($settings_design['send_message_bk']) ? sanitize_hex_color($settings_design['send_message_bk']) : '#fffbfb';
$send_message_button_bk = isset($settings_design['send_message_button_bk']) ? sanitize_hex_color($settings_design['send_message_button_bk']) : '#3181b0';
$send_message_button_icon_color = isset($settings_design['send_message_button_icon_color']) ? sanitize_hex_color($settings_design['send_message_button_icon_color']) : '#ffffff';

// Your dynamic CSS generation code here
?>

#chat-icon svg {
height: 45px;
}
#chat-icon {
border-color: <?php echo esc_attr($bubble_icon_border); ?> !important;
background-color: <?php echo esc_attr($bubble_icon_bk); ?> !important;
}
div#chat-icon:hover {
background-color: <?php echo esc_attr($bubble_icon_hover_bk); ?> !important;
}
#chat-icon g {
fill: <?php echo esc_attr($bubble_icon_ic_bk); ?> !important;
}
div#chat-icon:hover svg#chat_ic_svg g {
fill: <?php echo esc_attr($bubble_icon_ic_hover_bk); ?> !important;
}
.chat_header_top {
background-color: <?php echo esc_attr($header_bk_color); ?> !important;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
display: flex;
justify-content: space-between;
}
#chat-header h4 {
color: <?php echo esc_attr($header_font_color); ?> !important;
}
div#chat-close-button {
border-color: <?php echo esc_attr($close_icon_border_color); ?> !important;
}
div#chat-close-button {
background-color: <?php echo esc_attr($close_icon_bk_color); ?>;
display: flex;
justify-content: center;
align-items: center;
}
div#chat-close-button svg {
width: 30px;
}
div#chat-close-button g {
fill: <?php echo esc_attr($close_icon_front_color); ?>;
}
.is-success {
background: <?php echo esc_attr($cb_body_user_bk); ?>;
}
.user_column .msg.notification_part {
color: <?php echo esc_attr($cb_body_user_front_color); ?>;
}
#chat-body,
.messageHistory {
background-color: <?php echo esc_attr($cb_body_bk); ?> !important;
}
.chat_load .pre_button {
color: <?php echo esc_attr($cb_default_msg_color); ?>;
border-color: <?php echo esc_attr($cb_default_msg_color); ?>;
}
.actual_chat .notification.is-success {
background-color: <?php echo esc_attr($cb_body_chat_bk); ?> !important;
}
.is-success * {
color: <?php echo esc_attr($cb_body_chat_front_color); ?>;
}
#chat-body::-webkit-scrollbar-thumb,
#chat-footer #message-input::-webkit-scrollbar-thumb {
background-color: <?php echo esc_attr($scroll_bar_color); ?>;
}
#chat-body::-moz-scrollbar-thumb,
#chat-footer #message-input::-moz-scrollbar-thumb {
background-color: <?php echo esc_attr($scroll_bar_color); ?>;
}
#message-input {
background: <?php echo esc_attr($send_message_bk); ?>;
}
#send-message {
background: <?php echo esc_attr($send_message_button_bk); ?> !important;
}
#send-message svg {
fill: <?php echo esc_attr($send_message_button_icon_color); ?> !important;
}
<!-- #chat-tooltip_appdbrt {
      color: <?php //echo esc_attr($bubble_icon_border); ?>;
      border: 2px solid <?php //echo esc_attr($bubble_icon_border); ?>;
      background-color:<?php //echo esc_attr($bubble_icon_bk); ?>;
}
.chat-tooltip-right-bottom::before, .chat-tooltip-right-center::before{    
    border-left: 8px solid <?php //echo esc_attr($bubble_icon_border); ?>;
    color: <?php //echo esc_attr($bubble_icon_border); ?>;
}
.chat-tooltip-left-bottom::before, .chat-tooltip-left-center::before{        
    border-right: 8px solid <?php //echo esc_attr($bubble_icon_border); ?>;
    color: <?php //echo esc_attr($bubble_icon_border); ?>;
}
#bar_appdbrt {
  background-color: <?php //echo esc_attr($header_bk_color); ?>;
}
.close-btn_appbrt {
  color:<?php echo esc_attr($bubble_icon_border); ?> !important;
  border: 2px solid <?php //echo esc_attr($bubble_icon_border); ?> !important;
  background-color:<?php //echo esc_attr($bubble_icon_bk); ?> !important;
}
.close-btn_appbrt:hover {
  color: <?php //echo esc_attr($bubble_icon_hover_color); ?> !important;
} -->
<?php
echo esc_html(ob_get_clean());
