/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #003366;
    --secondary-color: #f0f4f8;
    --accent-color: #4a90e2;
    --text-color: #333;
    --border-color: #e0e0e0;
    --sidebar-width: 300px;
    --header-height: 70px;
}

body {
    background-color: #f5f5f5;
    color: var(--text-color);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.new-session-btn {
    margin-bottom: 20px;
}

.new-session-btn button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.new-session-btn button:hover {
    background-color: #00264d;
}

.search-container {
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: #f5f5f5;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h2 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #666;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    padding: 12px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.sidebar-menu li:hover {
    background-color: #f0f0f0;
}

.sidebar-menu li i {
    color: var(--accent-color);
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-menu li.selected {
    background-color: #eef6ff;
    border-left: 4px solid var(--primary-color);
}

.session-list {
    list-style: none;
}

.session-item {
    padding: 15px 10px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.session-item:hover {
    background-color: #f0f0f0;
}

.session-info h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.session-time {
    font-size: 12px;
    color: #888;
}

.message-count {
    background-color: #f0f0f0;
    color: #666;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    background-color: white;
}

.menu-toggle {
    font-size: 20px;
    margin-right: 20px;
    cursor: pointer;
    display: none;
}

.app-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.app-title h1 {
    font-size: 18px;
    font-weight: 600;
}

.app-title p {
    font-size: 12px;
    color: #666;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.header-actions button {
    padding: 8px 15px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    transition: color 0.2s;
}

.header-actions button:hover {
    color: var(--primary-color);
}

.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
    width: 100%;
    box-sizing: border-box;
}

.welcome-message {
    max-width: 98%;
    width: 98%;
    margin: 0 auto;
    background-color: #fff9e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.welcome-message p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.timestamp-container {
    margin-top: 10px;
    text-align: right;
}

.timestamp {
    font-size: 12px;
    color: #888;
    display: inline-block;
}

.analysis-tabs {
    display: flex;
    padding: 0 20px;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    position: relative;
    color: #666;
    font-weight: 500;
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-container input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.input-actions button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    transition: color 0.2s;
}

.input-actions button:hover {
    color: var(--primary-color);
}

#send-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

#send-btn:hover {
    background-color: #3a7bc8;
}

.footer {
    padding: 10px 20px;
    background-color: white;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 12px;
    color: #888;
    text-align: center;
}

/* Message Styles */
.message {
    max-width: 98%;
    margin: 0 auto 20px;
    display: flex;
    flex-direction: column;
    width: 98%;
}

.user-message {
    align-self: flex-end;
    background-color: #e1f0ff;
    padding: 15px;
    border-radius: 15px 15px 0 15px;
    max-width: 95%;
    width: 95%;
    margin-left: 5%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.assistant-message {
    align-self: flex-start;
    background-color: white;
    padding: 15px;
    border-radius: 15px 15px 15px 0;
    max-width: 95%;
    width: 95%;
    margin-right: 5%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    white-space: pre-wrap;
}

.assistant-message p {
    margin-bottom: 10px;
}

.assistant-message ul, .assistant-message ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.assistant-message code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.assistant-message hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
    margin: 20px 0;
}

.assistant-message h1, .assistant-message h2, .assistant-message h3 {
    color: var(--primary-color);
    margin: 15px 0 10px 0;
    font-weight: 600;
}

.assistant-message h1 {
    font-size: 1.4em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

.assistant-message h2 {
    font-size: 1.2em;
}

.assistant-message h3 {
    font-size: 1.1em;
}

.assistant-message strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Image styling */
.assistant-message .report-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

/* Table styling */
.assistant-message .table-container {
    width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.assistant-message table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    font-size: 0.9em;
}

.assistant-message th {
    background-color: var(--primary-color);
    color: white;
    text-align: left;
    padding: 10px;
    font-weight: 600;
}

.assistant-message td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
}

.assistant-message tr:nth-child(even) {
    background-color: #f8f8f8;
}

.assistant-message tr:hover {
    background-color: #f0f4f8;
}

/* Link styling */
.assistant-message a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-color);
}

.assistant-message a:hover {
    color: #2a6fc9;
    border-bottom: 1px solid #2a6fc9;
}

.message-tools {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
}

.message-tools span {
    margin-right: 8px;
    margin-bottom: 5px;
    padding: 3px 8px;
    background-color: #f0f0f0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
}

/* Loading indicators */
.loading-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f9f9f9;
    border-radius: 15px;
    margin: 10px 0;
    animation: pulse 1.5s infinite;
}

.loading-indicator i {
    margin-right: 10px;
    color: var(--accent-color);
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .header-actions button span {
        display: none;
    }
}

/* Add this to your styles.css */
.trend-summary {
    background: #ffffff;
    border-left: 4px solid #6c757d;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #000000;
}

.trend-summary.trend-up {
    background: #ffffff;
    border-left-color: #6c757d;
    color: #000000;
}

.trend-summary.trend-down {
    background: #ffffff;
    border-left-color: #6c757d;
    color: #000000;
}

.trend-summary.trend-neutral {
    background: #ffffff;
    border-left-color: #6c757d;
    color: #000000;
}

.trend-summary h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trend-summary p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.report-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}