
/* ----------------------------------
 * Plugin: AI Chat
 * Version: 2.2.2
 * ---------------------------------- */

/* --- Main Font --- */
body {
    font-family: 'Inter', sans-serif;
}

/* --- Chat Toggle Button --- */
#xtvlink-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #c82333; /* Use brand red */
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    opacity: 0; /* Start hidden for fade-in */
}

#xtvlink-chat-toggle:hover {
    transform: scale(1.1);
}

/* --- Chat Container --- */
#xtvlink-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 370px; /* Slightly wider */
    max-width: 90%;
    height: 520px; /* Slightly taller */
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.3s ease-in-out;
    opacity: 0; /* Start hidden for fade-in */
}

.xtvlink-chat-hidden {
    opacity: 0 !important;
    pointer-events: none;
}

/* --- Chat Header --- */
#xtvlink-chat-header {
    background-color: #343a40; /* Dark header */
    color: #ffffff;
    padding: 12px 20px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
}

#xtvlink-chat-close {
    font-size: 28px;
    cursor: pointer;
    font-weight: 300;
    color: #ffffff;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#xtvlink-chat-close:hover {
    opacity: 1;
}

/* --- Message Area --- */
#xtvlink-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xtvlink-chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: pre-wrap; /* This is crucial for newlines */
}

/* AI Message Bubble */
#xtvlink-chat-container .xtvlink-chat-ai {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px; /* Stylish corner */
    
    /* Overrides */
    text-align: left !important;
    display: block !important;
    justify-content: flex-start !important;
}

/* User Message Bubble */
#xtvlink-chat-container .xtvlink-chat-user {
    background-color: #c82333; /* Brand red */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px; /* Stylish corner */
    
    /* Overrides */
    text-align: left !important;
    display: block !important;
    justify-content: flex-start !important;
}

/* --- THE CSS FIX for BULLETS --- */
/* This rule targets the OUTER span that wraps the whole message */
.xtvlink-chat-message > span:not(.xtvlink-chat-bullet) {
    text-align: left !important;
    display: inline-block !important; 
    width: 100%;
}

/* --- Bullet point styling --- */
.xtvlink-chat-bullet {
    color: #c82333; /* Brand red bullet */
    font-weight: bold;
    margin-right: 5px;
    
    /* This resets the properties from the broken rule above */
    display: inline !important; 
    width: auto !important;
}

/* --- Link Styling --- */
.xtvlink-chat-ai a {
    color: #0056b3; /* Standard link blue */
    text-decoration: underline;
    font-weight: 500;
}

.xtvlink-chat-ai a:hover {
    color: #003d80; /* Darker blue on hover */
}


/* --- Input Area --- */
#xtvlink-chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #ddd;
    background-color: #f9f9ff;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

#xtvlink-chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 18px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#xtvlink-chat-input:focus {
    outline: none;
    border-color: #c82333;
    box-shadow: 0 0 0 3px rgba(200, 35, 51, 0.1);
}

#xtvlink-chat-send {
    background-color: #c82333; /* Brand red */
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#xtvlink-chat-send:hover {
    background-color: #a31c28; /* Darker red */
}

/* --- Custom Scrollbar --- */
#xtvlink-chat-messages::-webkit-scrollbar {
  width: 6px; 
}

#xtvlink-chat-messages::-webkit-scrollbar-track {
  background: transparent; 
}

#xtvlink-chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2); 
  border-radius: 6px; 
}

#xtvlink-chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.4); 
}

/* For Firefox */
#xtvlink-chat-messages {
  scrollbar-width: thin; 
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent; 
}