/* ===== Agent panel (floating bottom 1/3, or right side in split mode) ===== */
.agent-panel {
    display: none;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    position: relative;
}

.agent-panel-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 0;
    flex-shrink: 0;
}

/* Sessions drawer (overlays the agent panel from the left) */
.agent-sessions-drawer {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 5;
    flex-direction: column;
    border-radius: inherit;
}
.agent-sessions-drawer.open { display: flex; }
.agent-sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}
.agent-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.agent-session-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #fafafa;
    transition: background 0.15s;
}
.agent-session-item:hover { background: #f7f7f7; }
.agent-session-item.active { background: #eef4ff; }
.agent-session-item-main {
    flex: 1;
    min-width: 0;
}
.agent-session-item-title {
    font-size: 13px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agent-session-item-time {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.agent-session-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.agent-session-item:hover .agent-session-item-actions { opacity: 1; }
.agent-session-item-actions button {
    background: none;
    border: 1px solid #e0e0e0;
    color: #888;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
}
.agent-session-item-actions button:hover { color: #333; border-color: #bbb; }
.agent-sessions-empty {
    text-align: center;
    color: #999;
    padding: 32px 16px;
    font-size: 13px;
}

.agent-panel-btn {
    background: none;
    border: 1px solid #e8e8e8;
    color: #aaa;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-panel-btn:active {
    border-color: #999;
    color: #666;
}

.agent-panel-btn .icon-collapse {
    display: none;
}

.app.agent-split .agent-panel-btn .icon-expand {
    display: none;
}

.app.agent-split .agent-panel-btn .icon-collapse {
    display: block;
}

.agent-band {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
}

.agent-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.agent-messages::-webkit-scrollbar {
    display: none;
}

.agent-input-area {
    flex-shrink: 0;
    padding: 8px 20px 16px;
}

/* ----- Floating mode (default when agent open) ----- */
.app.agent-floating .agent-panel {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 33.33vh;
    height: 33.33dvh;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.08);
    z-index: 30;
}

/* ----- Split mode (right 1/3 column, lecture takes left 2/3) ----- */
.app.agent-split .main-column {
    flex: 2 1 0;
}

.app.agent-split .agent-panel {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    border-left: 1px solid #e8e8e8;
}

/* Hide mic entry button while panel is open in either mode */
.app.agent-floating .agent-mic-btn,
.app.agent-split .agent-mic-btn {
    display: none;
}

.agent-input-box {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    padding: 8px 12px;
    background: #fff;
}

.agent-plus-btn {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-plus-btn:active {
    border-color: #999;
}

.agent-input-box input[type="text"],
.agent-input-box textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: transparent;
    min-width: 0;
}

.agent-input-box textarea {
    resize: none;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    padding: 0;
}

.agent-input-box input[type="text"]::placeholder,
.agent-input-box textarea::placeholder {
    color: #bbb;
}

.agent-input-box button {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    padding: 4px 16px;
    font-size: 13px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.agent-input-box button:active {
    border-color: #999;
}

/* Mode toggle button (text <-> voice) */
.agent-mode-btn {
    background: none;
    border: 1px solid #ddd;
    color: #666;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.agent-mode-btn:active {
    border-color: #999;
}

.agent-mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 0;
}

.agent-mode-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    fill: none;
}

/* Press-to-talk button */
.agent-voice-btn {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #e8e8e8 !important;
    color: #555 !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    border-radius: 14px !important;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 0.15s, color 0.15s;
}

.agent-voice-btn.recording {
    background: #333 !important;
    color: #fff !important;
    border-color: #333 !important;
}

.agent-voice-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Live ASR hint above the input box */
.agent-voice-hint {
    display: none;
    margin-top: 8px;
    padding: 8px 14px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    min-height: 1.5em;
    max-height: 4.5em;
    overflow-y: auto;
}

.agent-voice-hint.active {
    display: block;
}

/* Agent message styles */
.agent-msg {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.7;
}

.agent-msg.user {
    text-align: right;
}

.agent-msg.user .agent-msg-bubble {
    display: inline-block;
    background: #f5f5f5;
    border-radius: 14px;
    padding: 8px 14px;
    max-width: 80%;
    text-align: left;
    color: #333;
}

.agent-msg.assistant .agent-msg-text {
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-msg.tool-use {
    font-size: 12px;
    color: #999;
    padding-left: 8px;
    border-left: 2px solid #e8e8e8;
}

.agent-msg.tool-result {
    font-size: 12px;
    color: #999;
    padding-left: 8px;
    border-left: 2px solid #e8e8e8;
    margin-top: -8px;
}

.agent-msg.tool-result.error {
    color: #c44;
    border-left-color: #c44;
}

.agent-msg.system {
    text-align: center;
    font-size: 12px;
    color: #bbb;
}

/* AskUserQuestion 卡片 */
.agent-msg.ask-question {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ask-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 14px;
}

.ask-header {
    font-size: 11px;
    color: #999;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.ask-question-text {
    font-size: 14px;
    color: #222;
    margin-bottom: 10px;
    line-height: 1.5;
}

.ask-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ask-option-btn {
    text-align: left;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
}

.ask-option-btn:hover:not(:disabled) {
    background: #f3f3f3;
    border-color: #d0d0d0;
}

.ask-option-btn.selected {
    background: #eef4ff;
    border-color: #4a7fdc;
}

.ask-option-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.ask-option-label {
    font-size: 13px;
    font-weight: 500;
}

.ask-option-desc {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.ask-other {
    margin-top: 8px;
}

.ask-other-input {
    width: 100%;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    outline: none;
}

.ask-other-input:focus {
    border-color: #4a7fdc;
}

.ask-submit-btn {
    margin-top: 8px;
    background: #4a7fdc;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.ask-submit-btn:disabled {
    background: #b8c8e8;
    cursor: default;
}


/* ===== Agent entry mic (bottom bar) ===== */
.agent-mic-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}

.agent-mic-btn:active {
    border-color: #999;
    color: #666;
}

.agent-mic-btn.disabled {
    opacity: 0.5;
}

