/* ===== 全局重置 & 变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --nav-bg: #1E3A5F;
    --primary-blue: #4A90E2;
    --accent-orange: #FF6B35;
    --bg-white: #FFFFFF;
    --text-dark: #333333;
    --text-muted: #666666;
    --light-gray: #F5F7FA;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
    --radius-card: 12px;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --nav-width: 280px;
}

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    background: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ===== 左侧导航 ===== */
.sidebar {
    width: var(--nav-width);
    background-color: var(--nav-bg);
    color: #fff;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 28px 20px 24px;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s var(--transition-smooth);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    cursor: pointer;
    background: var(--nav-bg);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.profile {
    text-align: center;
    margin-bottom: 24px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.15);
    background: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 36px;
    font-weight: 600;
    color: #fff;
}

.profile h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.profile .title-tag {
    font-size: 13px;
    opacity: 0.85;
    background: rgba(255,255,255,0.08);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 4px;
}

/* 导航分组 */
.nav-section {
    flex: 1;
    margin: 8px 0 16px;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    transition: background 0.2s;
}

.nav-header:hover {
    background: rgba(255,255,255,0.06);
}

.nav-header .arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 14px;
}

.nav-header .arrow.collapsed {
    transform: rotate(-90deg);
}

.nav-list {
    list-style: none;
    margin: 4px 0 0 8px;
    overflow: hidden;
    max-height: 300px;
    transition: max-height 0.4s var(--transition-smooth);
}

.nav-list.collapsed {
    max-height: 0;
}

.nav-list li {
    padding: 10px 16px 10px 36px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    color: rgba(255,255,255,0.65);
}

.nav-list li i {
    width: 20px;
    margin-right: 8px;
    text-align: center;
    font-size: 15px;
}

.nav-list li:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-list li.active {
    background: var(--primary-blue);
    color: #fff;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.nav-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 16px;
}

.contact-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-orange);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.contact-btn:hover {
    background: #e55a2b;
    transform: scale(0.98);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
}

.contact-btn:active {
    transform: scale(0.95);
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 90;
    backdrop-filter: blur(2px);
}

/* ===== 右侧内容区 ===== */
.main-content {
    flex: 1;
    padding: 32px 40px 60px;
    max-width: calc(100% - var(--nav-width));
    background: var(--bg-white);
    min-height: 100vh;
}

.content-inner {
    max-width: 820px;
    margin: 0 auto;
}

/* ===== 全部项目视图 ===== */
.hero-section {
    margin-bottom: 32px;
}

.hero-section h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.hero-section .subhead {
    font-size: 16px;
    color: var(--text-muted);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 28px 0 16px;
    color: var(--text-dark);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.project-card {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.25s var(--transition-smooth), box-shadow 0.3s;
    border: 1px solid #f0f2f6;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-thumb {
    height: 140px;
    background: linear-gradient(145deg, #eef2f7, #d9e0eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: var(--primary-blue);
}

.card-body {
    padding: 18px 20px 22px;
}

.card-body h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
}

.card-body .tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 10px;
}

.card-body .tech-tags span {
    background: var(--light-gray);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.card-body p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== 项目详情视图 ===== */
.detail-view .back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary-blue);
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    background: none;
    border: none;
}

.detail-view .back-link i { margin-right: 6px; }
.detail-view .back-link:hover { color: var(--accent-orange); }

.detail-header {
    margin-bottom: 20px;
}

.detail-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.detail-header .role-badge {
    background: var(--primary-blue);
    color: #fff;
    padding: 2px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
}

.detail-header .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 14px;
}

/* 概览卡片 */
.overview-card {
    background: var(--light-gray);
    padding: 20px 24px;
    border-radius: var(--radius-card);
    margin: 16px 0 24px;
    font-size: 15px;
    line-height: 1.7;
    border-left: 4px solid var(--primary-blue);
}

.detail-section {
    margin: 28px 0;
}

.detail-section h2 {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

/* 技术栈标签 */
.tech-stack-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0 4px;
}

.tech-stack-display span {
    background: var(--primary-blue);
    color: #fff;
    padding: 4px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
}

/* 列表样式 */
.detail-list {
    list-style: none;
    padding-left: 4px;
}

.detail-list li {
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
}

.detail-list.orange li::before {
    content: "●";
    color: var(--accent-orange);
    position: absolute;
    left: 0;
    font-weight: 700;
    font-size: 14px;
}

.detail-list.blue li::before {
    content: "●";
    color: var(--primary-blue);
    position: absolute;
    left: 0;
    font-weight: 700;
    font-size: 14px;
}

/* 项目截图 */
.project-screenshot {
    margin: 20px 0 8px;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--light-gray);
    border: 1px solid #eaeef5;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.project-screenshot img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== 联系方式弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 400;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 36px 40px 32px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
    position: relative;
    animation: modalIn 0.3s var(--transition-smooth);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content h3 i {
    color: var(--primary-blue);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f6;
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-label {
    width: 50px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 14px;
}

.contact-value {
    flex: 1;
    font-size: 15px;
    color: var(--text-dark);
    word-break: break-all;
}

.copy-btn {
    background: var(--light-gray);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
    font-size: 14px;
}

.copy-btn:hover {
    background: var(--primary-blue);
    color: #fff;
}

.copy-tip {
    text-align: center;
    color: #22a65e;
    font-size: 14px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-tip.show {
    opacity: 1;
}

/* ===== Dify 组件 ===== */
.dify-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--accent-orange);
    color: #fff;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.4);
    border: none;
    cursor: pointer;
    z-index: 300;
    transition: transform 0.2s, background 0.2s;
}

.dify-fab:hover { transform: scale(1.04); background: #e55a2b; }

.dify-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 360px;
    height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
    display: none;
    flex-direction: column;
    z-index: 350;
    overflow: hidden;
    border: 1px solid #eef2f8;
}

.dify-window.open { display: flex; }

.dify-header {
    background: var(--nav-bg);
    color: #fff;
    padding: 14px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.dify-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.dify-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f9fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    align-self: flex-start;
    border: 1px solid #eaeef5;
}

.msg.user {
    align-self: flex-end;
    background: var(--primary-blue);
    color: #fff;
    border: none;
}

.dify-input-area {
    display: flex;
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px;
    background: #fff;
    gap: 8px;
    flex-shrink: 0;
}

.dify-input-area input {
    flex: 1;
    border: 1px solid #d0d8e5;
    border-radius: 30px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: 0.2s;
}

.dify-input-area input:focus { border-color: var(--primary-blue); }

.dify-input-area button {
    background: var(--primary-blue);
    color: #fff;
    border: none;
    padding: 0 16px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.dify-input-area button:hover { background: #3a7bc8; }

.quick-reply {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 6px;
}

.quick-reply button {
    background: #eef2f7;
    border: none;
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 12px;
    color: var(--nav-bg);
    cursor: pointer;
    transition: 0.2s;
}

.quick-reply button:hover { background: var(--primary-blue); color: #fff; }

/* ===== 响应式 ===== */
@media screen and (max-width: 1023px) {
    .project-grid { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 28px 24px 50px; }
}

@media screen and (max-width: 767px) {
    .menu-toggle { display: block; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
        height: 100vh;
        z-index: 150;
        padding-top: 60px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    .sidebar.open { transform: translateX(0); }
    .overlay.active { display: block; }

    .main-content {
        max-width: 100%;
        padding: 20px 16px 40px;
        margin-left: 0;
    }

    .project-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dify-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 88px;
        height: 400px;
    }

    .detail-header h1 { font-size: 22px; }
    .hero-section h1 { font-size: 24px; }
    .modal-content { padding: 28px 20px 24px; }
    .contact-item { flex-wrap: wrap; gap: 6px; }
    .contact-label { width: 100%; }
}

/* 辅助类 */
.hidden { display: none; }

/* ===== 额外移动端优化 ===== */
@media screen and (max-width: 480px) {
    /* 导航栏内边距减小 */
    .sidebar {
        padding: 20px 14px 16px;
    }
    
    /* 头像缩小 */
    .avatar {
        width: 64px;
        height: 64px;
    }
    
    /* 导航列表字体缩小 */
    .nav-list li {
        font-size: 13px;
        padding: 8px 12px 8px 28px;
    }
    
    /* 卡片内边距减小 */
    .card-body {
        padding: 14px 16px 18px;
    }
    
    /* 卡片缩略图高度减小 */
    .card-thumb {
        height: 100px;
        font-size: 32px;
    }
    
    /* 详情页头部字体缩小 */
    .detail-header h1 {
        font-size: 20px;
    }
    
    /* 技术栈标签换行优化 */
    .tech-stack-display span {
        font-size: 11px;
        padding: 3px 12px;
    }
    
    /* 模态框内边距减小 */
    .modal-content {
        padding: 24px 16px 20px;
    }
    
    /* Dify对话框高度减小 */
    .dify-window {
        height: 360px;
        bottom: 80px;
    }
    
    /* 概览卡片字体缩小 */
    .overview-card {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    /* 联系按钮字体缩小 */
    .contact-btn {
        font-size: 13px;
        padding: 10px;
    }
}
