/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.brand {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #30363d;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #238636, #2ea043);
    border-radius: 6px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    margin-right: 12px;
}

.brand h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #f0f6fc;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #8b949e;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.bot-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

/* Dropdown / Category Styles */
.category-item {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #21262d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #f0f6fc;
    transition: background 0.2s;
}

.category-header:hover {
    background-color: #30363d;
}

.category-header .arrow {
    font-size: 10px;
    transition: transform 0.2s;
    color: #8b949e;
}

.category-item.open .arrow {
    transform: rotate(90deg);
}

.category-content {
    display: none;
    padding-left: 12px;
    margin-top: 4px;
}

.category-item.open .category-content {
    display: block;
}

.bot-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.bot-item:hover {
    background-color: #21262d;
}

.bot-item.active {
    background-color: #1f6feb26; /* faint blue */
    border-left: 3px solid #1f6feb;
}

.unit-sublist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
}

.status-indicator.online { background-color: #238636; box-shadow: 0 0 5px #238636; }
.status-indicator.idle { background-color: #d29922; }
.status-indicator.busy { background-color: #f85149; }

.bot-name {
    font-size: 14px;
    color: #c9d1d9;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn-primary {
    background-color: #238636;
    color: white;
}
.btn-primary:hover {
    background-color: #2ea043;
}

.icon {
    margin-right: 8px;
    font-size: 16px;
}

/* Main Interface */
.main-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0d1117;
}

.chat-header {
    height: 60px;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: #0d1117;
}

.current-bot-info h2 {
    font-size: 16px;
    color: #f0f6fc;
    display: inline-block;
    margin-right: 10px;
}

.status-badge {
    font-size: 10px;
    background-color: #23863626;
    color: #3fb950;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #238636;
}

.icon-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 18px;
    margin-left: 10px;
}
.icon-btn:hover { color: #c9d1d9; }

/* Chat Viewport */
.chat-viewport {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace; /* Terminal vibe */
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

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

.system-message {
    text-align: center;
    font-size: 12px;
    color: #484f58;
    margin: 20px 0;
    border-bottom: 1px solid #21262d;
    line-height: 0.1em;
}
.system-message .content {
    background:#0d1117; 
    padding:0 10px; 
    display: inline;
}
.system-message .timestamp {
    display: none;
}

.bot-message {
    display: flex;
    align-items: flex-start;
    max-width: 80%;
}

.bot-message .avatar {
    width: 32px;
    height: 32px;
    background-color: #1f6feb;
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.message-body {
    background-color: #161b22;
    padding: 10px 14px;
    border-radius: 0 8px 8px 8px;
    border: 1px solid #30363d;
}

.message-body .sender {
    font-size: 11px;
    color: #8b949e;
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.message-body .text {
    font-size: 14px;
    line-height: 1.5;
    color: #e6edf3;
}

/* User Message styling (right aligned) */
.user-message {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.user-message .message-body {
    background-color: #1f6feb1a; /* faint blue bg */
    border: 1px solid #1f6feb4d;
    border-radius: 8px 8px 0 8px;
    max-width: 70%;
}

.user-message .sender {
    text-align: right;
    color: #58a6ff;
}

/* Input Area */
.input-area {
    padding: 20px;
    background-color: #0d1117;
    border-top: 1px solid #30363d;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 0 12px;
    height: 48px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.prompt-char {
    color: #238636;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
    margin-right: 10px;
}

#user-input {
    flex: 1;
    background: none;
    border: none;
    color: #c9d1d9;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.send-btn {
    background: none;
    border: none;
    color: #58a6ff;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
}
.send-btn:hover { color: #79c0ff; }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { color: #f0f6fc; font-size: 16px; }
.close-modal { background: none; border: none; color: #8b949e; font-size: 20px; cursor: pointer; }

.modal-body {
    padding: 20px;
}

.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #8b949e;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 8px 12px;
    color: #c9d1d9;
    font-family: inherit;
    outline: none;
}
.form-group textarea { height: 80px; resize: vertical; }

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #30363d;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background-color: #21262d;
    color: #c9d1d9;
}
.btn-secondary:hover { background-color: #30363d; }
