/* ChatGPT风格布局样式 */
.chatgpt-layout {
    height: calc(100vh - 65px);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

/* 主聊天区域 */
.chatgpt-main {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.io-grey-mode .chatgpt-main {
    background-color: #ffffff;
}

.io-black-mode .chatgpt-main {
    background-color: #2c2e2f;
}

.current-chat-title {
    margin-left: 15px;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
    text-align: center;
}

.io-grey-mode .current-chat-title {
    color: #202123;
}

.io-black-mode .current-chat-title {
    color: #ececf1;
}

/* 聊天消息区域优化 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    align-items: center;
    max-width: 100%;
    transition: all 0.3s ease;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 10px;
    width: 100%;
    scroll-behavior: smooth;
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.io-grey-mode .chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

.io-grey-mode .chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.io-grey-mode .chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.io-black-mode .chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.io-black-mode .chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.io-black-mode .chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.message-row {
    display: flex;
    margin-bottom: 0;
    justify-content: center;
    position: relative;
    transition: background-color 0.3s ease;
}

/* PC端消息居中显示 */
@media (min-width: 768px) {
    .message-row {
        padding-left: 0;
        padding-right: 0;
    }

    .message-content {
        max-width: 900px !important;
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    margin-right: 16px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    transition: transform 0.3s ease;
}

.message-avatar img:hover {
    transform: scale(1.05);
}

.message-content {
    flex: 1;
    max-width: calc(100% - 50px);
    position: relative;
}


.io-grey-mode .message-row.bot-message {
    background-color: #f7f7f8;
    padding: 15px 20px;
    margin: 0 -10px 0 -10px;
    border-radius: 0;
}

.io-grey-mode .message-row.user-message {
    background-color: #ffffff;
    padding: 15px 20px;
    margin: 0 -10px 0 -10px;
}

.io-black-mode .message-row.bot-message {
    background-color: #3e3f42;
    padding: 15px 20px;
    margin: 0 -10px 0 -10px;
}

.io-black-mode .message-row.user-message {
    padding: 15px 20px;
    margin: 0 -10px 0 -10px;
}

/* 消息加载动画 */
@keyframes thinking {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.3;
    }
}

.thinking-animation {
    animation: thinking 1.5s infinite ease-in-out;
    display: inline-block;
}

.message-actions {
    display: flex;
    gap: 15px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.message-content:hover .message-actions {
    opacity: 1;
}

.message-action {
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.io-grey-mode .message-action {
    color: #6b6c7b;
}

.io-black-mode .message-action {
    color: #8e8ea0;
}

.io-grey-mode .message-action:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #19c37d;
}

.io-black-mode .message-action:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #19c37d;
}

/* 移动设备抽屉 */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    z-index: 1050;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 18px;
    overflow-y: auto;
}

.io-grey-mode .mobile-drawer {
    background-color: #f7f7f8;
}

.io-black-mode .mobile-drawer {
    background-color: #202123;
}

.mobile-drawer.open {
    left: 0;
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 18px;
}

.io-grey-mode .drawer-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #2c2e2f;
}

.io-black-mode .drawer-header {
    border-bottom: 1px solid rgba(48, 55, 61, 0.8);
    color: #ececf1;
    background: #202123;
}

.close-drawer-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.io-grey-mode .close-drawer-btn {
    color: #202123;
}

.io-grey-mode .close-drawer-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.io-black-mode .close-drawer-btn {
    color: #ececf1;
}

.io-black-mode .close-drawer-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 移动端顶部栏 */
.mobile-header {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.io-grey-mode .mobile-header {
    background-color: rgba(255, 255, 255, 0.85);
}

.io-black-mode .mobile-header {
    background-color: rgba(52, 53, 65, 0.85);
    border-bottom-color: rgba(62, 63, 75, 0.5);
}

.drawer-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.drawer-toggle:active {
    transform: scale(0.95);
}

.io-grey-mode .drawer-toggle {
    color: #202123;
}

.io-grey-mode .drawer-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.io-black-mode .drawer-toggle {
    color: #ececf1;
}

.io-black-mode .drawer-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 响应式调整 */
@media (max-width: 767px) {
    .chatgpt-layout {
        height: calc(100vh);
    }

    .message-row {
        padding: 18px 12px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        margin-right: 12px;
    }

    .chat-input-container {
        padding: 2px 8px;
    }

    .chat-input-wrapper {
        padding: 10px 16px;
    }
}

/* 添加打字机效果动画 */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.typing::after {
    content: "|";
    animation: blink 1s infinite;
    font-weight: normal;
    display: inline-block;
    margin-left: 2px;
}

/* 添加淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-row {
    animation: fadeIn 0.3s ease-out forwards;
}

/* 思考动画 */
.thinking-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

.chat-header {
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: 0 4px 6px -6px rgba(0, 0, 0, 0.05);
}

.io-black-mode .chat-header {
    border-bottom-color: rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 6px -6px rgba(0, 0, 0, 0.2);
}

.chat-header-title {
    font-size: 1.2rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.3s ease;
    font-weight: 700;
}

.io-black-mode .chat-header-title {
    color: #e1e1e1;
}

.message-row.user-message {
    position: relative;
    font-weight: 600;
}

.message-row.bot-message {
    font-weight: 600;
}

.message-row.user-message:hover .user-message-actions {
    opacity: 1;
}


.current-model {
    background: linear-gradient(135deg, #007bff, #00c6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.current-model::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #007bff, #00c6ff);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.model-display:hover .current-model::after {
    transform: scaleX(1);
}

.model-dropdown {
    position: absolute;
    bottom: 100%;
    /* 修改为底部对齐，使下拉框向上展开 */
    left: 0;
    width: auto;
    min-width: 180px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    /* 修改阴影方向 */
    margin-bottom: 8px;
    /* 修改为底部外边距 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    /* 修改变换方向 */
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 1000;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 123, 255, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: bottom center;
    /* 设置变换原点 */
}

@keyframes slideUpIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    70% {
        opacity: 1;
        transform: translateY(-2px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 移动端样式 */
.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 警告消息样式 */
.warning-message {
    color: #faad14;
    font-style: italic;
    padding: 8px;
    background-color: rgba(250, 173, 20, 0.1);
    border-radius: 4px;
    margin: 5px 0;
}

/* 消息操作样式 */
.message-actions {
    display: flex;
    gap: 0px;
    margin-top: 5px;
    opacity: 1;
    /* 始终显示操作按钮 */
}

.message-action {
    cursor: pointer;
    color: #999;
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 3px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.message-action:hover {
    background-color: #f0f0f0;
    color: #333;
}

.delete-message:hover {
    color: #ff4d4f;
}

.delete-message i {
    font-size: 14px;
    margin-right: 2px;
}

/* 模型标签样式 */
.model-tag {
    background: linear-gradient(135deg, #007bff, #00c6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    margin-right: 10px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.model-tag::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #007bff, #00c6ff);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.model-tag:hover::after {
    transform: scaleX(1);
}

.io-black-mode .model-tag {
    background: linear-gradient(135deg, #007bff, #00c6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
