* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    height: 94vh;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background-color: #2c3e50;
    color: white;
    padding: 8px 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
    font-size: 0.9rem;
    margin: 0 0 0 15px;
    font-weight: 500;
    flex-grow: 1;
    letter-spacing: 0.01em;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.hku-logo {
    height: 32px;
    max-width: 100%;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 85%;
    margin-bottom: 15px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message-content {
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.user-message {
    background-color: #e3f2fd;
    color: #0d47a1;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: #f1f1f1;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    position: relative;
}

/* Markdown styling */
.bot-message .message-content {
    line-height: 1.5;
}

/* Feedback buttons */
.feedback-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
    margin-bottom: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

.feedback-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px;
    margin-left: 2px;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    color: #555;
    transition: background-color 0.2s, color 0.2s;
}

.feedback-button:hover {
    background-color: #f0f0f0;
}

.feedback-button i {
    margin-right: 3px;
}

.feedback-button.liked {
    color: #4CAF50;
    font-weight: 500;
}

.feedback-button.disliked {
    color: #F44336;
    font-weight: 500;
}

.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3,
.bot-message .message-content h4,
.bot-message .message-content h5,
.bot-message .message-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.25;
}

.bot-message .message-content h1 {
    font-size: 1.5em;
}

.bot-message .message-content h2 {
    font-size: 1.3em;
}

.bot-message .message-content h3 {
    font-size: 1.1em;
}

.bot-message .message-content p {
    margin-bottom: 10px;
}

.bot-message .message-content ul,
.bot-message .message-content ol {
    margin-bottom: 10px;
    padding-left: 20px;
}

.bot-message .message-content li {
    margin-bottom: 5px;
}

.bot-message .message-content pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 16px;
    overflow: auto;
    margin-bottom: 10px;
}

.bot-message .message-content code {
    font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 85%;
}

.bot-message .message-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 90%;
}

.bot-message .message-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 16px;
    color: #555;
    margin-bottom: 10px;
}

.bot-message .message-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 10px;
}

.bot-message .message-content table th,
.bot-message .message-content table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.bot-message .message-content table th {
    background-color: #f6f8fa;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

.chat-input-container input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.chat-input-container button {
    margin-left: 8px;
    padding: 8px 16px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

#voiceButton {
    background-color: #2c3e50;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    /* Add a subtle tooltip-like hint */
    position: relative;
}

#voiceButton:hover {
    background-color: #3a546d;
}

#voiceButton:active, #voiceButton.recording {
    background-color: #ff4b4b;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(255, 75, 75, 0.3);
    animation: pulse 1.5s infinite;
}

#voiceButton i.fas {
    font-size: 18px;
    transition: all 0.2s;
    color: white;
}

#voiceButton:active i.fas, #voiceButton.recording i.fas {
    font-size: 22px;
}

/* Add a tooltip on hover to indicate functionality */
#voiceButton::after {
    content: 'Hold to record';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

#voiceButton:hover::after {
    opacity: 1;
    visibility: visible;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.chat-input-container button:hover {
    background-color: #1a252f;
}

.recording-status {
    text-align: center;
    color: #e74c3c;
    font-size: 12px;
    height: 20px;
    padding: 0 10px;
    font-style: italic;
}

.typing-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    align-self: flex-start;
    background-color: #f1f1f1;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #999;
    border-radius: 50%;
    margin: 0 2px;
    display: inline-block;
    animation: typing 1s infinite ease-in-out;
}

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

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

@keyframes typing {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

#restartButton {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.2s ease;
}

#restartButton:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
}

#restartButton svg {
    width: 14px;
    height: 14px;
}
