* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    width: 100%;
    max-width: 800px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 700px;
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 12px 12px 0 0;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 5px;
    font-weight: 600;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Chat Section */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

/* Message Styling */
.message {
    display: flex;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 3px;
}

.bot-message .message-content {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 3px;
}

.message-meta {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.7;
}

.user-message .message-meta {
    text-align: right;
    color: #666;
}

.bot-message .message-meta {
    text-align: left;
    color: #999;
}

.confidence {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.low-confidence {
    background: #fff3e0;
    color: #e65100;
}

.faq-label {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    margin-top: 8px;
}

/* Input Section */
.input-section {
    padding: 15px 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-field {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

.input-field::placeholder {
    color: #999;
}

.send-button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.hint-text {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    text-align: center;
}

/* Footer */
.footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    font-size: 12px;
    color: #999;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Responsive Design */
@media (max-width: 600px) {
    .header h1 {
        font-size: 22px;
    }

    .message-content {
        max-width: 85%;
    }

    .send-button {
        padding: 10px 15px;
        font-size: 14px;
    }

    .container {
        max-height: 100vh;
    }
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 12px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingAnimation 1.4s infinite;
}

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

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

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

/* Top Navigation Bar with Topics */
.topics-navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.navbar-label {
    color: white;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.navbar-topics {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.navbar-topic-btn {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-topic-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.navbar-topic-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.loading-topics {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
}

/* Topics Section */
.topics-section {
    padding: 8px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-bottom: 1px solid #e0e0e0;
}

.topics-header {
    margin-bottom: 8px;
    text-align: center;
}

.topics-header h3 {
    margin: 0 0 2px 0;
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

.topics-header p {
    margin: 0;
    color: #666;
    font-size: 11px;
}

.topics-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.topic-badge {
    display: inline-block;
    padding: 5px 10px;
    background: white;
    border: 1.5px solid #667eea;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-weight: 500;
    color: #667eea;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-badge:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.topic-badge.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.topic-badge .count {
    font-size: 10px;
    opacity: 0.8;
    margin-left: 3px;
}
