/**
 * 轻量资源下载站 - 主样式表
 * 主题色：清爽绿 (#52c41a)
 * 设计风格：简洁优雅、3度圆角、无渐变无背景色
 */

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    line-height: 1.6;
}

a {
    color: #52c41a;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #3da014;
}

/* ===== 布局容器 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 卡片 ===== */
.card {
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 10px 0;
}

/* ===== 表单元素 ===== */
.form-group {
    margin-bottom: 15px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #52c41a;
    box-shadow: 0 0 0 2px rgba(82, 196, 26, 0.1);
}

.form-control::placeholder {
    color: #bfbfbf;
}

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

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 12px;
    color: #8c8c8c;
    margin-top: 5px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #52c41a;
    color: #fff;
    border-color: #52c41a;
}

.btn-primary:hover {
    background: #3da014;
    border-color: #3da014;
}

.btn-secondary {
    background: #fff;
    color: #333;
    border-color: #d9d9d9;
}

.btn-secondary:hover {
    border-color: #52c41a;
    color: #52c41a;
}

.btn-danger {
    background: #fff;
    color: #ff4d4f;
    border-color: #ff4d4f;
}

.btn-danger:hover {
    background: #ff4d4f;
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== 表格 ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    font-weight: 600;
    color: #555;
    background: #fafafa;
}

.table tbody tr:hover {
    background: #fafafa;
}

/* ===== 标签 ===== */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.tag-default {
    border: 1px solid #d9d9d9;
    color: #666;
}

.tag-success {
    border: 1px solid #52c41a;
    color: #52c41a;
}

.tag-primary {
    border: 1px solid #1890ff;
    color: #1890ff;
}

.tag-warning {
    border: 1px solid #faad14;
    color: #faad14;
}

.tag-danger {
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #52c41a;
    color: #fff;
}

.badge-secondary {
    background: #f0f0f0;
    color: #666;
}

/* ===== 开关 ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

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

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #bfbfbf;
    border-radius: 11px;
    transition: 0.3s;
}

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

.switch input:checked + .switch-slider {
    background-color: #52c41a;
}

.switch input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* ===== 导航栏 ===== */
.navbar {
    border-bottom: 1px solid #e8e8e8;
    padding: 15px 0;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand:hover {
    color: #52c41a;
}

.navbar-brand svg {
    vertical-align: middle;
}

.navbar-nav {
    display: flex;
    list-style: none;
}

.navbar-nav li {
    margin-left: 25px;
}

.navbar-nav a {
    color: #555;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: #52c41a;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 200px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    border-right: 1px solid #e8e8e8;
    padding: 20px 0 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-logo {
    padding: 0 20px 20px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 60px; /* 为底部版权留空间 */
}

.sidebar-nav li a {
    display: flex;
    padding: 12px 20px;
    color: #555;
    align-items: center;
    gap: 10px;
}

.sidebar-nav li a svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.sidebar-nav li a:hover {
    color: #555;
}

.sidebar-nav li a.active {
    color: #52c41a;
    background: #f0f5eb;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.sidebar-copyright {
    font-size: 11px;
    color: #999;
    line-height: 1.5;
    word-break: break-all;
}

/* ===== 主内容区 ===== */
.main-content {
    margin-left: 200px;
    padding: 20px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.page-actions {
    margin-top: 10px;
}

/* ===== 统计卡片 ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    padding: 20px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 600;
    color: #52c41a;
    margin-bottom: 5px;
}

.stat-card-label {
    color: #8c8c8c;
    font-size: 14px;
}

/* ===== 搜索框 ===== */
.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    padding-right: 45px;
}

.search-box button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    padding: 0 15px;
    border: none;
    background: #52c41a;
    color: #fff;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8c8c8c;
}

.empty-state-icon {
    margin-bottom: 15px;
}

.empty-state-icon svg {
    display: inline-block;
}

.empty-state-text {
    font-size: 16px;
}

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

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    color: #555;
}

.pagination a:hover {
    border-color: #52c41a;
    color: #52c41a;
}

.pagination .active {
    background: #52c41a;
    border-color: #52c41a;
    color: #fff;
}

/* ===== 消息提示 ===== */
.alert {
    padding: 15px 20px;
    border-radius: 3px;
    margin-bottom: 20px;
}

.alert-success {
    border: 1px solid #b7eb8f;
    color: #3da014;
}

.alert-error {
    border: 1px solid #ffa39e;
    color: #cf1322;
}

.alert-warning {
    border: 1px solid #ffe58f;
    color: #d48806;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 3px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    font-size: 20px;
    color: #8c8c8c;
    cursor: pointer;
    border: none;
    background: none;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}

.modal-footer .btn {
    margin-left: 10px;
}

/* ===== 文件上传 ===== */
.file-upload {
    position: relative;
    border: 1px dashed #d9d9d9;
    border-radius: 3px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload:hover {
    border-color: #52c41a;
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-text {
    color: #8c8c8c;
}

.file-upload-text svg {
    display: block;
    margin: 0 auto 10px;
}

/* ===== 资源列表 ===== */
.resource-list {
    display: grid;
    gap: 15px;
}

.resource-item {
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.resource-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.resource-card-meta {
    font-size: 13px;
    color: #8c8c8c;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.resource-card-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.resource-card-meta svg {
    vertical-align: middle;
}

.resource-tags {
    margin-top: 10px;
}

.resource-actions {
    text-align: right;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .table {
        display: block;
        overflow-x: auto;
    }
}

/* ===== 工具类 ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: #52c41a;
}

.text-danger {
    color: #ff4d4f;
}

.text-muted {
    color: #8c8c8c;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}
