﻿:root {
  --body-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --msger-bg: #fff;
  --border: 2px solid #ddd;
  --left-msg-bg: #ececec;
  --right-msg-bg: #579ffb;
}

html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

.chatbody {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 90vh;
  font-family: Helvetica, sans-serif;
}

.msger {
  display: flex;
  flex-flow: column wrap;
  justify-content: space-between;
  width: 100%;
  max-width: 867px;
  height: 100%;
}

.msger-header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: var(--border);
  background: #eee;
  color: #666;
}

.msger-chat {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.msger-chat::-webkit-scrollbar {
  width: 6px;
}
.msger-chat::-webkit-scrollbar-track {
    background: transparent;
}
.msger-chat::-webkit-scrollbar-thumb {
  background: #bdbdbd;
}
.msg {
  display: flex;
  align-items: flex-end;
  margin-bottom: 10px;
}
.msg:last-of-type {
  margin: 0;
}
.msg-img {
  width: 25px;
  height: 25px;
  margin-right: 10px;
  background: #ddd;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border-radius: 50%;
}
.msg-bubble {
    padding: 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    color: #F8F8FF;
    /*  background: var(--left-msg-bg);*/
}
.msg-info {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 10px;
  display: none;
}
.msg-info-name {
  margin-right: 10px;
  font-weight: bold;
}

.left-msg .msg-bubble {
  border-bottom-left-radius: 0;
}

.right-msg {
    flex-direction: column;
    max-width: 60%;
    margin-left: auto;
}

.right-msg .msg-bubble {
    background: #565656;
}

.right-msg .msg-img {
  margin: 0 0 0 10px;
}

.msger-inputarea {
  display: flex;
/*  border-top: var(--border);*/
/*  background: #eee;*/
}
.msger-inputarea * {
  padding: 10px;
  border: none;
  border-radius: 3px;
  font-size: 1em;
}
.msger-input {
    flex: 1;
    background: #57595a;
    color: #F8F8FF;
    border-radius: 20px;
}
.msger-input::-webkit-scrollbar {
    width: 6px;
}

.msger-input::-webkit-scrollbar-track {
    background: transparent;
}

.msger-input::-webkit-scrollbar-thumb {
    background: #bdbdbd;
}
.msger-send-btn {
  margin-left: 10px;
  background: rgb(0, 196, 65);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.23s;
}
.msger-send-btn:hover {
  background: rgb(0, 180, 50);
}

.msger-chat {
    background-color: #454748;
}

.msg-text {
    margin-left: 0px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.msg-text p {
    margin: 0;
}

textarea::placeholder {
    color: #F8F8F8;
}

table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 350px;
    margin-bottom: 10px;
}

table tr th,
table tr td {
    border-right: 1px solid #bbb;
    border-bottom: 1px solid #bbb;
    padding: 5px;
}

    table tr th:first-child,
    table tr td:first-child {
        border-left: 1px solid #bbb;
    }

table tr th {
    background: #808080;
    border-top: 1px solid #bbb;
    text-align: left;
}

/* top-left border-radius */
table tr:first-child th:first-child {
    border-top-left-radius: 6px;
}

/* top-right border-radius */
table tr:first-child th:last-child {
    border-top-right-radius: 6px;
}

/* bottom-left border-radius */
table tr:last-child td:first-child {
    border-bottom-left-radius: 6px;
}

/* bottom-right border-radius */
table tr:last-child td:last-child {
    border-bottom-right-radius: 6px;
}

code.hljs {
    position: relative;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    padding: 10px;
    display: block;
    overflow-x: auto;

    .label{
    position: absolute;
    color: lightgray;
    right: 4px;
    top: 4px;
    font-size: 0.9rem;
    }
}

pre {
    white-space: pre-wrap; /* Since CSS 2.1 */
    white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: -o-pre-wrap; /* Opera 7 */
    word-wrap: break-word; /* Internet Explorer 5.5+ */
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

/* 調整 modal 視窗顏色 */
.modal-content {
    background-color: #333 !important;
    color: white;
}

.modal-header {
    background-color: #444 !important;
    color: white;
}

.modal-footer {
    background-color: #444 !important;
    color: white;
}

/* 改變背景遮罩的顏色 */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.project-item {
    position: relative;
    padding: 10px 10px;
    display: flex;
    align-items: center;
    background-color: #343a40; /* Bootstrap bg-dark */
    color: white;
}

.project-name {
    display: flex;
    align-items: center;
    flex-grow: 1;
    cursor: pointer;
}

.msg-actions {
    visibility: hidden; 
    margin-top: 10px; /* Space between msg-text and msg-actions */
    gap: 10px;
    justify-content: center; 
    position: relative;
    left: 0;
    right: 0;
    z-index: 10; 
    opacity: 0;
    transition: opacity 0.3s ease;
}

.right-msg:hover .msg-actions {
    visibility: visible;
    opacity: 1;
}

.edit-btn, .save-btn, .cancel-btn {
    font-size: 28px;
    cursor: pointer;
    color: #F8F8FF;
}

.save-btn, .cancel-btn {
    visibility: hidden;
    opacity: 0;
}

.editing .save-btn, .editing .cancel-btn {
    visibility: visible;
    opacity: 1;
}

.agent-stack-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 8px;
    min-width: 0;
}

.agent-stage-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.agent-stage-header {
    margin: 0 0 8px 0;
    padding: 0;
    width: 100%;
}

.agent-answer-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.agent-answer-header {
    display: none !important;
}

.agent-stage-title,
.agent-answer-title {
    display: block;
    width: 100%;
    font-size: 13px;
    font-weight: 700;
    color: #f3f4f6;
    letter-spacing: 0.2px;
}

.agent-stage-list,
.agent-answer-content {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.agent-stage-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-step-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid rgba(74, 222, 128, 0.28);
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.04);
    overflow: hidden;
}

.agent-step-card.running {
    border-color: rgba(96, 165, 250, 0.38);
    background: rgba(59, 130, 246, 0.05);
}

.agent-step-card.done {
    border-color: rgba(74, 222, 128, 0.30);
    background: rgba(34, 197, 94, 0.05);
}

.agent-step-card.error {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(239, 68, 68, 0.05);
}

.agent-step-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.agent-step-summary::-webkit-details-marker {
    display: none;
}

.agent-step-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.agent-step-index {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.agent-step-name {
    font-size: 13px;
    font-weight: 600;
    color: #f3f4f6;
    word-break: break-word;
}

.agent-step-status {
    font-size: 12px;
    padding: 4px 9px;
    border-radius: 999px;
    flex: 0 0 auto;
    border: 1px solid transparent;
    white-space: nowrap;
}

.agent-step-status.running {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.22);
}

.agent-step-status.done {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.22);
}

.agent-step-status.error {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.22);
}

.agent-step-body {
    padding: 0 12px 12px 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.agent-step-block + .agent-step-block {
    margin-top: 8px;
}

.agent-step-label {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 4px;
}

.agent-step-pre {
    margin: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #e5e7eb;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.agent-step-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.agent-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

.agent-download-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #dbeafe;
    text-decoration: none;
}

.agent-download-hint {
    font-size: 12px;
    color: #9ca3af;
}

.agent-answer-content {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.75;
    color: #e5e7eb;
    min-height: 20px;
    padding: 0;
}

.agent-answer-content p,
.agent-answer-content li,
.agent-answer-content code,
.agent-answer-content pre,
.agent-answer-content span,
.agent-answer-content div {
    color: inherit;
}

.agent-answer-content pre {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px 12px;
    overflow-x: auto;
}

.agent-answer-content code {
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 6px;
}

.agent-empty-text {
    font-size: 12px;
    color: #9ca3af;
}