/* ========================================
   张老师教育咨询 - 样式系统
   风格：东北大哥 · 实用主义 · 接地气
   ======================================== */

:root {
    /* 主色调 - 深蓝稳重 */
    --primary: #1a365d;
    --primary-light: #2c5282;
    --primary-dark: #0f2847;
    
    /* 强调色 - 橙色活力 */
    --accent: #ed8936;
    --accent-light: #f6ad55;
    --accent-dark: #dd6b20;
    
    /* 中性色 */
    --bg-dark: #0d1b2a;
    --bg-card: #1b2838;
    --bg-input: #243447;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border: #2d4a6f;
    
    /* 成功/在线 */
    --success: #48bb78;
    
    /* 字体 */
    --font-display: 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', -apple-system, sans-serif;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(237, 137, 54, 0.3);
    
    /* 动画 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ========================================
   重置与基础
   ======================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

/* ========================================
   主布局
   ======================================== */

.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========================================
   侧边栏
   ======================================== */

.sidebar {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    overflow-y: auto;
}

/* 个人卡片 */
.profile-card {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: slideDown 0.5s ease-out;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow-glow);
    animation: pulse 2s infinite;
}

.status-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--success);
    border: 3px solid var(--bg-card);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.profile-name {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.profile-tagline {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-light);
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* 核心模型 */
.core-models {
    animation: slideUp 0.5s ease-out 0.1s both;
}

.section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.model-item:hover {
    background: var(--primary-light);
    transform: translateX(4px);
}

.model-icon {
    font-size: 18px;
}

.model-text {
    font-size: 14px;
    font-weight: 500;
}

/* 快捷问题 */
.quick-questions {
    animation: slideUp 0.5s ease-out 0.2s both;
}

.question-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.chip:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: scale(1.05);
}

/* 侧边栏底部 */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.copyright {
    margin-top: 4px;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ========================================
   主聊天区域
   ======================================== */

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
    background: var(--bg-dark);
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

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

.online-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 4px 10px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--success);
}

.online-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.clear-btn:hover {
    background: rgba(237, 137, 54, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* 消息区域 */
.chat-messages {
    flex: 1 1 auto;
    height: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageIn 0.3s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

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

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

.message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-text {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.7;
    overflow-y: auto;
    max-height: 400px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.assistant .message-text {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.message.user .message-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.message-text p {
    margin-bottom: 12px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    color: var(--accent-light);
    font-weight: 600;
}

/* 打字指示器 */
.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 1s infinite;
}

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

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

/* 输入区域 */
.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    transition: var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(237, 137, 54, 0.1);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 120px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.send-btn:not(:disabled):hover {
    background: var(--accent-dark);
    transform: scale(1.05);
}

.input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

/* ========================================
   加载覆盖层
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================================
   动画关键帧
   ======================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% {
        box-shadow: var(--shadow-glow);
    }
    50% {
        box-shadow: 0 0 30px rgba(237, 137, 54, 0.5);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .message {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-input-area {
        padding: 12px 16px;
    }
    
    .input-wrapper {
        padding: 8px 12px;
    }
}

/* ========================================
   滚动条样式
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
