/* 星伴·启明 - 苹果科技风格 */

:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --secondary: #00B4D8;
    --accent: #FF6B6B;
    --bg: #F8F9FA;
    --bg-dark: #1A1A2E;
    --card: rgba(255, 255, 255, 0.8);
    --card-dark: rgba(255, 255, 255, 0.1);
    --text: #2D3436;
    --text-light: #636E72;
    --text-white: #FFFFFF;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 玻璃效果 */
.glass {
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.navbar .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.navbar .logo-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.navbar .nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.navbar .nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar .nav-links a:hover {
    color: var(--primary);
}

.navbar .nav-links a.active {
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-light);
}

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

/* Hero区 */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 40px 80px;
    background: linear-gradient(135deg, #F8F9FA 0%, #E8E4F8 50%, #D4E8F0 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(0, 180, 216, 0.08) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2%, 2%); }
}

.hero-content {
    max-width: 800px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--card);
    border-radius: 100px;
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.hero h1 {
    font-size: 64px;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 20px;
    color: var(--text-light);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* 特性卡片区 */
.features {
    padding: 100px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.features-title {
    text-align: center;
    margin-bottom: 60px;
}

.features-title h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.features-title p {
    font-size: 18px;
    color: var(--text-light);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 32px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.feature-icon.purple { background: linear-gradient(135deg, #6C5CE7, #A29BFE); }
.feature-icon.blue { background: linear-gradient(135deg, #00B4D8, #48CAE4); }
.feature-icon.green { background: linear-gradient(135deg, #00B894, #55EFC4); }
.feature-icon.orange { background: linear-gradient(135deg, #FDCB6E, #F9A825); }
.feature-icon.pink { background: linear-gradient(135deg, #FF6B6B, #FF8E8E); }
.feature-icon.teal { background: linear-gradient(135deg, #00CEC9, #81ECEC); }

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
}

/* 算法展示区 */
.algorithm {
    padding: 100px 40px;
    background: var(--bg-dark);
    color: var(--text-white);
}

.algorithm-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.algorithm h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 24px;
}

.algorithm p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 32px;
}

.algorithm-layers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.layer-num {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.layer-text {
    flex: 1;
}

.layer-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.layer-text p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

/* CTA区 */
.cta {
    padding: 100px 40px;
    text-align: center;
}

.cta h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.cta p {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 40px;
}

/* 页脚 */
.footer {
    padding: 40px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 14px;
}

/* 登录页 */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F8F9FA 0%, #E8E4F8 100%);
    padding: 40px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 15px;
    transition: all 0.2s;
    background: var(--bg);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

.auth-card .switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-light);
}

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

/* 对话页 */
.chat-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.chat-header {
    padding: 16px 24px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-header .avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

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

.chat-header p {
    font-size: 13px;
    color: var(--text-light);
}

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

.message {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary);
    font-size: 13px;
    padding: 8px 16px;
}

.chat-input {
    padding: 16px 24px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 15px;
    background: var(--bg);
    transition: all 0.2s;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.input-wrapper button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-wrapper button:hover {
    transform: scale(1.05);
}

.input-wrapper button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载动画 */
.loading {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: bounce 1.4s ease-in-out infinite;
}

.loading span:nth-child(2) { animation-delay: 0.2s; }
.loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 诊断页 */
.diagnosis-page {
    min-height: 100vh;
    padding: 100px 40px 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.diagnosis-card {
    padding: 40px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.diagnosis-card h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.profile-item {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.profile-item label {
    font-size: 13px;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
}

.profile-item .bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.profile-item .bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
}

.profile-item .value {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
    text-align: right;
}

/* 响应式 */
@media (max-width: 768px) {
    .hero h1 { font-size: 36px; }
    .hero p { font-size: 16px; }
    .features-grid { grid-template-columns: 1fr; }
    .algorithm-content { grid-template-columns: 1fr; }
    .navbar { padding: 12px 16px; }
    .hero { padding: 80px 16px 40px; }
    .profile-grid { grid-template-columns: 1fr; }
    .features { padding: 60px 16px; }
    .algorithm { padding: 60px 16px; }
    .cta { padding: 60px 16px; }

    /* 对话页移动端 */
    .chat-header { padding: 12px 16px; }
    .chat-header .title { gap: 8px; }
    .chat-messages { padding: 16px; }
    .message { max-width: 85%; font-size: 14px; }
    .chat-input { padding: 12px 16px; }
    .input-wrapper input { padding: 12px 16px; font-size: 16px; }
    .input-wrapper button { width: 44px; height: 44px; }

    /* 登录页移动端 */
    .auth-page { padding: 20px; }
    .auth-card { padding: 32px 24px; }
    .auth-card h1 { font-size: 24px; }

    /* 诊断页移动端 */
    .diagnosis-page { padding: 80px 16px 20px; }
    .diagnosis-card { padding: 24px 16px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 28px; }
    .hero-buttons { flex-direction: column; gap: 12px; }
    .hero-buttons .btn { width: 100%; }
    .nav-links { gap: 8px; }
    .nav-links a { font-size: 13px; }
    .navbar .logo-text { font-size: 16px; }
}

/* 防止iOS输入框缩放 */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"] {
        font-size: 16px !important;
    }
}

/* 安全区域适配（刘海屏） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .chat-input {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    .footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
