body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

.chat-container {
    max-width: 800px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.chat-header h2, .chat-header p, .chat-header .market-status, .chat-header .header-actions {
    position: relative;
    z-index: 1;
}

.calculator-button-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.btn-calculator-fixed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-calculator-fixed:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b4c93 100%);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-calculator-fixed i {
    font-size: 26px;
}

.chat-header .badge {
    font-size: 0.9rem;
    padding: 0.5em 0.8em;
    vertical-align: middle;
    font-weight: 600;
}

.market-status {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.chat-header h2 {
    color: white;
    margin-bottom: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    margin-right: 0;
    margin-left: 10px;
    order: 2;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

/* Prevent text and chart overlap */
.message-content > div {
    margin-bottom: 15px;
}

.message-content > div:last-child {
    margin-bottom: 0;
}

/* Ensure proper spacing for markdown elements */
.message-content h1, .message-content h2, .message-content h3, 
.message-content h4, .message-content h5, .message-content h6 {
    margin: 15px 0 10px 0;
    line-height: 1.3;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

/* Better list spacing */
.message-content ul, .message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
    line-height: 1.4;
}

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

.user-message .message-content {
    background-color: #0d6efd;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.message-content p + p {
    margin-top: 10px;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

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

.chart-container {
    margin: 20px 0;
    text-align: center;
    clear: both;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.chart-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container iframe {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-input-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.input-group {
    position: relative;
}

#messageInput {
    border-radius: 25px;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#messageInput:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#sendButton {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#sendButton:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#sendButton:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.typing-indicator {
    animation: fadeIn 0.3s ease-in;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

/* Responsive design */
@media (max-width: 768px) {
    .chat-container {
        padding: 10px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .chat-input-container {
        padding: 15px;
    }
    
    #messageInput {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    #sendButton {
        width: 45px;
        height: 45px;
    }
}

/* Enhanced content styling for bot responses */
.bot-message .message-content strong {
    color: #667eea;
    font-weight: 600;
}

.bot-message .message-content p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.bot-message .message-content p:last-child {
    margin-bottom: 0;
}

/* Chart container enhancements */
.chart-container {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.chart-container iframe {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.6);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

/* Loading animation enhancements */
.typing-dots span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Input focus enhancement */
#messageInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Responsive badge adjustments */
@media (max-width: 768px) {
    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}
