/* style.css — parent_companion */

        * { 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, #f8f5f0 0%, #e8e0d5 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .chat-container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.2);
            width: 100%;
            max-width: 480px;
            height: 80vh;
            max-height: 600px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
        }
        .chat-header {
            background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%);
            color: white;
            padding: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .chat-header h2 { font-size: 18px; font-weight: 600; }
        .chat-header .status { display: flex; align-items: center; gap: 8px; font-size: 14px; opacity: 0.9; }
        .call-btn, .settings-btn {
            background: none; border: none; color: white; font-size: 16px;
            cursor: pointer; padding: 8px; border-radius: 50%;
            transition: background 0.3s ease;
        }
        .call-btn:hover, .settings-btn:hover { background: rgba(255,255,255,0.2); }

        /* 通话界面 */
        .call-interface {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: linear-gradient(135deg, #f8f5f0 0%, #e8e0d5 100%);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        .call-content {
            text-align: center; padding: 40px; background: white;
            border-radius: 20px; box-shadow: 0 10px 30px rgba(139,90,43,0.2);
            max-width: 320px; width: 90%;
        }
        .call-avatar {
            width: 100px; height: 100px;
            background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%);
            color: white; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 36px; font-weight: bold; margin: 0 auto 20px;
        }
        .call-name { font-size: 20px; font-weight: 600; color: #5d4037; margin-bottom: 10px; }
        .call-status { font-size: 14px; color: #8d6e63; margin-bottom: 30px; min-height: 20px; }
        .call-timer { font-size: 32px; font-weight: 600; color: #5d4037; margin-bottom: 40px; }
        .call-buttons { display: flex; justify-content: center; gap: 20px; }
        .call-buttons .call-btn {
            width: 60px; height: 60px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 20px; border: none; cursor: pointer; transition: transform 0.3s ease;
        }
        .call-buttons .call-btn:hover { transform: scale(1.1); }
        .call-buttons .decline { background: #f44336; color: white; }
        .call-buttons .mute, .call-buttons .speaker { background: #e9ecef; color: #5d4037; }

        /* 声波动画 */
        .voice-wave {
            display: flex; align-items: center; justify-content: center;
            gap: 4px; margin: 30px 0; height: 60px;
        }
        .wave-bar {
            width: 6px;
            background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%);
            border-radius: 3px; transition: height 0.1s ease;
        }
        .wave-bar:nth-child(1) { height: 20px; }
        .wave-bar:nth-child(2) { height: 30px; }
        .wave-bar:nth-child(3) { height: 40px; }
        .wave-bar:nth-child(4) { height: 30px; }
        .wave-bar:nth-child(5) { height: 20px; }
        .voice-wave.animating .wave-bar { animation: wave 0.5s infinite ease-in-out; }
        .voice-wave.animating .wave-bar:nth-child(1) { animation-delay: 0s; }
        .voice-wave.animating .wave-bar:nth-child(2) { animation-delay: 0.1s; }
        .voice-wave.animating .wave-bar:nth-child(3) { animation-delay: 0.2s; }
        .voice-wave.animating .wave-bar:nth-child(4) { animation-delay: 0.3s; }
        .voice-wave.animating .wave-bar:nth-child(5) { animation-delay: 0.4s; }
        @keyframes wave { 0%, 100% { height: 20px; } 50% { height: 40px; } }

        .status-indicator { width: 8px; height: 8px; background: #4caf50; border-radius: 50%; animation: pulse 2s infinite; }
        @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

        .chat-messages { flex: 1; padding: 20px; overflow-y: auto; background: #f8f5f0; }
        .message { margin-bottom: 20px; display: flex; align-items: flex-start; gap: 10px; animation: msgFadeIn 0.3s ease; }
        @keyframes msgFadeIn {
            from { opacity: 0; transform: translateY(6px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .message.ai { flex-direction: row; }
        .message.user { flex-direction: row-reverse; }
        .message-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; flex-shrink: 0; }
        .message.ai .message-avatar { background: var(--role-avatar-bg, linear-gradient(135deg, #d4a76a 0%, #b8860b 100%)); color: white; }
        .message.user .message-avatar { background: #e9ecef; color: #666; }
        .message-content { max-width: 70%; }
        .message.ai .message-content { background: white; border-radius: 18px 18px 18px 4px; padding: 12px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
        .message.user .message-content { background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%); color: white; border-radius: 18px 18px 4px 18px; padding: 12px 16px; }
        .message-text { line-height: 1.6; font-size: 15px; }
        .message-text p { margin: 0 0 10px 0; }
        .message-text p:last-child { margin-bottom: 0; }
        .message-text strong { font-weight: 700; }
        .message-time { font-size: 12px; color: #999; margin-top: 4px; }
        .message.ai .message-time { text-align: left; }
        .message.user .message-time { text-align: right; color: rgba(255,255,255,0.7); }

        .api-config {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.5); display: flex; align-items: center;
            justify-content: center; z-index: 2000;
        }
        .api-config-panel { background: white; border-radius: 20px; padding: 30px; width: 90%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
        .api-config h3 { color: #d4a76a; margin-bottom: 20px; text-align: center; }
        .api-config input { width: 100%; padding: 12px 16px; border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 15px; font-size: 14px; }
        .api-config-buttons { display: flex; gap: 10px; margin-top: 20px; }
        .api-config-buttons button { flex: 1; padding: 10px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
        .api-config-buttons .save { background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%); color: white; }
        .api-config-buttons .cancel { background: #e9ecef; color: #666; }

        .chat-input { padding: 16px 20px; background: white; border-top: 1px solid #e9ecef; display: flex; align-items: flex-end; gap: 8px; }
        .input-wrap { flex: 1; display: flex; flex-direction: column; }
        .input-wrap input { border: 1px solid #e9ecef; border-radius: 24px; padding: 12px 16px; font-size: 15px; outline: none; transition: border-color 0.3s; }
        .input-wrap input:focus { border-color: #d4a76a; }
        #imagePreview { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; background: #f8f5f0; border-radius: 10px; margin-bottom: 6px; width: fit-content; }
        .remove-img { cursor: pointer; color: #999; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 50%; background: #e9ecef; }
        .remove-img:hover { background: #ddd; color: #666; }
        .img-btn { background: none; border: none; font-size: 26px; font-weight: 300; color: #b0a090; cursor: pointer; padding: 4px 8px; border-radius: 50%; transition: background 0.2s, color 0.2s; flex-shrink: 0; line-height: 1; }
        .img-btn:hover { background: #f0e8de; color: #d4a76a; }
        .chat-input button#sendButton { background: linear-gradient(135deg, #d4a76a 0%, #b8860b 100%); color: white; border: none; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: transform 0.3s, box-shadow 0.3s; flex-shrink: 0; }
        .chat-input button#sendButton:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(212,167,106,0.4); }
        .chat-input button#sendButton:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        .msg-image { max-width: 200px; max-height: 200px; border-radius: 12px; margin-top: 6px; display: block; cursor: pointer; }
        .msg-image:hover { opacity: 0.9; }

        .suggestions { padding: 10px 20px; background: #f8f9fa; border-top: 1px solid #e9ecef; display: flex; gap: 10px; overflow-x: auto; }
        .suggestion { background: white; border: 1px solid #e9ecef; border-radius: 16px; padding: 8px 12px; font-size: 13px; color: #666; cursor: pointer; white-space: nowrap; transition: all 0.3s; }
        .suggestion:hover { background: #d4a76a; color: white; border-color: #d4a76a; }

        .loading { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: white; border-radius: 18px 18px 18px 4px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
        .loading-dots { display: flex; gap: 4px; }
        .loading-dot { width: 6px; height: 6px; background: #d4a76a; border-radius: 50%; animation: loading 1.4s infinite ease-in-out both; }
        .loading-dot:nth-child(1) { animation-delay: -0.32s; }
        .loading-dot:nth-child(2) { animation-delay: -0.16s; }
        @keyframes loading { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

        .chat-messages::-webkit-scrollbar { width: 6px; }
        .chat-messages::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
        .chat-messages::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }

        @media (max-width: 768px) {
            body { padding: 0; }
            .chat-container { border-radius: 0; width: 100%; height: 100vh; max-height: none; }
        }
