* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* 头部与导航 */

.site-header {
    background-color: #222;
    color: #fff;
    padding: 12px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}

.logo img {
    height: 40px;
}

.site-nav a {
    margin-left: 16px;
    color: #ddd;
    font-size: 14px;
}

.site-nav a:hover {
    color: #fff;
}

.site-main {
    padding: 24px 0 40px;
}

.site-footer {
    background-color: #222;
    color: #999;
    padding: 16px 0;
    font-size: 13px;
    text-align: center;
}

/* 页面标题 */

.page-title {
    font-size: 24px;
    margin: 0 0 16px;
}

/* 分类列表 */

.category-grid {
    display: grid;
    grid-gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.category-card {
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform .15s ease, box-shadow .15s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.category-cover img {
    width: 100%;
    display: block;
    height: 150px;
    object-fit: cover;
    border-radius: 0;
}

.category-cover-placeholder {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #dfe9f3 0%, #f5f7fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 13px;
}

.category-info {
    padding: 12px 14px 14px;
}

.category-info h2 {
    font-size: 18px;
    margin: 0 0 6px;
}

.category-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

/* 文本内容 */

.page-content {
    background-color: #fff;
    padding: 16px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin-bottom: 16px;
}

/* 图片网格 */

.photo-grid {
    display: grid;
    grid-gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.photo-item img {
    width: 100%;
    display: block;
    border-radius: 3px; /* 详情图片圆角 3px */
    cursor: zoom-in;
}

/* Lightbox */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 3px;
}

.lightbox-close {
    position: absolute;
    right: -12px;
    top: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: #333;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.lightbox-caption {
    margin-top: 8px;
    color: #fff;
    font-size: 13px;
    text-align: center;
}

/* 后台简单样式复用 */

.admin-layout {
    background-color: #fff;
    padding: 16px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #fafafa;
    text-align: left;
}

.admin-form-group {
    margin-bottom: 12px;
}

.admin-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.admin-form-group input[type="text"],
.admin-form-group input[type="password"],
.admin-form-group textarea,
.admin-form-group input[type="file"] {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.admin-form-group textarea {
    min-height: 80px;
}

.btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background-color: #1976d2;
    color: #fff;
    font-size: 14px;
}

.btn-secondary {
    background-color: #888;
}

.btn-danger {
    background-color: #d32f2f;
}

.btn + .btn {
    margin-left: 8px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.admin-topbar a {
    font-size: 13px;
    color: #1976d2;
}

.admin-nav a {
    margin-right: 12px;
    font-size: 13px;
}

.alert {
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
}

@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .site-nav {
        margin-top: 8px;
    }
}
