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

:root {
    --primary-color: #ff9aa2;
    --secondary-color: #ffb7b2;
    --accent-color: #ffdac1;
    --bg-color: #fff5f7;
    --text-color: #333;
    --light-text: #666;
    --border-color: #ffe0e5;
    --user-msg-bg: #ff9aa2;
    --ai-msg-bg: #ffffff;
    --shadow: 0 2px 10px rgba(255, 154, 162, 0.15);
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #fff5f7 0%, #ffe0e5 100%);
    color: var(--text-color);
    min-height: 100vh;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 154, 162, 0.3);
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
}

/* AI助手形象区域 */
.ai-avatar-section {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.ai-avatar {
    display: inline-block;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    box-shadow: 0 4px 15px rgba(255, 154, 162, 0.3);
}

.avatar-icon {
    width: 50px;
    height: 50px;
    color: white;
    fill: white;
}

.avatar-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* 语音可视化 */
.voice-visualizer {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 40px;
    margin-top: 1rem;
}

.voice-visualizer.active {
    display: flex;
}

.wave-bar {
    width: 4px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 30px; }
}

/* 消息区域 */
.messages-wrapper {
    flex: 1;
    overflow: hidden;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.messages-container {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.welcome-message {
    text-align: center;
    color: var(--light-text);
    padding: 2rem;
    line-height: 1.8;
}

/* 双人对话样式 */
.message {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    max-width: 70%;
    animation: fadeIn 0.3s ease-in;
}

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

/* 用户消息（右侧） */
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.user .message-content {
    background: var(--user-msg-bg);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

/* AI消息（左侧） */
.message.assistant {
    align-self: flex-start;
}

.message.assistant .message-content {
    background: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 18px 18px 18px 4px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
}

.message-content {
    padding: 0.8rem 1.2rem;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 语音消息样式 */
.voice-message {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 180px;
}

.voice-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.voice-play-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.voice-duration {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 输入区域 */
.input-area {
    padding: 1rem;
}

.input-container {
    background: white;
    border-radius: 25px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    box-shadow: var(--shadow);
}

.voice-btn, .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.voice-btn:hover, .send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 154, 162, 0.4);
}

.voice-btn.recording {
    background: #ff4757;
    animation: pulse 1.5s infinite;
}

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

.voice-btn svg, .send-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
}

.message-input::-webkit-scrollbar {
    width: 4px;
}

.message-input::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--light-text);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 2rem;
}

/* 表单 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 154, 162, 0.3);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--light-text);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* 会员套餐 */
.membership-status {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    text-align: center;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.plan-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.plan-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(255, 154, 162, 0.2);
}

.plan-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.plan-price {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.plan-price small {
    font-size: 1rem;
    color: var(--light-text);
}

.plan-description {
    color: var(--light-text);
    margin-bottom: 1rem;
}

.plan-buy-btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.plan-buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 154, 162, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        padding: 0;
    }
    
    .navbar {
        padding: 1rem;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .chat-container {
        padding: 0.5rem;
    }
    
    .message {
        max-width: 85%;
    }
    
    .ai-avatar-section {
        padding: 1rem;
    }
    
    .avatar-circle {
        width: 60px;
        height: 60px;
    }
    
    .avatar-icon {
        width: 35px;
        height: 35px;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
    }
}


/* 支付方式选择对话框 */
.payment-dialog {
    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;
}

.payment-dialog-content {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
}

.payment-dialog-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.payment-methods {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.payment-method-btn {
    padding: 1rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.payment-method-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
    transform: translateY(-2px);
}

.payment-dialog .cancel-btn {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.payment-dialog .cancel-btn:hover {
    background: var(--light);
}

/* 通知系统样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.5rem;
    z-index: 3000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
    border-left: 4px solid var(--primary-color);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-left-color: #4caf50;
    background: #f1f8e9;
}

.notification-warning {
    border-left-color: #ff9800;
    background: #fff3e0;
}

.notification-error {
    border-left-color: #f44336;
    background: #ffebee;
}

.notification-info {
    border-left-color: #2196f3;
    background: #e3f2fd;
}

.notification-message {
    flex: 1;
    margin-right: 0.5rem;
    color: var(--text-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: var(--text-color);
}

/* 字段验证样式 */
.field-validation {
    position: relative;
}

.field-error {
    color: #f44336;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
}

.is-valid {
    border-color: #4caf50 !important;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.is-invalid {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.1);
}

.char-count {
    font-size: 0.75rem;
    color: var(--light-text);
    text-align: right;
    margin-top: 0.25rem;
}

.char-count.warning {
    color: #ff9800;
}

/* 加载状态样式 */
.loading-message {
    opacity: 0.9;
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.typing-indicator {
    display: flex;
    gap: 3px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 0.9rem;
    color: var(--light-text);
}

.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* 错误消息样式 */
.error-message {
    animation: slideIn 0.3s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-icon {
    font-size: 1.1rem;
}

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

/* 支付对话框动画 */
.payment-dialog {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.payment-dialog.show {
    opacity: 1;
    transform: scale(1);
}

.payment-method-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.method-icon {
    font-size: 1.5rem;
}

/* 会员状态样式 */
.membership-benefits,
.upgrade-benefits {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.membership-benefits h4,
.upgrade-benefits h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.membership-benefits ul,
.upgrade-benefits ul {
    list-style: none;
    padding: 0;
}

.membership-benefits li,
.upgrade-benefits li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-color);
}

.upgrade-benefits li {
    color: var(--light-text);
}

/* 语音按钮状态 */
.voice-play-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.voice-play-btn:hover {
    background: var(--bg-color);
    transform: scale(1.1);
}

.voice-play-btn.loading {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-play-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

/* 输入框样式增强 */
.input-group {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 154, 162, 0.1);
}

.form-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .payment-dialog-content {
        margin: 1rem;
        padding: 1.5rem;
        width: calc(100% - 2rem);
    }
    
    .loading-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .char-count {
        text-align: left;
    }
}
