* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #faf6f0;
    color: #3d3d3d;
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.dark {
    background: #1e1e2a;
    color: #e4e4e4;
}
body.dark .navbar {
    background: #2a2a3a;
}
body.dark .card {
    background: #2f2f42;
    color: #e4e4e4;
}
body.dark .card:hover {
    background: #3a3a50;
}
body.dark .category-btn {
    background: #2f2f42;
    color: #b0b0c0;
}
body.dark .category-btn.active {
    background: #ff8c42;
    color: #fff;
}
body.dark .search-input {
    background: #2f2f42;
    color: #e4e4e4;
    border-color: #4a4a5a;
}
body.dark .admin-container {
    background: #1e1e2a;
}
body.dark .modal-content {
    background: #2a2a3a;
    color: #e4e4e4;
}
body.dark .table-wrapper {
    background: #2a2a3a;
}
body.dark .table-wrapper th {
    background: #3a3a4e;
}
body.dark .table-wrapper td {
    border-bottom: 1px solid #3a3a4e;
}

.navbar {
    background: #ffffff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s;
}
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.logo {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff8c42, #f5a623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.nav-center {
    flex: 1;
    max-width: 500px;
    min-width: 180px;
}
.search-input {
    width: 100%;
    padding: 10px 18px;
    border: 2px solid #f0ebe5;
    border-radius: 30px;
    font-size: 15px;
    background: #f8f5f0;
    transition: all 0.3s;
    outline: none;
}
.search-input:focus {
    border-color: #ff8c42;
    background: #fff;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.theme-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 30px;
    transition: background 0.3s;
}
.theme-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}
.admin-btn {
    padding: 8px 18px;
    background: #ff8c42;
    color: #fff;
    border-radius: 30px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}
.admin-btn:hover {
    background: #e07a30;
}

.categories-wrapper {
    max-width: 1280px;
    margin: 20px auto 0;
    padding: 0 24px;
    overflow-x: auto;
}
.categories-container {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    padding-bottom: 10px;
}
.category-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 30px;
    background: #f0ebe5;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}
.category-btn:hover {
    background: #e5ddd5;
}
.category-btn.active {
    background: #ff8c42;
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.35);
}

.main-content {
    flex: 1;
    max-width: 1280px;
    margin: 20px auto 40px;
    padding: 0 24px;
    width: 100%;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}
.card {
    background: #ffffff;
    padding: 20px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 36px rgba(255, 140, 66, 0.12);
    border-color: #ff8c42;
}
.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #f8f5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.card-icon img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}
.card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}
.card-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.4;
}
body.dark .card-desc {
    color: #aaa;
}

.footer {
    text-align: center;
    padding: 24px;
    color: #aaa;
    font-size: 14px;
    margin-top: auto;
}

/* ===== 后台管理页面 ===== */
.admin-container {
    max-width: 1280px;
    margin: 30px auto;
    padding: 0 24px;
    flex: 1;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 30px;
}
.admin-header h1 {
    font-size: 28px;
}
.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.btn-primary {
    padding: 10px 24px;
    background: #ff8c42;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}
.btn-primary:hover {
    background: #e07a30;
}
.btn-secondary {
    padding: 10px 24px;
    background: #f0ebe5;
    color: #555;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}
.btn-secondary:hover {
    background: #e5ddd5;
}
.btn-danger {
    padding: 6px 14px;
    background: #e74c5e;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}
.btn-danger:hover {
    background: #c0392b;
}
.btn-edit {
    padding: 6px 14px;
    background: #5b9bd5;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}
.btn-edit:hover {
    background: #4a8bc2;
}

.table-wrapper {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
thead th {
    padding: 14px 16px;
    text-align: left;
    background: #faf6f0;
    font-weight: 600;
    border-bottom: 2px solid #eee;
}
tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f5f0ea;
    vertical-align: middle;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
tbody td:last-child {
    white-space: nowrap;
}

/* ===== 模态框 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.modal-content {
    background: #fff;
    padding: 32px 40px;
    border-radius: 20px;
    max-width: 520px;
    width: 92%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}
.modal-content h2 {
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #f0ebe5;
    border-radius: 10px;
    font-size: 14px;
    transition: border 0.3s;
    outline: none;
    background: #fafaf8;
}
.form-group input:focus {
    border-color: #ff8c42;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}
.form-actions .btn-primary,
.form-actions .btn-secondary {
    flex: 1;
    text-align: center;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        align-items: stretch;
    }
    .nav-left,
    .nav-right {
        justify-content: center;
    }
    .nav-center {
        max-width: 100%;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-actions {
        justify-content: stretch;
    }
    .admin-actions .btn-primary,
    .admin-actions .btn-secondary {
        text-align: center;
        flex: 1;
    }
    .modal-content {
        padding: 24px 18px;
    }
    .table-wrapper {
        font-size: 12px;
    }
    thead th,
    tbody td {
        padding: 8px 10px;
    }
}