
/* 新增：强制重置所有元素布局 */
* {
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  float: none !important;
}
body {
  width: 100% !important;
  overflow-x: hidden !important;
}
.navbar {
  width: 100% !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
}
.modal {
  z-index: 9999 !important; /* 确保弹窗能显示 */
}
/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 导航栏 */
.navbar {
    background-color: #2c6e49;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.5rem;
    color: #7ccd7c;
}

.logo h1 {
    font-size: 1.2rem;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: #3a8c5a;
}

.admin-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-btn {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.points {
    background-color: #7ccd7c;
    color: #2c6e49;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.sign-btn {
    background-color: #7ccd7c;
    color: #2c6e49;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

/* 搜索栏 */
.search-section {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#search-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

#search-btn {
    background-color: #2c6e49;
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 4px;
    cursor: pointer;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.filter-tag {
    padding: 0.4rem 1rem;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-tag.active {
    background-color: #2c6e49;
    color: white;
    border-color: #2c6e49;
}

/* 资源列表 */
.resource-section {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
}

.section-title {
    font-size: 1.8rem;
    color: #2c6e49;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #7ccd7c;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s;
}

.resource-card:hover {
    transform: translateY(-5px);
}

.resource-header {
    background-color: #2c6e49;
    color: white;
    padding: 1rem;
    font-weight: bold;
}

.resource-body {
    padding: 1rem;
}

.resource-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.resource-desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-top: 1px solid #eee;
}

.resource-tag {
    background-color: #f0f8f0;
    color: #2c6e49;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.resource-btn {
    background-color: #7ccd7c;
    color: #2c6e49;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* 积分兑换区 */
.exchange-section {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 2rem;
}

.exchange-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.exchange-card {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s;
}

.exchange-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.exchange-card i {
    font-size: 2.5rem;
    color: #2c6e49;
    margin-bottom: 1rem;
}

.exchange-btn {
    background-color: #2c6e49;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

/* 关于平台 */
.about-section {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
    text-align: center;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    color: #666;
    line-height: 1.8;
}

/* 管理员面板 */
.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: white;
    z-index: 1000;
    padding: 2rem;
    display: none;
    overflow-y: auto;
}

.admin-panel.active {
    display: block;
}

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

.back-btn {
    background-color: #ddd;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.admin-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-tab {
    padding: 0.8rem 1.5rem;
    background-color: #f5f5f5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.admin-tab.active {
    background-color: #2c6e49;
    color: white;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    padding: 0.8rem 1rem;
    border: 1px solid #eee;
    text-align: left;
}

.admin-table th {
    background-color: #f5f5f5;
}

.action-btn {
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
}

.disable-btn {
    background-color: #e67e22;
    color: white;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.setting-item input[type="number"] {
    padding: 0.5rem;
    width: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.save-btn {
    background-color: #2c6e49;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-tabs {
    display: flex;
    margin-bottom: 1.5rem;
}

.modal-tab {
    flex: 1;
    padding: 0.8rem;
    background-color: #f5f5f5;
    border: none;
    cursor: pointer;
}

.modal-tab.active {
    background-color: #2c6e49;
    color: white;
}

.modal-form {
    display: none;
}

.modal-form.active {
    display: block;
}

.modal-form input, .modal-form select, .modal-form textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.code-input {
    display: flex;
    gap: 0.5rem;
}

.code-input input {
    flex: 1;
}

#send-register-code {
    background-color: #7ccd7c;
    color: #2c6e49;
    border: none;
    padding: 0 1rem;
    border-radius: 4px;
    cursor: pointer;
}

#do-login, #do-register, #do-upload {
    width: 100%;
    background-color: #2c6e49;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2c6e49;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 响应式适配 */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }
}
