:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --accent: #f9a825;
    --bg: #f4f7f2;
    --card-bg: #ffffff;
    --text: #1f2d23;
    --text-light: #5f6b62;
    --border: #e3e8e1;
    --shadow: 0 2px 12px rgba(46, 125, 50, 0.08);
    --shadow-hover: 0 8px 24px rgba(46, 125, 50, 0.18);
    --radius: 6px;
    --radius-sm: 4px;
    --content-max: 2000px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* 顶部品牌栏 */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 18px 32px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-logo {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), #e65100);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -1px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}

.brand-title { font-size: 21px; font-weight: 600; letter-spacing: 2px; }
.brand-sub { font-size: 12px; opacity: 0.8; margin-top: 3px; letter-spacing: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: background 0.2s;
}
.btn-link:hover { background: rgba(255, 255, 255, 0.28); }
.btn-link.active { background: rgba(255, 255, 255, 0.35); font-weight: 600; }

/* 版本发布页 */
.version-section {
    max-width: var(--content-max);
    margin: 28px auto 20px;
    padding: 0 32px;
}
.section-header {
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 22px;
    color: var(--text);
    margin-bottom: 6px;
}
.section-desc {
    color: var(--text-light);
    font-size: 14px;
}
.version-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.version-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    cursor: pointer;
}
.version-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.version-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.version-info {
    flex: 1;
    min-width: 0;
}
.version-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.version-desc {
    font-size: 13px;
    color: var(--text-light);
}
.version-arrow {
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

/* 搜索区 */
.search-section {
    max-width: var(--content-max);
    margin: 28px auto 20px;
    padding: 0 32px;
}

.search-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.search-input-wrap {
    flex: 1;
    min-width: 260px;
    position: relative;
}
.search-input-wrap::before {
    content: '🔍';
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    opacity: 0.6;
}
.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: #fbfdfa;
    transition: all 0.2s;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
    background: #fff;
}

.select-input, .date-input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fbfdfa;
    min-width: 150px;
}
.select-input:focus, .date-input:focus {
    outline: none;
    border-color: var(--primary-light);
}

.result-meta {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 14px;
    padding: 0 8px;
}
.result-meta b { color: var(--primary-dark); }

/* 卡片网格 */
.gallery {
    max-width: var(--content-max);
    margin: 0 auto 60px;
    padding: 0 32px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.card-cover {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover .cover-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 46px; opacity: 0.5;
}
.card-date {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(27, 94, 32, 0.88);
    color: #fff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

.card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-owner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    background: #e8f5e9;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    width: fit-content;
}
.card-purpose {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* 空状态 */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}
.empty .emoji { font-size: 64px; margin-bottom: 16px; }

/* 加载 */
.loading-bar {
    text-align: center;
    padding: 60px;
    color: var(--text-light);
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid #e3e8e1;
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 登录页 */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%; max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.login-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), #e65100);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -1px;
    color: #fff;
    margin: 0 auto 20px;
    box-shadow: 0 6px 16px rgba(230, 81, 0, 0.3);
}
.login-title { text-align: center; font-size: 19px; font-weight: 600; margin-bottom: 28px; letter-spacing: 1px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.error-msg { color: #c62828; font-size: 13px; margin-bottom: 14px; text-align: center; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(46, 125, 50, 0.35); transform: translateY(-1px); }
.btn-secondary { background: #f1f5f0; color: var(--text); }
.btn-secondary:hover { background: #e3e8e1; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* 管理页 */
.admin-header {
    max-width: var(--content-max);
    margin: 24px auto 16px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-title { font-size: 20px; font-weight: 600; }

.admin-toolbar {
    max-width: var(--content-max);
    margin: 0 auto 16px;
    padding: 0 32px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.admin-search {
    flex: 1; min-width: 240px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.table-wrap {
    max-width: var(--content-max);
    margin: 0 auto 60px;
    padding: 0 32px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #f4f7f2; font-weight: 600; color: var(--text); white-space: nowrap; }
td img.thumb { width: 56px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); }
td .row-actions { display: flex; gap: 8px; white-space: nowrap; }
.muted { color: var(--text-light); }

/* 模态框 */
.modal-mask {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 100%; max-width: 560px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: pop 0.2s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-light); line-height: 1; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.cover-preview {
    width: 100%; height: 150px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 8px;
    background-color: #fbfdfa;
}
.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-row .form-control { flex: 1; }

@media (max-width: 640px) {
    .topbar-inner, .search-section, .gallery, .admin-header, .admin-toolbar, .table-wrap { padding-left: 16px; padding-right: 16px; }
    .brand-title { font-size: 18px; }
}
