/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #FCFCFC;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* 登录页面样式 */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.login-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.system-name {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}



.login-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #5a6fd8;
}

.login-footer {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

/* 主页面样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    padding: 12px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    width: 100%;
    padding: 0 24px;
}

.logo-area {
    display: flex;
    align-items: center;
}

.logo-area h1 {
    font-size: 22px;
    color: #fff;
    margin: 0;
    font-weight: 600;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 25px;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.85;
}

.nav a:hover, .nav a.active {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

.nav a i {
    margin-right: 6px;
}

/* 导航下拉菜单 */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.nav-dropdown > a {
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 25px;
    transition: all 0.3s;
    display: inline-block;
    opacity: 0.85;
}

.nav-dropdown:hover > a {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

.user-info {
    position: relative;
}

.user-dropdown {
    display: inline-block;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 25px;
    transition: all 0.3s;
    position: relative;
    color: #fff;
    opacity: 0.85;
}

.user-dropdown:hover {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    display: none;
    min-width: 160px;
    z-index: 100;
    margin-top: 8px;
}

.user-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 12px 18px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.dropdown-menu a:first-child {
    border-radius: 10px 10px 0 0;
}

.dropdown-menu a:last-child {
    border-radius: 0 0 10px 10px;
}

.dropdown-menu a:hover {
    background: #f8f9ff;
    color: #667eea;
}

.dropdown-menu a i {
    margin-right: 8px;
    color: #888;
}

/* 主内容区 */
.main-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.system-name {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    font-size: 24px;
    color: #333;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-danger {
    background: #e53935;
    color: white;
}

.btn-danger:hover {
    background: #c62828;
}

.btn-secondary {
    background: #9e9e9e;
    color: white;
}

.btn-secondary:hover {
    background: #757575;
}

/* 搜索和筛选区 */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* 调整分类选择器的宽度，确保三个下拉框能更好地并排显示 */
.filter-group select {
    width: 150px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 14px;
    color: #555;
    font-weight: bold;
}

.filter-group select, .filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    min-width: 150px;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

/* 素材列表区 */
.material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 200px);
    justify-content: center;
    gap: 20px;
}

/* 瀑布流样式 - 使用CSS Columns实现真正的瀑布流 */
body.home-page main.main-content .material-grid,
body main.main-content .uploaded-materials .material-grid,
body main.main-content .downloaded-materials .material-grid {
    /* 完全重置所有样式 */
    all: unset !important;
    
    /* 使用CSS Columns实现瀑布流 */
    display: block !important;
    /* 现代浏览器支持 */
    column-count: 5 !important;
    column-width: 200px !important;
    column-gap: 20px !important;
    /* 兼容性前缀 */
    -webkit-column-count: 5 !important;
    -webkit-column-width: 200px !important;
    -webkit-column-gap: 20px !important;
    -moz-column-count: 5 !important;
    -moz-column-width: 200px !important;
    -moz-column-gap: 20px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

body.home-page main.main-content .material-grid .material-card,
body main.main-content .uploaded-materials .material-grid .material-card,
body main.main-content .downloaded-materials .material-grid .material-card {
    /* 完全重置卡片样式 */
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    
    /* 确保卡片不被分割到不同列 - 兼容性处理 */
    break-inside: avoid-column !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    /* 兼容性前缀 */
    -webkit-column-break-inside: avoid !important;
    -moz-column-break-inside: avoid !important;
    -moz-page-break-inside: avoid !important;
    -ms-page-break-inside: avoid !important;
    margin-bottom: 20px !important;
    
    /* 美化视觉样式 */
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* 响应式瀑布流 - 确保在不同屏幕尺寸下都有良好表现 */
@media screen and (max-width: 1200px) {
    body.home-page main.main-content .material-grid,
    body main.main-content .uploaded-materials .material-grid,
    body main.main-content .downloaded-materials .material-grid {
        column-count: 4 !important;
        -webkit-column-count: 4 !important;
        -moz-column-count: 4 !important;
        max-width: 960px !important;
    }
}

@media screen and (max-width: 980px) {
    body.home-page main.main-content .material-grid,
    body main.main-content .uploaded-materials .material-grid,
    body main.main-content .downloaded-materials .material-grid {
        column-count: 3 !important;
        -webkit-column-count: 3 !important;
        -moz-column-count: 3 !important;
        max-width: 720px !important;
    }
}

@media screen and (max-width: 768px) {
    body.home-page main.main-content .material-grid,
    body main.main-content .uploaded-materials .material-grid,
    body main.main-content .downloaded-materials .material-grid {
        column-count: 2 !important;
        -webkit-column-count: 2 !important;
        -moz-column-count: 2 !important;
        max-width: 480px !important;
    }
}

@media screen and (max-width: 480px) {
    body.home-page main.main-content .material-grid,
    body main.main-content .uploaded-materials .material-grid,
    body main.main-content .downloaded-materials .material-grid {
        column-count: 1 !important;
        -webkit-column-count: 1 !important;
        -moz-column-count: 1 !important;
        max-width: 100% !important;
        padding: 0 10px !important;
    }
}

.material-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

.material-thumb {
    width: 100%;
    height: auto;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.material-thumb img {
    width: 100%;
    height: auto;
    object-fit: initial;
    transition: transform 0.3s;
    display: block;
}

/* 首页瀑布流图片样式 */
.home-page main.main-content .material-grid .material-thumb {
    height: auto !important;
}

.home-page main.main-content .material-grid .material-thumb img {
    width: 100% !important;
    height: auto !important;
    object-fit: initial !important;
}

.material-card:hover .material-thumb img {
    transform: scale(1.05);
}

.material-info {
    padding: 15px;
}

.material-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.material-name {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 96px; /* 约6个汉字宽度 */
}

/* 详情页面显示完整素材名称 */
body.material-detail-page .material-name {
    max-width: none;
    white-space: normal;
}

.material-category {
    font-size: 12px;
    color: #666;
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.material-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.material-stats {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.material-actions {
    display: flex;
    gap: 5px;
}

.material-actions .btn {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 5px;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f5f5f5;
    font-weight: bold;
    color: #555;
}

.data-table tr:hover {
    background: #fafafa;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s;
}

.pagination a:hover, .pagination a.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 筛选表单样式 */
.filter-form {
    margin-bottom: 20px;
}

.filter-container {
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* 素材详情页 */
.detail-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.preview-area {
    text-align: center;
}

.preview-area img {
    max-width: 100%;
    max-height: 600px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-area {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
}

.info-section {
    margin-bottom: 20px;
}

.info-section h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.info-label {
    color: #666;
}

.info-value {
    color: #333;
    font-weight: bold;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
}

.message.success {
    background: #4caf50;
}

.message.error {
    background: #e53935;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .detail-container {
        grid-template-columns: 1fr;
    }

    .material-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }
}

/* 个人中心 */
.profile-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.profile-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.profile-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.profile-label {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.profile-value {
    font-size: 16px;
    color: #333;
}

/* 数据统计 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

/* 图表容器 */
.chart-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    height: 400px;
}
