/* 全局重置与基础 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9fafb;
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部 */
.site-header {
    background: #4F46E5;
    color: white;
    padding: 1rem 0;
}
.site-header h1 a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}
.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
.site-header a,
.site-header .user-info {
    color: white;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: background 0.2s;
}
.site-header a:hover {
    background: rgba(255,255,255,0.1);
}
.admin-link {
    background: #3730A3 !important;
}

/* Flash 消息 */
.flash-messages {
    margin: 1rem 0;
}
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* 首页 Hero */
.hero {
    text-align: center;
    padding: 2rem 0;
}
.hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.hero p {
    color: #6b7280;
}

/* 资源网格 */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.card-thumb {
    height: 160px;
    background: #e0e7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #4F46E5;
}
.placeholder-img {
    /* 占位符，实际可替换为 <img> */
}
.card-body {
    padding: 1rem;
}
.category-tag {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}
.download-count {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0.5rem 0;
}
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}
.btn-primary {
    background: #4F46E5;
    color: white;
}
.btn-primary:hover {
    background: #4338CA;
}
.btn-detail {
    background: #dbeafe;
    color: #1d4ed8;
    width: 100%;
}
.btn-download {
    background: #10B981;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    display: inline-block;
    margin-top: 1rem;
}
.btn-disabled {
    background: #e5e7eb;
    color: #6b7280;
    cursor: not-allowed;
}
.btn-danger {
    background: #ef4444;
    color: white;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
}
.btn-danger:hover {
    background: #dc2626;
}
.back-link {
    display: inline-block;
    margin-top: 2rem;
    color: #4F46E5;
    text-decoration: none;
}

/* 表单容器（登录/注册） */
.auth-form-container {
    max-width: 500px;
    margin: 3rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.auth-form-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1e293b;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}
.form-group small {
    color: #6b7280;
    font-size: 0.85rem;
}
.form-footer {
    text-align: center;
    margin-top: 1rem;
}
.form-footer a {
    color: #4F46E5;
    text-decoration: none;
}

/* 后台管理 */
.admin-dashboard h2 {
    margin: 1.5rem 0;
    color: #1e293b;
}
.admin-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.resource-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.resource-table th,
.resource-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.resource-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

/* 详情页 */
.resource-detail {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.detail-header h1 {
    font-size: 1.8rem;
    color: #1e293b;
}
.preview-box {
    text-align: center;
    margin-bottom: 1.5rem;
}
.placeholder-preview {
    width: 100%;
    height: 200px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

/* 响应式 */
@media (max-width: 768px) {
    .site-header nav {
        justify-content: center;
    }
    .detail-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .resource-grid {
        grid-template-columns: 1fr;
    }
}
