/* Global Styles */
:root {
    --primary-color: #232f3e;
    --secondary-color: #ff9900;
    --background-color: #f5f5f5;
    --text-color: #333;
    --light-gray: #e0e0e0;
    --dark-gray: #555;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --card-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.menu {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
}

.menu-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-item.active {
    background-color: var(--secondary-color);
    font-weight: 600;
}

.info-box {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: auto;
}

.info-box h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box ul {
    list-style-type: none;
    margin-left: 5px;
}

.info-box li {
    margin-bottom: 8px;
    font-size: 14px;
    position: relative;
    padding-left: 15px;
}

.info-box li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

/* Main Content Styles */
.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.chat-header {
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px; /* Reduced from 20px */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px; /* Added gap for consistent spacing */
}

.message {
    margin-bottom: 12px; /* Reduced from 20px */
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant, .message.system, .message.error {
    align-items: flex-start;
}

.message-content {
    padding: 8px 12px; /* Reduced from 12px 16px */
    border-radius: 6px; /* Reduced from 8px */
    max-width: 85%; /* Increased from 80% to use more space */
}

.message.user .message-content {
    background-color: var(--secondary-color);
    color: white;
}

.message.assistant .message-content {
    background-color: var(--light-gray);
}

.message.system .message-content {
    background-color: var(--primary-color);
    color: white;
}

.message.error .message-content {
    background-color: var(--error-color);
    color: white;
}

.message-content p {
    margin-bottom: 6px; /* Reduced from 10px */
    white-space: pre-wrap;
    line-height: 1.4; /* Added to make text more compact */
}

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

.message-content ul, .message-content ol {
    margin-left: 15px; /* Reduced from 20px */
    margin-bottom: 6px; /* Reduced from 10px */
    padding-left: 10px; /* Reduced from 15px */
}

.message-content li {
    margin-bottom: 3px; /* Reduced from 5px */
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 1px 3px; /* Reduced from 2px 4px */
    border-radius: 3px; /* Reduced from 4px */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-content pre {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 6px; /* Reduced from 10px */
    border-radius: 3px; /* Reduced from 4px */
    overflow-x: auto;
    margin: 6px 0; /* Reduced from 10px 0 */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.3; /* Reduced from 1.4 */
}

.message-content pre.json {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.message-content table.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 0.9em;
}

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

.message-content table.markdown-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.message-content table.markdown-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.message-content br {
    display: block;
    content: "";
    margin-top: 5px;
}

.chat-input {
    display: flex;
    padding: 10px; /* Reduced from 15px */
    background-color: var(--light-gray);
}

.chat-input textarea {
    flex-grow: 1;
    padding: 8px; /* Reduced from 12px */
    border: none;
    border-radius: 4px;
    resize: none;
    height: 40px; /* Reduced from 50px */
    margin-right: 8px; /* Reduced from 10px */
}

.chat-input button {
    padding: 0 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.chat-input button:hover {
    background-color: var(--secondary-color);
}

/* Pending message animation */
.message.pending .message-content {
    position: relative;
}

.message.pending .message-content:after {
    content: "...";
    animation: dots 1.5s infinite;
    display: inline-block;
    width: 20px;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 15px;
    }
    
    .sidebar h2 {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .menu {
        flex-direction: row;
        overflow-x: auto;
        margin-bottom: 15px;
    }
    
    .menu-item {
        margin-right: 10px;
        margin-bottom: 0;
        white-space: nowrap;
    }
    
    .info-box {
        display: none;
    }
    
    .main-content {
        height: 0;
        flex-grow: 1;
    }
}
/* More compact table and JSON formatting */
.message-content table.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 6px 0;
    font-size: 0.85em;
}

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

.message-content table.markdown-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.message-content table.markdown-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.message-content pre.json {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.85em;
    padding: 5px;
    line-height: 1.3;
}

/* Device information specific formatting */
.device-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
    margin: 5px 0;
}

.device-card {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    background-color: #f9f9f9;
}

.device-card h4 {
    margin: 0 0 5px 0;
    font-size: 0.95em;
    color: var(--primary-color);
}

.device-card p {
    margin: 3px 0;
    font-size: 0.85em;
}

.device-property {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.device-property-name {
    font-weight: bold;
    color: var(--dark-gray);
}
/* More compact device information display */
.device-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin: 5px 0;
    width: 100%;
}

.device-card {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.device-card h4 {
    margin: 0 0 5px 0;
    font-size: 0.95em;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.device-property {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 0.85em;
}

.device-property-name {
    font-weight: bold;
    color: var(--dark-gray);
    margin-right: 8px;
}

.more-info-content {
    border-top: 1px dashed #ddd;
    padding-top: 5px;
    margin-top: 5px;
}

/* Improved list styling */
ul {
    margin-left: 0 !important;
    padding-left: 15px !important;
}

li {
    margin-bottom: 3px !important;
}

/* Make code blocks more compact */
pre, code {
    font-size: 0.85em !important;
    line-height: 1.3 !important;
}

/* Improve table display */
table.markdown-table {
    font-size: 0.85em !important;
}

table.markdown-table th, 
table.markdown-table td {
    padding: 4px 6px !important;
}

/* Make message content more compact */
.message-content p {
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
}

/* Highlight important information */
strong {
    color: var(--primary-color);
}
