:root {
    --dsd-primary-color: #1f4e79;
    --dsd-secondary-color: #2d5aa0;
    --dsd-light-bg: #f8f9fa;
    --dsd-border-color: #e0e5ea;
    --dsd-text-primary: #333;
    --dsd-text-secondary: #666;
}
.dsd-chatbot-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: 'Sarabun', sans-serif;
}
.dsd-chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--dsd-primary-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.dsd-chatbot-button:hover {
    transform: scale(1.1);
    background-color: var(--dsd-secondary-color);
}
.dsd-chatbot-icon {
    font-size: 24px;
    color: white;
    transition: transform 0.3s ease;
}
.dsd-chatbot-button.active .dsd-chatbot-icon {
    transform: rotate(180deg);
}
.dsd-chatbot-notification {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid white;
    animation: dsd-pulse 2s infinite;
}
@keyframes dsd-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}
.dsd-chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 370px;
    height: 520px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    animation: dsd-slideUp 0.4s ease-out;
    border: 1px solid var(--dsd-border-color);
}
@keyframes dsd-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.dsd-chatbot-header {
    background-color: var(--dsd-primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.dsd-chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.dsd-chatbot-controls button {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
    padding: 5px;
}
.dsd-chatbot-controls button:hover {
    opacity: 1;
}
.dsd-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--dsd-light-bg);
}
.dsd-chatbot-messages::-webkit-scrollbar { width: 6px; }
.dsd-chatbot-messages::-webkit-scrollbar-track { background: #f1f1f1; }
.dsd-chatbot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.dsd-chatbot-messages::-webkit-scrollbar-thumb:hover { background: #aaa; }

.dsd-chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    animation: dsd-messageSlide 0.3s ease-out;
    word-wrap: break-word;
}
@keyframes dsd-messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.dsd-chatbot-message.user {
    background: var(--dsd-primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}
.dsd-chatbot-message.bot {
    background: white;
    color: var(--dsd-text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid var(--dsd-border-color);
    white-space: pre-wrap;
}
.dsd-chatbot-message.error {
    background: #fff0f0;
    color: #c53030;
    border: 1px solid #ffbaba;
}
.dsd-chatbot-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}
.dsd-chatbot-input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--dsd-border-color);
    background: white;
    flex-shrink: 0;
}
.dsd-chatbot-quick-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.dsd-chatbot-quick-btn {
    background: var(--dsd-light-bg);
    color: var(--dsd-primary-color);
    border: 1px solid var(--dsd-border-color);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Sarabun', sans-serif;
}
.dsd-chatbot-quick-btn:hover {
    background: var(--dsd-primary-color);
    color: white;
    border-color: var(--dsd-primary-color);
}
.dsd-chatbot-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.dsd-chatbot-input {
    flex: 1;
    border: 1px solid var(--dsd-border-color);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}
.dsd-chatbot-input:focus {
    border-color: var(--dsd-secondary-color);
}
.dsd-chatbot-send-btn {
    background: var(--dsd-primary-color);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}
.dsd-chatbot-send-btn:hover:not(:disabled) {
    background: var(--dsd-secondary-color);
}
.dsd-chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.dsd-chatbot-typing {
    display: none;
    align-self: flex-start;
    background: white;
    border: 1px solid var(--dsd-border-color);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
}
.dsd-chatbot-typing.show { display: block; }
.dsd-chatbot-typing-dots { display: flex; gap: 4px; align-items: center; }
.dsd-chatbot-typing-dot {
    width: 8px; height: 8px; background: #ccc; border-radius: 50%;
    animation: dsd-typingDot 1.4s infinite ease-in-out;
}
.dsd-chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.dsd-chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes dsd-typingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
.dsd-chatbot-status {
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: var(--dsd-text-secondary);
    border-top: 1px solid var(--dsd-border-color);
    background: var(--dsd-light-bg);
}
.dsd-chatbot-status.online { color: #28a745; }
.dsd-chatbot-status.offline { color: #dc3545; }