body {
    font-family: sans-serif;
}

#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    max-height: 600px;
    border: 1px solid #ccc;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(100%) translateY(20px);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

#chatbot-widget.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#chatbot-header {
    background: linear-gradient(135deg, #0a5640, #0c7c3e);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 2px solid #085238;
}

#chatbot-header span {
    font-weight: 600;
    font-size: 1.1em;
}

#chatbot-header #chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.4em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#chatbot-header #chatbot-close:hover {
    background-color: rgba(255,255,255,0.2);
}

#chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(to bottom, #fafafa, #ffffff);
    min-height: 300px;
}

.message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: linear-gradient(135deg, #0a5640, #0c7c3e);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(10, 86, 64, 0.3);
}

.bot-message {
    background-color: #f8f9fa;
    color: #2c3e50;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.system-message {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    align-self: center;
    font-size: 0.9em;
    font-style: italic;
    border-radius: 12px;
    max-width: 90%;
}

.bot-message.error {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border-color: #bd2130;
}

.bot-message.typing {
    font-style: italic;
    color: #6c757d;
    background-color: #e9ecef;
}

/* Markdown formatting styles */
.message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.message-content em {
    font-style: italic;
    color: #34495e;
}

.message-content code {
    background: #f1f3f4 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 0.9em !important;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    font-weight: 600;
    line-height: 1.3;
    margin: 8px 0 4px 0;
}

.message-content ul {
    margin: 8px 0 !important;
    padding-left: 18px !important;
}

.message-content li {
    margin: 3px 0 !important;
    line-height: 1.4;
}

.message-content li::marker {
    color: #0a5640;
}


#chatbot-input-container {
    display: flex;
    padding: 12px 15px;
    border-top: 2px solid #e9ecef;
    background-color: #fff;
    gap: 8px;
    align-items: center;
}

#chatbot-input {
    flex-grow: 1;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#chatbot-input:focus {
    outline: none;
    border-color: #0a5640;
    box-shadow: 0 0 0 3px rgba(10, 86, 64, 0.1);
}

#chatbot-send {
    padding: 10px 18px;
    background: linear-gradient(135deg, #0a5640, #0c7c3e);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 60px;
}

#chatbot-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 86, 64, 0.3);
}

#chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0a5640, #0c7c3e);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(10, 86, 64, 0.3);
    z-index: 999;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

#chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10, 86, 64, 0.4);
}

#chatbot-toggle.hidden {
    display: none;
}

/* Control Panel Styles */
.control-panel {
    padding: 8px 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.module-selector {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #495057;
    min-width: 120px;
}

.module-selector:focus {
    outline: none;
    border-color: #0a5640;
    box-shadow: 0 0 0 2px rgba(10, 86, 64, 0.1);
}

.module-selector option {
    color: #495057;
    background: white;
}

.new-topic-btn {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s;
}

.new-topic-btn:hover {
    transform: translateY(-1px);
}

/* Feedback System Styles */
.feedback-container {
    position: absolute;
    bottom: 5px;
    right: 10px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.message:hover .feedback-container {
    opacity: 1;
}

.feedback-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.feedback-btn:hover {
    background-color: rgba(0,0,0,0.1);
}

.feedback-btn.active {
    background-color: #0a5640;
    color: white;
}

.feedback-status {
    font-size: 9px;
    color: #6c757d;
    margin-left: 4px;
    white-space: nowrap;
}