:root {
    --transition-speed: 0.3s;
    --gradient-primary: linear-gradient(135deg, #2b6cb0 0%, #1a365d 100%);
    --gradient-hover: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    --gradient-user: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    --bg-dark: rgba(26, 32, 44, 0.95);
    --bg-darker: rgba(17, 22, 31, 0.98);
    --border-color: rgba(66, 153, 225, 0.3);
    --text-color: rgba(255, 255, 255, 0.95);
    --shadow-color: rgba(49, 130, 206, 0.3);
}

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

body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #1a1e2c 0%, #2d3748 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

.chat-container {
    width: 100%;
    height: 100vh;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: containerAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-header {
    padding: 12px 20px;
    background: var(--gradient-primary);
    display: grid;
    grid-template-columns: 200px auto 200px;
    align-items: center;
    gap: 20px;
    height: 60px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right {
    justify-self: end;
    display: flex;
    align-items: center;
}

.chat-header h1 {
    font-size: 1.2rem;
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 16px;
    border-radius: 8px;
    justify-self: center;
}

.ai-selector {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
    transition: all var(--transition-speed) ease;
}

.ai-selector:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px var(--shadow-color);
    transform: translateY(-1px);
}

.clear-button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    height: 36px;
}

.clear-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

.message {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 15px;
    position: relative;
    line-height: 1.5;
    font-size: 16px;
    color: var(--text-color);
    max-width: min(85%, 800px);
    min-width: 60px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    clear: both;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-content {
    word-break: break-word;
}

.message-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    position: absolute;
    bottom: -20px;
}

.user-message {
    background: var(--gradient-user);
    align-self: flex-end;
    border-radius: 15px 15px 0 15px;
    animation: userMessageSlide 0.3s ease-out;
}

.user-message .message-time {
    right: 0;
}

.ai-message {
    background: rgba(45, 55, 72, 0.98);
    align-self: flex-start;
    border-radius: 15px 15px 15px 0;
    animation: aiMessageSlide 0.3s ease-out;
}

.ai-message .message-time {
    left: 0;
}

.chat-input {
    padding: 15px 20px;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
    min-height: 80px;
    display: flex;
    align-items: flex-end;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: rgba(17, 22, 31, 1);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 6px 10px;
    position: relative;
}

textarea {
    flex: 1;
    min-height: 36px;
    max-height: 150px;
    padding: 8px 12px;
    margin-right: 83px;
    background: transparent;
    border: none;
    resize: none;
    font-size: 16px;
    line-height: 20px;
    color: var(--text-color);
    width: calc(100% - 80px);
    overflow-y: auto;
    position: relative;
    bottom: 0;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

textarea:focus {
    outline: none;
}

#sendButton {
    position: absolute;
    right: 6px;
    bottom: 50%;
    transform: translateY(50%);
    height: 38px;
    min-width: 60px;
    padding: 0 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(17, 22, 31, 1);
}

#sendButton:hover {
    background: var(--gradient-hover);
    box-shadow: 0 0 0 4px rgba(17, 22, 31, 1), 
                0 0 10px var(--shadow-color);
    filter: brightness(1.1);
    transform: translateY(50%) scale(1.02);
}

#sendButton:active {
    transform: translateY(50%) scale(0.98);
    filter: brightness(1);
    box-shadow: 0 0 0 4px rgba(17, 22, 31, 1);
}

@keyframes gradientBG {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes userMessageSlide {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes aiMessageSlide {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
    .chat-header {
        grid-template-columns: 120px auto 120px;
        padding: 10px 15px;
        height: 50px;
        gap: 10px;
    }

    .input-wrapper {
        height: 44px;
        padding: 0 6px;
    }
    
    textarea {
        font-size: 15px;
        padding: 6px 10px;
        height: 32px;
    }
    
    #sendButton {
        height: 34px;
        padding: 0 12px;
        font-size: 14px;
        right: 5px;
    }
} 