/**
 * 皮皮虾 - 全局样式
 *
 * 简洁、现代、易用
 */

/* ============ CSS 变量 ============ */
:root {
    --primary-color: #ff6b35;
    --primary-hover: #ff8555;
    --secondary-color: #4ecdc4;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ============ 基础重置 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============ 布局容器 ============ */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}

.container-fluid {
    max-width: 100%;
    padding: 20px;
}

/* ============ 卡片样式 ============ */
.card {
    background: var(--card-background);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.card-header {
    text-align: center;
    margin-bottom: 24px;
}

.card-header .logo {
    font-size: 48px;
    margin-bottom: 12px;
}

.card-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ 表单样式 ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-control {
    flex: 1;
}

/* ============ 按钮样式 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background-color: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e8e8e8;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ 验证码按钮 ============ */
.btn-code {
    flex-shrink: 0;
    min-width: 120px;
}

/* ============ 链接样式 ============ */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============ 消息提示 ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: #fde8e8;
    color: var(--error-color);
    border: 1px solid #f5c6c6;
}

.alert-success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

/* ============ 聊天界面样式 ============ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--background-color);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chat-header .title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .title h2 {
    font-size: 18px;
    font-weight: 600;
}

.chat-header .actions {
    display: flex;
    gap: 8px;
}

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

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.ai .avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.message.user .avatar {
    background: var(--primary-color);
    color: white;
}

.message .content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 15px;
    line-height: 1.5;
}

.message.ai .content {
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.message.user .content {
    background: var(--primary-color);
    color: white;
}

.message .content pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

.message.user .content pre {
    background: rgba(255, 255, 255, 0.2);
}

.message .content code {
    font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

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

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============ 输入区域 ============ */
.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: var(--card-background);
    border-top: 1px solid var(--border-color);
}

.chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input textarea:focus {
    border-color: var(--primary-color);
}

.chat-input .send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    font-size: 20px;
}

/* ============ 欢迎消息 ============ */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.welcome-message .emoji {
    font-size: 48px;
    margin-bottom: 16px;
}

.welcome-message h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ============ 响应式适配 ============ */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .card {
        padding: 20px;
    }

    .chat-header h2 {
        font-size: 16px;
    }
}
