﻿.ai-wrap {
    display: flex;
    gap: 16px;
    height: calc(84vh - 130px);
    min-height: 560px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow: hidden;
}

.ai-side {
    width: 240px;
    background: #f7faff;
    border-right: 1px solid #e3eaf3;
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
}

.ai-new-btn {
    background: linear-gradient(135deg,#2e86c1,#1a3c5e);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 0;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 12px;
}

    .ai-new-btn:hover {
        opacity: .9;
    }

.ai-side-title {
    font-size: 12px;
    color: #7f8c9b;
    margin: 8px 4px;
}

.ai-side-list {
    flex: 1;
    overflow-y: auto;
}

.ai-side-item {
    padding: 8px 10px;
    font-size: 13px;
    color: #34495e;
    border-radius: 6px;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #eaf0f7;
}

.ai-tip {
    font-size: 11px;
    color: #aab2bd;
    padding: 6px 4px;
}

.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.ai-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #fafcff;
}

.ai-welcome {
    text-align: center;
    padding: 60px 20px;
    color: #5d6d7e;
}

    .ai-welcome h2 {
        color: #1a3c5e;
        margin-bottom: 14px;
    }

.ai-welcome-tip {
    margin-top: 18px;
    color: #95a5a6;
    font-size: 13px;
}

.ai-msg {
    display: flex;
    margin-bottom: 14px;
}

.ai-msg-user {
    justify-content: flex-end;
}

.ai-msg-assistant {
    justify-content: flex-start;
}

.ai-bubble {
    max-width: 100%;
    padding: 11px 30px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    white-space: normal;
}

.ai-msg-user .ai-bubble {
    background: linear-gradient(135deg,#2e86c1,#3ea0d8);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.ai-msg-assistant .ai-bubble {
    background: #fff;
    color: #2c3e50;
    border: 1px solid #e3eaf3;
    border-bottom-left-radius: 2px;
}

    .ai-msg-assistant .ai-bubble p {
        margin: 2px 0;
    }

    .ai-msg-assistant .ai-bubble pre {
        background: #f4f6fa;
        padding: 10px;
        border-radius: 6px;
        overflow-x: auto;
        font-size: 12.5px;
    }

    .ai-msg-assistant .ai-bubble code {
        background: #f0f3f7;
        padding: 1px 5px;
        border-radius: 3px;
        font-size: 12.5px;
    }

    .ai-msg-assistant .ai-bubble table {
        border-collapse: collapse;
        margin: 8px 0;
    }

    .ai-msg-assistant .ai-bubble th, .ai-msg-assistant .ai-bubble td {
        border: 1px solid #d4dce6;
        padding: 5px 9px;
        font-size: 13px;
    }

    .ai-msg-assistant .ai-bubble th {
        background: #eef3f9;
    }

.ai-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e3eaf3;
}

    .ai-input-bar textarea {
        flex: 1;
        resize: none;
        border: 1px solid #d4dce6;
        border-radius: 6px;
        padding: 8px 10px;
        font-size: 14px;
        outline: none;
        font-family: inherit;
    }

        .ai-input-bar textarea:focus {
            border-color: #2e86c1;
        }

    .ai-input-bar button {
        padding: 0 22px;
        background: linear-gradient(135deg,#2e86c1,#1a3c5e);
        color: #fff;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
    }

        .ai-input-bar button:hover {
            opacity: .9;
        }

#aiStopBtn {
    background: #e67e22;
}

@media (max-width:768px) {
    .ai-wrap {
        flex-direction: column;
        height: auto;
    }

    .ai-side {
        width: 100%;
        max-height: 160px;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .ai-side-list {
        display: flex;
        overflow-x: auto;
        width: 100%;
    }

    .ai-side-item {
        flex: 0 0 auto;
        margin-right: 6px;
    }

    .ai-msgs {
        padding: 12px;
    }

    .ai-bubble {
        max-width: 90%;
    }
}
