body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

#responseArea {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    min-height: 500px;
    position: relative;
    color: white;
}

#responseArea .message {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

#responseArea .message.speaking {
    background: rgba(76, 175, 80, 0.1);
}

#responseArea .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
    position: relative;
}

#responseArea .message.speaking .avatar {
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.5);
}

#responseArea .message.speaking .avatar::after {
    content: '';
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
}

#responseArea .message-content {
    flex-grow: 1;
    padding: 8px 0;
}

#responseArea .message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

#responseArea .speaker-name {
    font-weight: bold;
    color: #4CAF50;
}

#responseArea .message-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

#responseArea .markdown-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
}

#responseArea .ai-avatar {
    background-color: #4CAF50;
    color: white;
}

#responseArea .user-avatar {
    background-color: #4483c3;
    color: white;
}

/* Voice Activity Indicator */
.voice-indicator {
    display: flex;
    gap: 2px;
    margin-left: 10px;
    align-items: flex-end;
    height: 15px;
    position: relative;
    display: inline-flex;
}

.voice-bar {
    width: 3px;
    height: 15px;
    background: #4CAF50;
    border-radius: 1px;
    animation: voiceBars 1s infinite;
    transform-origin: bottom;
}

.voice-bar:nth-child(2) { animation-delay: 0.2s; }
.voice-bar:nth-child(3) { animation-delay: 0.4s; }
.voice-bar:nth-child(4) { animation-delay: 0.6s; }
.voice-bar:nth-child(5) { animation-delay: 0.8s; }

@keyframes voiceBars {
    0% { transform: scaleY(1); }
    50% { transform: scaleY(0.3); }
    100% { transform: scaleY(1); }
}

#responseArea .message.user {
    flex-direction: row-reverse;
}

#responseArea .message.user .message-content {
    color: #4483c3;
}

#responseArea .message.assistant .message-content {
    color: #333;
}

#responseArea .message.in-progress .message-content {
    border: 1px solid #E0E0E0;
}

#responseArea .markdown-content p {
    margin: 0;
}

#responseArea .markdown-content p + p {
    margin-top: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 5px;
    background: #f0f0f0;
}

.ble-status {
    margin: 10px 0;
    padding: 5px;
    border-radius: 4px;
}

.ble-connected { background-color: #dff0d8; }
.ble-disconnected { background-color: #f2dede; }

/* Container and Panel Styles */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

/* Controls Styles */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.controls button {
    background-color: #4483c3;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.controls button:hover {
    background-color: #407bb6;
}

.controls button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.controls select {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 14px;
}

/* Section Header Styles */
.section-header {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px 20px;
    margin: 20px 0 10px 0;
}

.section-header h3 {
    margin: 0;
    color: #333;
}

/* Status Styles */
#status, .ble-status {
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.success { background-color: #dff0d8; color: #3c763d; }
.error { background-color: #f2dede; color: #a94442; }

/* Log Area Styles */
#logArea {
    margin-top: 20px;
    border: 1px solid #ccc;
    padding: 10px;
    height: 100px;
    overflow-y: auto;
    background: #f9f9f9;
    font-family: monospace;
    font-size: 14px;
    transition: height 0.3s ease;
}

#logArea.expanded {
    height: 300px;
}

.log-entry {
    margin: 5px 0;
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.log-time { color: #666; margin-right: 10px; }
.log-type-send { color: #2196F3; }
.log-type-receive { color: #4CAF50; }
.log-type-error { color: #F44336; }
.log-type-info { color: #9E9E9E; }

/* Conversation History Panel */
#historyBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(68, 131, 195, 0.1);
    color: #4483c3;
    border: 1px solid rgba(68, 131, 195, 0.2);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 100;
}

#historyBtn:hover {
    background-color: rgba(68, 131, 195, 0.2);
}

#historyBtn::before {
    font-size: 16px;
}

#historyPanel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #1a1a1a;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    color: white;
}

#historyPanel h2 {
    position: absolute;
    top: 20px;
    left: 20px;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 500;
}

#historyPanel.show {
    right: 0;
}

#closeHistoryBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

#closeHistoryBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#historyList {
    padding: 70px 20px 20px;
    height: 100%;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-5px);
}

.history-item .time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 5px;
}

.history-item .preview {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    display: -moz-box;
    display: box;
    -webkit-line-clamp: 2;
    -moz-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
}

/* Scrollbar Styles for History Panel */
#historyList::-webkit-scrollbar {
    width: 8px;
}

#historyList::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#historyList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#historyList::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#historyPanel .section-header {
    background: transparent;
    padding: 12px 20px;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#historyPanel .section-header h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.context-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.context-separator::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.context-separator span {
    background: #1a1a1a;
    padding: 0 15px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
    position: relative;
}

.function-call-info {
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

.function-call-header {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
}

.function-call-header:hover {
    background: rgba(255, 255, 255, 0.2);
}

.function-call-header .icon {
    transition: transform 0.2s ease;
    color: rgba(255, 255, 255, 0.7);
}

.function-call-header.expanded .icon {
    transform: rotate(90deg);
}

.function-call-details {
    padding: 12px;
    display: none;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.function-call-details.expanded {
    display: block;
}

.function-name {
    color: #4CAF50;
    font-weight: 500;
}

/* Show/Hide Log Button */
#toggleLogBtn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
}

#toggleLogBtn::after {
    content: 'Expand';
}

#toggleLogBtn.expanded::after {
    content: 'Collapse';
}

/* Log Panel Styles */
.panel.logs-panel {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 600px;
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    transform: translateY(calc(100% - 40px));
    transition: transform 0.3s ease;
    z-index: 1000;
    margin: 0;
}

.panel.logs-panel.expanded {
    transform: translateY(0);
}

.panel.logs-panel .section-header {
    margin: 0;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
}

.panel.logs-panel .section-header:hover {
    background: #f0f0f0;
}

#logArea {
    height: 300px;
    margin: 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Hide expand button when panel is expanded */
.panel.logs-panel.expanded #toggleLogBtn {
    display: none !important;
} 