/* Add these variables at the top of the file */
:root {
    /* Primary Colors */
    --aichat-primary-color: #128c7e;
    --aichat-text-color: #ffffff;

    /* Chat Dimensions */
    --aichat-chat-width: 350px;
    --aichat-chat-height: 500px;

    /* Button Settings */
    --aichat-button-position: bottom-right;
    --aichat-button-size: 60px;

    /* Icons */
    --aichat-button-icon: robot;
    --aichat-send-icon: chevron-right;

    /* Header Text */
    --aichat-header-font: Arial, sans-serif;
    --aichat-header-size: 16px;
    --aichat-header-color: #ffffff;
    --aichat-header-style: normal;

    /* Message Bubbles */
    --aichat-bot-bubble-bg: #ffffff;
    --aichat-bot-bubble-color: #000000;
    --aichat-user-bubble-bg: #dcf8c6;
    --aichat-user-bubble-color: #000000;

    /* Chat Background */
    --aichat-messages-bg-color: #e5ddd5;
    --aichat-messages-bg-image: none;

    /* Input Area */
    --aichat-bottom-color: #f0f2f5;

    /* Button Sizing */
    --aichat-icon-size: 24px;
    
    /* Subheader Styling */
    --aichat-subheader-font: 'Arial', sans-serif;
    --aichat-subheader-size: 12px;
    --aichat-subheader-color: rgba(255, 255, 255, 0.9);
    --aichat-subheader-style: normal;
    
    /* Icon Colors */
    --aichat-trashcan-color: #ffffff;
    --aichat-delete-color: #ffffff;
    --aichat-send-icon-color: #ffffff;
    
    /* SVG Icons - Base64 or URL */
    --aichat-trashcan-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z'/%3E%3C/svg%3E");
    --aichat-delete-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    --aichat-send-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E");
}

/* At the very top of the file, with !important to ensure it's hidden */
#deepseek-chatbot,
#chat-window,
#messages,
#user-input,
#send-button,
.deepseek-chatbot-container,
.deepseek-chatbot,
div[id^="deepseek"],
div[class^="deepseek"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    z-index: -9999 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
}

/* First, reset any old styles */
#deepseek-chatbot,
#chat-window,
#messages,
#user-input,
#send-button,
.deepseek-chatbot-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Now define our new styles with higher specificity */
.aichat-container {
    position: fixed !important;
    z-index: 999999 !important;
    display: block !important;
}

/* Position Classes for Container */
.aichat-container.bottom-right {
    bottom: 20px !important;
    right: 20px !important;
}

.aichat-container.bottom-left {
    bottom: 20px !important;
    left: 20px !important;
}

.aichat-container.bottom-center {
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.aichat-container.middle-right {
    top: 50% !important;
    right: 20px !important;
    transform: translateY(-50%) !important;
}

.aichat-container.middle-left {
    top: 50% !important;
    left: 20px !important;
    transform: translateY(-50%) !important;
}

.aichat-container.top-right {
    top: 20px !important;
    right: 20px !important;
}

.aichat-container.top-left {
    top: 20px !important;
    left: 20px !important;
}

.aichat-container.top-center {
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

/* Chat Button Base Styles */
.aichat-button {
    width: var(--aichat-button-size) !important;
    height: var(--aichat-button-size) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: var(--aichat-primary-color) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
    transition: transform 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Material Icons Base Styles */
.material-icons {
    font-family: 'Material Icons' !important;
    font-weight: normal !important;
    font-style: normal !important;
    font-size: 24px !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    display: inline-block !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    direction: ltr !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* Chat Button Icon */
.aichat-button .material-icons {
    color: var(--aichat-text-color) !important;
    font-size: calc(var(--aichat-button-size) * 0.5) !important;
}

/* Remove ALL old icon styles */
.aichat-icon,
.aichat-send-icon,
.aichat-icon::before,
.aichat-send-icon::before,
.aichat-button i,
.aichat-button i::before,
.aichat-send i,
.aichat-send i::before {
    display: none !important;
}

/* Send Button Icon */
.aichat-send .material-icons {
    color: var(--aichat-text-color) !important;
    font-size: 20px !important;
}

/* Chat Window */
.aichat-window {
    display: none;
    position: absolute;
    bottom: calc(var(--aichat-button-size) + 20px);
    right: 0;
    width: var(--aichat-chat-width);
    height: var(--aichat-chat-height);
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Chat Header */
.aichat-header {
    background-color: var(--aichat-primary-color);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aichat-header-title {
    color: var(--aichat-text-color);
    font-family: var(--aichat-header-font);
    font-size: var(--aichat-header-size);
    font-style: var(--aichat-header-style);
    margin: 0;
}

/* Messages Container */
.aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: var(--aichat-messages-bg-color);
    background-image: var(--aichat-messages-bg-image);
    background-size: cover;
    background-position: center;
}

/* Message Bubbles */
.aichat-message {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 10px;
    position: relative;
}

.aichat-message.bot {
    background-color: var(--aichat-bot-bubble-bg);
    color: var(--aichat-bot-bubble-color);
    margin-right: auto;
    border-top-left-radius: 0;
}

.aichat-message.user {
    background-color: var(--aichat-user-bubble-bg);
    color: var(--aichat-user-bubble-color);
    margin-left: auto;
    border-top-right-radius: 0;
}

/* Input Area */
.aichat-input-area {
    padding: 10px;
    background-color: var(--aichat-bottom-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.aichat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.aichat-send-button {
    background-color: var(--aichat-primary-color);
    color: var(--aichat-text-color);
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.aichat-send-button:hover {
    background-color: var(--aichat-primary-color);
    opacity: 0.9;
}

.aichat-send-button i {
    font-size: 18px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aichat-message {
    animation: slideIn 0.3s ease forwards;
}

/* Scrollbar Styling */
.aichat-messages::-webkit-scrollbar {
    width: 6px;
}

.aichat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aichat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.aichat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Responsive Design */
@media screen and (max-width: 480px) {
    .aichat-container {
        width: calc(100% - 40px) !important;
        height: calc(100% - 100px) !important;
    }

    .aichat-container.bottom-center,
    .aichat-container.top-center {
        left: 20px;
        transform: none;
    }
}

/* Rest of the new styles with body prefix for higher specificity */
body .aichat-button {
    width: var(--aichat-button-size);
    height: var(--aichat-button-size);
    background: var(--aichat-primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    position: relative;
}

body .aichat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

body .aichat-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #25d366;
    border-radius: 50%;
    opacity: 0.4;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    70% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

body .aichat-icon {
    font-size: var(--aichat-icon-size);
    color: white;
    z-index: 1;
}

body .aichat-icon::before {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: inherit;
    display: inline-block;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

body .aichat-send-icon {
    font-size: 20px;
    color: var(--aichat-text-color);
    z-index: 1;
}

body .aichat-send-icon::before {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: inherit;
    display: inline-block;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

/* Optional: Add a tooltip */
body .aichat-button::after {
    content: 'Chat with AI';
    position: absolute;
    right: 70px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
}

body .aichat-button:hover::after {
    opacity: 1;
    visibility: visible;
}

body .aichat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: var(--aichat-chat-width);
    height: var(--aichat-chat-height);
    background: #e5ddd5; /* WhatsApp chat background color */
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
}

body .aichat-header {
    background: var(--aichat-primary-color);
    color: var(--aichat-text-color);
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

body .aichat-header-content {
    flex: 1;
}

body .aichat-header-content h3 {
    margin: 0;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    color: var(--aichat-text-color);
    letter-spacing: 0.3px;
    font-family: var(--aichat-header-font) !important;
    font-size: var(--aichat-header-size) !important;
    color: var(--aichat-header-color) !important;
    font-style: var(--aichat-header-style) !important;
}

body .aichat-header-content p {
    margin: 6px 0 0 0;
    font-size: 12px !important;
    font-weight: normal !important;
    opacity: 0.9;
    line-height: 1.4 !important;
    color: var(--aichat-text-color);
    letter-spacing: 0.2px;
    font-family: var(--aichat-subheader-font) !important;
    font-size: var(--aichat-subheader-size) !important;
    color: var(--aichat-subheader-color) !important;
    font-style: var(--aichat-subheader-style) !important;
}

body .aichat-header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-left: 20px;
    margin-top: 2px;
}

body .aichat-delete,
body .aichat-close {
    background: none;
    border: none;
    color: var(--aichat-delete-color);
    opacity: 0.8;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

body .aichat-delete:hover,
body .aichat-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

body .aichat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    position: relative;
    background: var(--aichat-messages-bg-color);
}

/* Add pseudo-element for background image with opacity */
body .aichat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--aichat-messages-bg-image);
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    display: var(--aichat-messages-bg-image, none);
}

/* Ensure messages are above the background */
body .aichat-message {
    position: relative;
    z-index: 1;
    margin-bottom: 4px;
    padding: 6px 12px 16px 12px;
    min-width: 65%;
    max-width: 85%;
    word-wrap: break-word;
    font-family: var(--aichat-message-font) !important;
    font-size: var(--aichat-message-font-size) !important;
    line-height: calc(var(--aichat-message-font-size) * 1.2) !important;
    -webkit-font-smoothing: antialiased;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Message meta adjustments */
body .message-meta {
    position: absolute;
    bottom: 1px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
    min-width: 50px;
    height: 11px;
    line-height: 1;
}

.feedback-icon {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.feedback-icon:hover {
    opacity: 1;
}

/* Message meta adjustments */
body .message-meta {
    position: absolute;
    bottom: 1px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
    min-width: 50px;
    height: 11px;
    line-height: 1;
}

body .message-time {
    font-size: 11px !important;
    color: rgba(0, 0, 0, 0.45);
    line-height: 11px;
    text-align: right;
}

body .message-ticks {
    font-size: 13px !important;
    color: #4fc3f7;
    line-height: 11px;
    margin-bottom: -1px;
}

/* Typing indicator */
body .aichat-typing {
    padding: 6px 12px;
    background: #ffffff;
    border-radius: 7.5px 7.5px 7.5px 0;
    margin: 0 auto 12px 8px;
    width: fit-content;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
    display: flex;
    align-items: center;
}

body .typing-dots {
    display: flex;
    gap: 4px;
    padding: 0 2px;
    min-width: 35px;
}

body .typing-dot {
    width: 7px;
    height: 7px;
    background: #b6b9bc;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
    opacity: 0.4;
}

body .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

body .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

body .aichat-messages .aichat-bot-message:first-child {
    margin-bottom: 12px;
}

body .aichat-clear {
    opacity: 0.7;
    transition: all 0.2s ease;
    color: var(--aichat-trashcan-color);
}

body .aichat-clear:hover {
    opacity: 1;
    transform: scale(1.1);
}

body .aichat-clear svg {
    vertical-align: middle;
}

/* Header icons styling */
.aichat-header-icons {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    margin-left: auto;
}

.aichat-header-icons > span {
    color: rgba(255, 255, 255, 0.9);
    transition: opacity 0.2s ease;
    opacity: 0.9;
}

.aichat-header-icons > span:hover {
    opacity: 1;
}

/* Header info container */
.aichat-header-info {
    flex: 1;
}

body .aichat-container .aichat-input {
    flex: 1;
    padding: 9px 12px !important;
    border: none !important;
    border-radius: 25px !important;
    outline: none !important;
    font-family: var(--aichat-message-font) !important;
    font-size: var(--aichat-font-size) !important;
    background: white !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

body .aichat-container .aichat-input:focus {
    box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
}

body .aichat-container .aichat-input-container {
    padding: 10px 12px;
    background: var(--aichat-bottom-color);
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 8px;
    align-items: center;
}

body .aichat-send {
    background: var(--aichat-primary-color);
    color: var(--aichat-text-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}

/* Update icon colors */
body .aichat-delete {
    color: var(--aichat-delete-color);
}

body .aichat-clear {
    color: var(--aichat-trashcan-color);
}

/* Update message bubbles */
body .aichat-message.aichat-bot-message {
    background: var(--aichat-bot-bubble-bg);
    color: var(--aichat-bot-bubble-color);
}

body .aichat-message.aichat-user-message {
    background: var(--aichat-user-bubble-bg);
    color: var(--aichat-user-bubble-color);
}

/* Update messages background */
body .aichat-messages {
    background: var(--aichat-messages-bg-color);
}

body .aichat-messages::before {
    background-image: var(--aichat-messages-bg-image);
    /* Only show background image if it's set */
    display: var(--aichat-messages-bg-image, none);
}

/* Update bottom area */
body .aichat-container .aichat-input-container {
    background: var(--aichat-bottom-color);
}

/* Update send button */
body .aichat-send {
    background: var(--aichat-primary-color);
}

body .aichat-send-icon {
    color: var(--aichat-send-icon-color);
}

/* Replace the hardcoded icon classes with variable-based ones */
.aichat-trashcan-icon {
    background-image: var(--aichat-trashcan-icon);
}

.aichat-delete-icon {
    background-image: var(--aichat-delete-icon);
}

.aichat-send-icon {
    background-image: var(--aichat-send-icon);
}
