/* css/style.css - 完整修复版 */

/* --- 1. 字体定义 --- */
@font-face {
    font-family: 'MiSans';
    src: url('../font/misans/MiSans-Regular.ttf') format('truetype');
    font-weight: normal;
    font-display: swap;
}
@font-face {
    font-family: 'MiSans';
    src: url('../font/misans/MiSans-Bold.ttf') format('truetype');
    font-weight: bold;
    font-display: swap;
}
@font-face {
    font-family: 'MiSans';
    src: url('../font/misans/MiSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}

/* --- 2. 全局变量 & 配色 --- */
:root {
    /* 核心配色 */
    --color-main: #73645D;       /* 主色调 */
    --color-dark: #3D3230;       /* 深色文字 */
    --color-sub: #8B8080;        /* 辅助/灰色 */
    --color-bg: #FDF5F2;         /* 背景色 */
    
    /* 功能色 */
    --color-danger: #ff4d4f;
    --color-success: #52c41a;

    /* 毛玻璃效果变量 */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(115, 100, 93, 0.1);
    --shadow-hover: 0 12px 40px 0 rgba(115, 100, 93, 0.15);
}

/* --- 3. 基础重置 --- */
body {
    font-family: 'MiSans', sans-serif;
    background-color: var(--color-bg);
    background-image: linear-gradient(135deg, #fff0ea 0%, #f4ebe7 100%);
    background-attachment: fixed;
    color: var(--color-dark);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5 {
    margin-top: 0;
    color: var(--color-dark);
    font-weight: bold;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

/* --- 4. 导航栏 --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.6);
}

nav .logo {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--color-main);
    letter-spacing: 1px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
}

nav a {
    font-weight: 500;
    color: var(--color-sub);
    position: relative;
}

nav a:hover, nav a.active {
    color: var(--color-main);
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-main);
    border-radius: 2px;
}

/* --- 5. 通用组件 --- */

/* 毛玻璃卡片 */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px;
    transition: transform 0.3s, box-shadow 0.3s;
}

/* 按钮基础样式 */
.btn {
    background: var(--color-main);
    color: white;
    border: 1px solid transparent;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'MiSans', sans-serif;
    font-weight: bold;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    background: #5e524c;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(115, 100, 93, 0.2);
}

/* 描边按钮 */
.btn-outline {
    background: transparent;
    border: 1px solid var(--color-main);
    color: var(--color-main);
}

.btn-outline:hover {
    background: var(--color-main);
    color: white;
}

/* 小按钮 */
.btn-sm {
    padding: 5px 15px;
    font-size: 0.85rem;
}

/* 危险操作按钮 (删除) */
.btn-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: 6px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.3s;
    width: 100%;
    margin-top: 10px;
    font-family: 'MiSans', sans-serif;
}

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

/* --- 6. 布局容器 --- */
.container {
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.6s ease;
}

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

/* --- 7. 个人中心 Dashboard --- */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 400px; /* 左侧自适应，右侧固定400 */
    gap: 30px;
    /* 关键：拉伸对齐，使左右高度一致 */
    align-items: stretch;
}

/* 让卡片占满高度并支持内部垂直居中 */
.dashboard .glass-card {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* 特殊处理：右侧预览栏内容垂直居中 */
.dashboard .glass-card:last-child {
    justify-content: center;
}

.section-title {
    font-size: 1.1rem;
    color: var(--color-main);
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(115,100,93,0.1);
    padding-bottom: 10px;
    font-weight: bold;
}

/* 文件上传美化 */
.file-upload-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.file-upload-label {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-sub);
    transition: all 0.3s;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-upload-label:hover {
    border-color: var(--color-main);
    color: var(--color-main);
    background: white;
}

input[type="file"] {
    display: none;
}

/* 预览盒子 */
.preview-box {
    text-align: center;
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px dashed rgba(0,0,0,0.1);
}

.pixel-art {
    image-rendering: pixelated;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
}

/* --- 8. 资源广场 --- */
.gallery-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-nav a {
    padding: 10px 40px;
    border-radius: 50px;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.6);
    color: var(--color-sub);
    transition: all 0.3s;
    font-weight: bold;
}

.gallery-nav a.active, .gallery-nav a:hover {
    background: var(--color-main);
    color: white;
    box-shadow: 0 4px 15px rgba(115, 100, 93, 0.3);
    border-color: var(--color-main);
}

.gallery-grid {
    display: grid;
    /* 自动填充：每列最小230px，最大自适应，一行能放几个放几个 */
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 25px;
    width: 100%;
}

.gallery-item {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%; 
    box-sizing: border-box;
}

.gallery-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.gallery-preview-container {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.02);
    border-radius: 10px;
    margin-bottom: 15px;
}

.uploader-tag {
    background: rgba(115, 100, 93, 0.08);
    color: var(--color-main);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: inline-block;
    font-weight: 500;
}

.uploader-tag.my-upload {
    background: rgba(82, 196, 26, 0.1);
    color: var(--color-success);
}

/* --- 9. Toast 提示框 --- */
#toast-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    border-left: 5px solid #ddd;
    font-size: 0.95rem;
    min-width: 250px;
    
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success { border-left-color: var(--color-success); color: #2c662d; }
.toast.error { border-left-color: var(--color-danger); color: #a82424; }

/* --- 10. 表单与登录页 (NEW: 修复登录样式) --- */

/* 通用输入框样式修复 */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0 20px 0; /* 上下间距 */
    border: 1px solid #ddd;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box; /* 确保内边距不撑开宽度 */
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--color-main);
    box-shadow: 0 0 0 2px rgba(115, 100, 93, 0.1);
}

/* 登录页面容器辅助 */
.login-container {
    width: 100%;
    max-width: 400px;
    margin: 60px auto; /* 垂直居中辅助 */
    text-align: center;
}

/* --- 11. 响应式适配 --- */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr; /* 小屏幕变单列 */
    }
    
    .dashboard .glass-card {
        height: auto; 
    }
    
    .container {
        padding: 0 15px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    #toast-container {
        right: 20px;
        bottom: 20px;
        left: 20px;
    }
    
    .login-container {
        width: 90%;
        margin: 30px auto;
    }
}
/* --- 12. 官网首页新增样式 (New) --- */

/* 通用板块间距 */
.home-section {
    padding: 80px 0;
    border-bottom: 1px solid rgba(115, 100, 93, 0.05);
}
.home-section:last-child {
    border-bottom: none;
}
.home-section h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 50px;
    color: var(--color-dark);
}

/* 关于我们文字 */
.about-text {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.8;
    color: #555;
    font-size: 1.1rem;
}

/* 管理团队 */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    justify-content: center;
}

.staff-card {
    text-align: center;
    padding: 30px 20px;
    transition: transform 0.3s;
}
.staff-card:hover {
    transform: translateY(-8px);
}

.staff-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 4px solid rgba(255,255,255,0.8);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    object-fit: cover; /* 防止头像变形 */
}

.staff-role {
    display: inline-block;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-weight: bold;
}

/* 职位颜色定义 */
.role-owner { background: rgba(255, 77, 79, 0.1); color: #ff4d4f; }   /* 服主红 */
.role-admin { background: rgba(250, 173, 20, 0.1); color: #faad14; }  /* 管理员金 */
.role-builder { background: rgba(24, 144, 255, 0.1); color: #1890ff; } /* 建筑师蓝 */
.role-tech { background: rgba(82, 196, 26, 0.1); color: #52c41a; }    /* 技术绿 */

.staff-quote {
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

/* 截图画廊 */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}
.screenshot-item {
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background: #ddd; /* 占位色 */
}
.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.screenshot-item:hover img {
    transform: scale(1.1);
}

/* 加入社区 */
.join-box {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}
.qq-group-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-main);
    letter-spacing: 2px;
    margin: 20px 0;
    display: block;
}
/* --- 13. 头像裁剪弹窗样式 (New) --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
}

.crop-container {
    width: 100%;
    height: 400px; /* 限制裁剪区高度 */
    background: #f0f0f0;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
}

/* 确保图片在裁剪器中最大化 */
.crop-container img {
    display: block;
    max-width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}