/* Chat Layout */
.chat-layout {
  display: flex;
  height: 100%;
}

.chat-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-list { flex: 1; overflow-y: auto; }

.agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.agent-item:hover { background: var(--bg-tertiary); }
.agent-item.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.agent-item .icon { font-size: 24px; }

.agent-item .info { flex: 1; }
.agent-item .name { font-weight: 600; font-size: 14px; }
.agent-item .desc { font-size: 12px; color: var(--text-secondary); }
.agent-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
}

/* Chat Main */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.msg {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.agent {
  align-self: flex-start;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg .msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.msg.agent .msg-text p { margin: 4px 0; }
.msg.agent .msg-text pre { background: rgba(0,0,0,0.2); padding: 8px; border-radius: 6px; overflow-x: auto; margin: 4px 0; }
.msg.agent .msg-text code { font-size: 13px; }
.msg.agent .msg-text ul, .msg.agent .msg-text ol { padding-left: 18px; margin: 4px 0; }
.msg.agent .msg-text a { color: var(--accent); }

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

#chat-input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
}

#chat-input:focus { border-color: var(--accent); }

.btn-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-send:hover { background: var(--accent-hover); }

@media (max-width: 768px) {
  .chat-layout { flex-direction: column; }
  .chat-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    max-height: none;
    overflow: visible;
  }
  .sidebar-header { display: none; }
  .agent-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    -webkit-overflow-scrolling: touch;
  }
  .agent-item {
    flex-direction: column;
    padding: 10px 14px;
    min-width: 80px;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
    gap: 4px;
  }
  .agent-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
    background: var(--bg-tertiary);
  }
  .agent-item .icon { font-size: 28px; }
  .agent-item .info { flex: none; }
  .agent-item .name { font-size: 12px; }
  .agent-item .desc { display: none; }
  .agent-item .dot { width: 6px; height: 6px; position: absolute; top: 6px; right: 6px; }
  .chat-messages { padding: 12px; }
  .msg { max-width: 85%; }
  .chat-input-area { padding: 8px 12px; }
}
