:root {
    --primary-color: #0056b3;
    /* Civil Registry Blue-ish */
    --secondary-color: #f0f2f5;
    --text-color: #333;
    --border-color: #ddd;
    --sidebar-width: 300px;
    --header-height: 60px;
    --chat-bg: #fff;
    --user-msg-bg: #0056b3;
    --user-msg-text: #fff;
    --bot-msg-bg: #e9ecef;
    --bot-msg-text: #333;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f9f9f9;
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-section {
    margin-bottom: 30px;
}

.config-section h3,
.history-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

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

.input-group input {
    flex: 1;
}

.input-group button {
    padding: 8px 12px;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: #555;
}

.input-group button:hover {
    background-color: #e2e6ea;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    border-bottom: 1px solid var(--border-color);
    min-height: 40%;
    /* Ensure it takes up some space */
    max-height: 60%;
}

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

.welcome-message {
    text-align: center;
    color: #999;
    margin-top: 50px;
}

.welcome-message i {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 2px;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--bot-msg-bg);
    color: var(--bot-msg-text);
    border-bottom-left-radius: 2px;
}

/* Evaluation Section */
.evaluation-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.rating-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.rating-btn {
    min-width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.rating-btn:hover {
    background-color: #f0f0f0;
    border-color: var(--primary-color);
}

.rating-btn.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.evaluation-comment {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 8px;
}

.evaluation-comment:focus {
    outline: none;
    border-color: var(--primary-color);
}

.evaluation-actions {
    display: flex;
    gap: 8px;
}

.btn-save-evaluation {
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.btn-save-evaluation:hover {
    background-color: #218838;
}

.btn-save-evaluation:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.evaluation-status {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.evaluation-status.saved {
    color: #28a745;
}

.input-area {
    padding: 20px;
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-area textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
}

.input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    padding: 10px 12px;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background-color: #e2e6ea;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon.recording {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    animation: pulse 1.5s infinite;
}

.recording-status,
.transcription-status {
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

.transcription-status {
    color: #0056b3;
}

#btn-send {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    margin-left: auto;
}

#btn-send:hover {
    background-color: #004494;
}

.recording-active {
    animation: pulse 1.5s infinite;
    background-color: #dc3545 !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Inspector Panel */
.inspector-panel {
    flex: 1;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 4px solid #e9ecef;
    /* Separator */
}

.tabs {
    display: flex;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 10px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: #f0f7ff;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.content-wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 100%;
}

.placeholder-text {
    color: #999;
    text-align: center;
    margin-top: 20px;
    font-style: italic;
}

/* JSON and Code Styling */
pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: #333;
}

.json-key {
    color: #d32f2f;
}

.json-string {
    color: #2e7d32;
}

.json-number {
    color: #1565c0;
}

.json-boolean {
    color: #ef6c00;
}

/* Context Items */
.context-item {
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
}

.context-header {
    background-color: #f5f5f5;
    padding: 10px 15px;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
}

.context-body {
    padding: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    background-color: #fff;
}

.score-badge {
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}
