* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #FFF5E6 0%, #FFE8D6 50%, #FFD4C4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* 可爱的背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 240, 230, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 230, 220, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 235, 225, 0.3) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    gap: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* 侧边栏样式 - 奶油色调 */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #FFF9F0 0%, #FFF5E8 100%);
    border-radius: 25px 0 0 25px;
    box-shadow: 0 8px 32px rgba(255, 200, 180, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 2px solid rgba(255, 220, 200, 0.5);
}

.sidebar-header {
    padding: 25px 20px;
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 100%);
    color: #5D4037;
    position: relative;
}

.sidebar-header::before {
    content: '🐰';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    opacity: 0.6;
}

.sidebar-header h2 {
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
    color: #5D4037;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    color: #8D6E63;
    border: 2px solid rgba(255, 200, 180, 0.5);
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 180, 150, 0.2);
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 180, 150, 0.3);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: rgba(255, 250, 245, 0.3);
}

.chat-item {
    padding: 14px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid rgba(255, 220, 200, 0.3);
    box-shadow: 0 2px 8px rgba(255, 200, 180, 0.15);
}

.chat-item:hover {
    background: rgba(255, 245, 235, 0.9);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(255, 200, 180, 0.25);
}

.chat-item.active {
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 100%);
    color: #5D4037;
    border-color: #FFB5A0;
    box-shadow: 0 4px 16px rgba(255, 181, 160, 0.4);
}

.chat-item-title {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6D4C41;
}

.chat-item.active .chat-item-title {
    color: #5D4037;
}

.chat-item-time {
    font-size: 0.75em;
    opacity: 0.7;
    color: #A1887F;
}

.chat-item.active .chat-item-time {
    opacity: 0.8;
    color: #8D6E63;
}

.chat-item-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #FF8A80 0%, #FF5252 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 1em;
    display: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 82, 82, 0.3);
}

.chat-item-delete:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.5);
}

.chat-item:hover .chat-item-delete {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 主区域样式 */
.main-area {
    flex: 1;
    display: flex;
}

.container {
    width: 100%;
    background: linear-gradient(180deg, #FFFAF5 0%, #FFF8F0 100%);
    border-radius: 0 25px 25px 0;
    box-shadow: 0 8px 32px rgba(255, 200, 180, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 50%, #FFD4C4 100%);
    color: #5D4037;
    padding: 25px 30px;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 181, 160, 0.2);
}

.header::before {
    content: '✨';
    position: absolute;
    top: 15px;
    left: 60px;
    font-size: 1.5em;
    animation: twinkle 2s infinite;
}

.header::after {
    content: '✨';
    position: absolute;
    top: 20px;
    right: 60px;
    font-size: 1.2em;
    animation: twinkle 2.5s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.toggle-sidebar-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.5);
    color: #8D6E63;
    border: 2px solid rgba(255, 200, 180, 0.5);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    font-size: 1.4em;
    transition: all 0.3s ease;
    display: none;
}

.toggle-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.header-content {
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    font-weight: 700;
    color: #5D4037;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.subtitle {
    font-size: 1em;
    opacity: 0.85;
    color: #6D4C41;
    font-weight: 500;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.5) 0%, rgba(255, 245, 235, 0.3) 100%);
}

.welcome-message {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 250, 245, 0.9) 100%);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(255, 200, 180, 0.2);
    margin-bottom: 20px;
    border: 2px solid rgba(255, 220, 200, 0.4);
    position: relative;
}

.welcome-message::before {
    content: '🌸';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    opacity: 0.3;
}

.welcome-message p {
    margin-bottom: 12px;
    line-height: 1.8;
    color: #6D4C41;
    font-size: 0.95em;
}

.welcome-message p:last-child {
    margin-bottom: 0;
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message.assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 15px;
    line-height: 1.8;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* 段落间距 */
.message-content br {
    display: block;
    margin: 10px 0;
    content: "";
}

.message.user .message-content {
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 100%);
    color: #5D4037;
    border-bottom-right-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 181, 160, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.message.assistant .message-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 250, 245, 0.95) 100%);
    color: #6D4C41;
    box-shadow: 0 4px 15px rgba(255, 200, 180, 0.2);
    border-bottom-left-radius: 8px;
    border: 2px solid rgba(255, 220, 200, 0.4);
}

.input-container {
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 250, 245, 0.95) 0%, rgba(255, 245, 240, 0.95) 100%);
    border-top: 2px solid rgba(255, 220, 200, 0.5);
    display: flex;
    gap: 12px;
}

#userInput {
    flex: 1;
    padding: 15px 18px;
    border: 2px solid rgba(255, 200, 180, 0.4);
    border-radius: 18px;
    font-size: 0.95em;
    font-family: inherit;
    resize: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    color: #6D4C41;
}

#userInput:focus {
    outline: none;
    border-color: #FFB5A0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(255, 181, 160, 0.2);
}

#userInput::placeholder {
    color: #BCAAA4;
}

#sendButton {
    padding: 15px 35px;
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 100%);
    color: #5D4037;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 181, 160, 0.3);
}

#sendButton:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 181, 160, 0.4);
    background: linear-gradient(135deg, #FFA890 0%, #FFB8A9 100%);
}

#sendButton:active {
    transform: translateY(-1px);
}

#sendButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 等待更多输入指示器 - 奶油兔风格 */
.waiting-indicator {
    padding: 14px 22px;
    background: linear-gradient(135deg, rgba(255, 250, 245, 0.95) 0%, rgba(255, 240, 235, 0.95) 100%);
    border-radius: 20px;
    border-bottom-left-radius: 8px;
    border: 2px dashed rgba(255, 181, 160, 0.6);
    width: fit-content;
    box-shadow: 0 4px 12px rgba(255, 200, 180, 0.2);
}

.waiting-text {
    color: #FFB5A0;
    font-size: 0.95em;
    font-style: italic;
    animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* 打字指示器 - 奶油兔风格 */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 250, 245, 0.95) 100%);
    border-radius: 20px;
    border-bottom-left-radius: 8px;
    box-shadow: 0 4px 15px rgba(255, 200, 180, 0.2);
    width: fit-content;
    border: 2px solid rgba(255, 220, 200, 0.4);
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #FFB5A0 0%, #FFC9B9 100%);
    border-radius: 50%;
    animation: typing 1.4s infinite;
    box-shadow: 0 2px 4px rgba(255, 181, 160, 0.3);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* 滚动条样式 - 奶油兔风格 */
.chat-container::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track,
.chat-list::-webkit-scrollbar-track {
    background: rgba(255, 250, 245, 0.5);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #FFB5A0 0%, #FFC9B9 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 250, 245, 0.5);
}

.chat-container::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #FFA890 0%, #FFB8A9 100%);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        max-width: 100%;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s;
        border-radius: 0;
    }

    .sidebar.show {
        left: 0;
    }

    .toggle-sidebar-btn {
        display: block;
    }

    .container {
        border-radius: 0;
    }

    .header h1 {
        font-size: 2em;
    }

    .message-content {
        max-width: 85%;
    }
}
