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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    animation: backgroundShift 15s ease infinite;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    animation: backgroundGlow 8s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 100px, rgba(255, 255, 255, 0.02) 100px, rgba(255, 255, 255, 0.02) 200px),
        repeating-linear-gradient(135deg, transparent, transparent 100px, rgba(255, 255, 255, 0.01) 100px, rgba(255, 255, 255, 0.01) 200px);
    pointer-events: none;
    z-index: -1;
}

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

@keyframes backgroundGlow {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.chat-container {
    max-width: 800px;
    height: 100vh;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 0;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    border-radius: 50%;
}



.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
    text-decoration: none;
    font-weight: 500;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.show-config-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.show-config-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.show-config-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.api-config {
    background-color: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.api-config-content {
    max-width: 500px;
    margin: 0 auto;
}

.api-config h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.api-config p {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.service-selector {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-selector label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

#aiServiceSelect {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

#aiServiceSelect:focus {
    border-color: #4a90e2;
}

.api-key-input-group {
    margin-bottom: 15px;
}

#apiKeyInput, #azureEndpoint, #azureDeployment {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.3s;
}

#azureEndpoint, #azureDeployment {
    margin-bottom: 15px;
}

#apiKeyInput:focus, #azureEndpoint:focus, #azureDeployment:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

#apiKeyInput:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

#saveApiKeyBtn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

#saveApiKeyBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#saveApiKeyBtn:active {
    transform: translateY(0);
}

#saveApiKeyBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#saveApiKeyBtn:hover::before {
    left: 100%;
}

.developer-settings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}

.developer-settings h4 {
    font-size: 16px;
    color: #555;
    margin-bottom: 10px;
}

.clear-api-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
    margin-bottom: 8px;
}

.clear-api-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.clear-api-btn:active {
    transform: translateY(0);
}

.developer-note {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

.api-config.hidden {
    display: none;
}

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

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #a8a8a8;
}

.message {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.6;
    animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    transform: translateY(0);
}

.user-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ai-message {
    align-self: flex-start;
    background-color: rgba(241, 241, 241, 0.95);
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    transform: translateY(0);
}

.ai-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 加载动画样式 */
.loading-message {
    display: flex;
    align-items: center;
}

.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background-color: #4a90e2;
    border-radius: 50%;
    animation: loading-pulse 1.4s infinite ease-in-out both;
}

@keyframes loading-pulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.message-content {
    font-size: 15px;
}

.chat-input-area {
    display: flex;
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

#userInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid rgba(102, 126, 234, 0.1);
    border-radius: 30px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#userInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 15px rgba(102, 126, 234, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

#sendBtn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    outline: none;
    min-width: 80px;
}

#sendBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#sendBtn:active:not(:disabled) {
    transform: translateY(0);
}

#sendBtn:disabled {
    background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

@media (max-width: 600px) {
    .chat-container {
        height: 100vh;
        max-width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input-area {
        padding: 15px;
    }
    
    #userInput {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    #sendBtn {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 25px;
    }
}