* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f0f2f5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: #333;
}

.chat-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #4a76a8 0%, #3a5a78 100%);
    color: white;
    padding: 18px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 10;
}

.chat-header h1 {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.header-icon {
    height: 36px;
    width: auto;
    margin-right: 12px;
    vertical-align: middle;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.header-icon:hover {
    transform: scale(1.05);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 0;
    background-color: #f9fafc;
    background-image: 
        radial-gradient(circle at 25px 25px, rgba(74, 118, 168, 0.03) 2px, transparent 0),
        radial-gradient(circle at 75px 75px, rgba(74, 118, 168, 0.03) 2px, transparent 0);
    background-size: 100px 100px;
}

.quick-select-container {
    padding: 15px 20px;
    background-color: #f9fafc;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

.quick-select-section {
    margin-bottom: 16px;
    position: relative;
}

.quick-select-section:last-child {
    margin-bottom: 0;
}

.quick-select-section h3 {
    font-size: 0.9rem;
    color: #4a76a8;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    position: relative;
    display: inline-block;
}

.quick-select-section h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #4a76a8, transparent);
    border-radius: 2px;
}

.quick-select-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-select-btn {
    background-color: #f0f5fa;
    border: 1px solid #d8e2f0;
    border-radius: 18px;
    padding: 7px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #4a5568;
}

.quick-select-btn:hover {
    background-color: #e1ebf7;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.quick-select-btn.selected {
    background: linear-gradient(135deg, #4a76a8 0%, #3a5a78 100%);
    color: white;
    border-color: #3a5a78;
    box-shadow: 0 2px 5px rgba(74, 118, 168, 0.3);
}

.stickers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.sticker {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.sticker:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(74, 118, 168, 0.5);
}

.sticker:active {
    transform: scale(0.95);
}

.sticker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.sticker:hover img {
    filter: brightness(1.05);
}

.message {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 8px;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

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

.user-message {
    align-self: flex-end;
    background: linear-gradient(120deg, #dcf8c6 0%, #c6f8dc 100%);
    border-bottom-right-radius: 5px;
    color: #2c5d2d;
}

.api-message {
    align-self: flex-start;
    background: linear-gradient(120deg, #e5e5ea 0%, #f0f0f5 100%);
    border-bottom-left-radius: 5px;
    color: #3a3a3c;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 5px;
    text-align: right;
    font-weight: 500;
}

.chat-input-container {
    display: flex;
    padding: 18px 20px;
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 5;
}

#message-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e0e5ec;
    border-radius: 25px;
    outline: none;
    font-size: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#message-input:focus {
    border-color: #4a76a8;
    box-shadow: 0 1px 5px rgba(74, 118, 168, 0.2);
}

#voice-input-button {
    background-color: #f0f5fa;
    border: 1px solid #e0e5ec;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    margin-left: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#voice-input-button:hover {
    background-color: #e1ebf7;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

#voice-input-button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#voice-input-button.listening {
    background: linear-gradient(135deg, #ff5252 0%, #ff1a1a 100%);
    border-color: #ff1a1a;
    box-shadow: 0 2px 8px rgba(255, 82, 82, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.mic-icon {
    display: inline-block;
    width: 18px;
    height: 24px;
    background-color: #4a76a8;
    position: relative;
    border-radius: 3px 3px 8px 8px;
}

.mic-icon::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #4a76a8;
    border-radius: 50%;
    top: -4px;
    left: 5px;
    box-shadow: 0 4px 0 #f0f5fa;
}

.mic-icon::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 4px;
    background-color: #4a76a8;
    border-radius: 0 0 10px 10px;
    bottom: -2px;
    left: 4px;
}

#voice-input-button.listening .mic-icon,
#voice-input-button.listening .mic-icon::before,
#voice-input-button.listening .mic-icon::after {
    background-color: white;
}

#send-button {
    background: linear-gradient(135deg, #4a76a8 0%, #3a5a78 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0 25px;
    margin-left: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(74, 118, 168, 0.3);
    letter-spacing: 0.3px;
}

#send-button:hover {
    background: linear-gradient(135deg, #3a5a78 0%, #2a4a68 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 118, 168, 0.4);
}

#send-button:active {
    transform: scale(0.98);
    box-shadow: 0 1px 3px rgba(74, 118, 168, 0.3);
}

.voice-feedback {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    color: #333;
    max-width: 80%;
    text-align: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border: 1px solid rgba(74, 118, 168, 0.2);
}

.voice-feedback.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 語音輸入按鈕動畫 */
@keyframes mic-pulse {
    0% { transform: scale(1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
    50% { transform: scale(1.05); box-shadow: 0 3px 8px rgba(255, 82, 82, 0.4); }
    100% { transform: scale(1); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); }
}

#voice-input-button.listening {
    background: linear-gradient(135deg, #ff5252 0%, #ff1a1a 100%);
    border-color: #ff1a1a;
    animation: mic-pulse 1.5s infinite;
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-indicator.visible {
    opacity: 1;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(74, 118, 168, 0.1);
    border-top: 4px solid #4a76a8;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 600px) {
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .header-icon {
        height: 28px;
        margin-right: 8px;
    }
    
    .message {
        max-width: 85%;
    }
}
