/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
    background: #f0f4f9;
    overflow: hidden;
}

/* ===== 主容器 - 全屏布局 ===== */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: rgba(255, 255, 255, 0.70);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: none;
    border-radius: 0;
    overflow: hidden;
}

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 280px;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    padding: 20px 16px 16px 16px;
    flex-shrink: 0;
    overflow-y: auto;
    height: 100%;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: #1a2632;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Logo 样式 */
.logo-small {
    height: 28px;
    width: auto;
    border-radius: 6px;
    margin-right: 4px;
}

.logo-medium {
    height: 32px;
    width: auto;
    border-radius: 8px;
}

.btn-new {
    background: #1e2b3c;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 450;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: 0.15s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.btn-new:hover {
    background: #2a3b4f;
    transform: scale(0.97);
}

.btn-new:active {
    background: #141f2b;
    transform: scale(0.94);
}

/* ===== 会话列表 ===== */
.session-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    overflow-y: auto;
    padding-right: 4px;
}

.session-list::-webkit-scrollbar {
    width: 3px;
}

.session-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 20px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    border: 1px solid transparent;
    transition: 0.12s;
    cursor: pointer;
    font-size: 14px;
    color: #1e2b3c;
    gap: 8px;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.4);
}

.session-item.active {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(30, 43, 60, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.session-item .title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 430;
}

.session-item .actions {
    display: flex;
    gap: 6px;
    opacity: 0.4;
    transition: 0.1s;
}

.session-item:hover .actions {
    opacity: 0.8;
}

.session-item .actions button {
    background: transparent;
    border: none;
    color: #3a4e62;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 20px;
    transition: 0.1s;
}

.session-item .actions button:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1a2632;
}

.session-item .actions button.delete:hover {
    color: #c0392b;
}

.empty-sessions {
    text-align: center;
    color: #6d8396;
    font-size: 13px;
    padding: 40px 0;
    opacity: 0.6;
}

/* ===== 右侧聊天面板 ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(255, 255, 255, 0.15);
    height: 100%;
}

/* ===== 聊天头部 ===== */
.chat-panel-header {
    padding: 18px 28px 12px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.title-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.title-area h3 {
    font-size: 18px;
    font-weight: 480;
    color: #1a2632;
    letter-spacing: -0.2px;
}

.archive-btn {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 18px;
    border-radius: 40px;
    font-size: 13px;
    color: #2d4055;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.1s;
    backdrop-filter: blur(4px);
}

.archive-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

/* ===== 消息区域 ===== */
.messages-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 8px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    min-height: 0;
}

.messages-wrapper::-webkit-scrollbar {
    width: 4px;
}

.messages-wrapper::-webkit-scrollbar-thumb {
    background: #d0d9e3;
    border-radius: 20px;
}

/* ===== 消息气泡 ===== */
.message {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    max-width: 86%;
    animation: fadeSlide 0.2s ease;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 38px;
    height: 38px;
    border-radius: 40px;
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #1f2a36;
    font-size: 16px;
    backdrop-filter: blur(2px);
}

.message.user .avatar {
    background: #1e2b3c;
    color: white;
    border: none;
}

.message .bubble {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    padding: 14px 22px;
    border-radius: 26px;
    border-top-left-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 15px;
    line-height: 1.6;
    color: #1e2b3c;
    word-break: break-word;
}

.message.user .bubble {
    background: #1e2b3c;
    color: #f0f5fa;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-right-radius: 8px;
    border-top-left-radius: 26px;
}

.message .bubble p {
    margin: 0;
}

/* ===== 输入动画 ===== */
.bubble .typing-dots {
    display: flex;
    gap: 6px;
    padding: 4px 0;
}

.bubble .typing-dots span {
    width: 8px;
    height: 8px;
    background: #8a9eb0;
    border-radius: 20px;
    display: inline-block;
    animation: dotBounce 1.4s infinite;
}

.bubble .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.bubble .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%,
    60%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@keyframes fadeSlide {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.bubble.error {
    background: rgba(255, 235, 235, 0.7) !important;
    border-color: rgba(200, 80, 80, 0.2) !important;
    color: #a04545 !important;
}

/* ===== 底部输入区 ===== */
.input-area {
    padding: 14px 24px 22px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    border-radius: 60px;
    padding: 4px 4px 4px 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: 0.2s;
}

.input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(30, 43, 60, 0.15);
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 0;
    font-size: 15px;
    outline: none;
    color: #1a2632;
    min-width: 0;
}

.input-wrapper input::placeholder {
    color: #8a9eb0;
    font-weight: 350;
}

.input-wrapper button {
    background: #1e2b3c;
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 40px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.04);
}

.input-wrapper button:hover {
    background: #2a3b4f;
    transform: scale(0.96);
}

.input-wrapper button:active {
    background: #141f2b;
    transform: scale(0.92);
}

.input-wrapper button:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.footer-hint {
    text-align: center;
    font-size: 11px;
    margin-top: 8px;
    color: #6d8396;
    opacity: 0.6;
    letter-spacing: 0.2px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 760px) {
    .app-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: unset;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
        flex-shrink: 0;
        padding: 12px 14px 10px 14px;
    }
    
    .sidebar-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .chat-panel {
        height: 100%;
    }
    
    .message {
        max-width: 94%;
    }
    
    .message .bubble {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .input-wrapper {
        padding: 3px 3px 3px 18px;
    }
    
    .input-wrapper input {
        padding: 12px 0;
        font-size: 14px;
    }
    
    .input-wrapper button {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .chat-panel-header {
        padding: 12px 16px 8px 16px;
    }
    
    .title-area h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar-header h2 {
        font-size: 15px;
    }
    
    .btn-new {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .session-item {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .logo-small {
        height: 22px;
    }
    
    .logo-medium {
        height: 26px;
    }
}