* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
}

/* 前台布局：顶部 header + 主内容 + 底部 footer */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 40px;
    padding-bottom: 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.site-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0.5;
}

.site-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
}

header h1 {
    font-size: 1.8em;
    color: #333333;
    margin: 0;
    text-align: left;
}

footer {
    margin-top: 40px;
    padding: 20px 0;
    color: #666666;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

footer p {
    margin: 0;
    text-align: left;
    flex: 1;
}

.copyright-text {
    color: #666666;
}

.copyright-text a {
    color: #666666;
    text-decoration: none;
}

.copyright-text a:hover {
    text-decoration: underline;
}

.admin-link-btn {
    color: #ffffff;
    background-color: transparent;
    text-decoration: none;
    padding: 4px 8px;
    border: none;
    cursor: pointer;
    font-size: inherit;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.admin-link-btn:hover {
    color: #666666;
}

.nav-icon {
    font-size: 1.5em;
}

/* 后台布局：左侧边栏 + 右侧主内容 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 200px;
    min-width: 200px;
    background: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.admin-sidebar-header {
    margin-bottom: 20px;
}

.admin-sidebar-title {
    font-size: 1.1rem;
    color: #333333;
    margin: 0;
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-sidebar-link {
    display: block;
    padding: 10px 12px;
    color: #333333;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.admin-sidebar-link:hover {
    background: #e8e8e8;
    color: #111;
}

.admin-sidebar-link-primary {
    font-weight: 600;
    color: #007bff;
}

.admin-sidebar-link-primary:hover {
    color: #0056b3;
    background: #e7f1ff;
}

.admin-main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-main-wrap > .messages {
    padding: 20px 24px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.admin-main-content {
    flex: 1;
    padding: 24px 32px;
    max-width: 1200px;
    width: 100%;
    margin: 0;
}

/* 管理员登录区域 */
.admin-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin-top: 20px;
}

.admin-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.admin-info .admin-name {
    color: #666666;
    font-size: 0.9em;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .site-header-content {
        width: 100%;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .admin-sidebar-header {
        margin-bottom: 0;
        margin-right: 12px;
    }
    
    .admin-sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .admin-sidebar-link {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .admin-section {
        padding: 15px 0;
    }
    
    .admin-info {
        width: 100%;
    }
    
    .admin-form-container {
        padding: 20px;
    }
    
    .file-input {
        font-size: 16px;
    }
    
    .preview-image {
        max-width: 150px;
        max-height: 150px;
    }
}

main {
    flex: 1;
}

.messages {
    margin-bottom: 20px;
}

.message {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: center;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 分类叠层：选项卡 + 层 */
.nav-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.nav-category-tab {
    padding: 10px 18px;
    font-size: 0.95rem;
    color: #555555;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nav-category-tab:hover {
    background: #e5e5e5;
    color: #333;
}

.nav-category-tab.active {
    background: #333333;
    color: #fff;
}

/* Stack all category layers in one grid cell so container height
   equals the tallest panel — prevents layout shift when switching tabs */
.nav-layers {
    display: grid;
}

.nav-category-layer {
    grid-area: 1 / 1;
    visibility: hidden;
    pointer-events: none;
}

.nav-category-layer.active {
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

/* 导航网格布局 - 3列 */
.navigation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .navigation-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .navigation-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    header h1 {
        font-size: 1.4em;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-link-btn {
        align-self: flex-end;
    }
    
    .admin-main-content {
        padding: 16px;
    }
}

/* 导航卡片样式 */
.nav-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #cccccc;
}

.nav-card:active {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nav-link {
    text-decoration: none;
    color: #333333;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.nav-link:active {
    background-color: #f5f5f5;
}

.nav-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.nav-name {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333333;
}

.nav-description {
    font-size: 0.9em;
    color: #666666;
    margin-top: 5px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999999;
}

.empty-state p {
    font-size: 1.2em;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: #007bff;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.login-box {
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 35px;
    color: #333333;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #007bff;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* 管理后台样式 */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-header h2 {
    color: #333333;
}

.admin-navigation-list {
    margin-bottom: 30px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.admin-table thead {
    background-color: #f8f9fa;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
}

.admin-table th {
    font-weight: 600;
    color: #333333;
}

.admin-table tbody tr:hover {
    background-color: #f8f9fa;
}


.admin-table a {
    color: #007bff;
    text-decoration: none;
}

.admin-table a:hover {
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 10px;
}

.actions form {
    margin: 0;
}

.actions .btn-small {
    background-color: transparent !important;
    border: none !important;
    padding: 4px 8px;
    font-size: 13px;
    text-decoration: none;
    color: #007bff;
    transition: color 0.2s ease;
    box-shadow: none !important;
}

.actions .btn-small:hover {
    background-color: transparent !important;
    color: #0056b3;
    text-decoration: underline;
    box-shadow: none !important;
}

.actions .btn-small.btn-danger {
    color: #dc3545;
}

.actions .btn-small.btn-danger:hover {
    color: #c82333;
    background-color: transparent !important;
}

.admin-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* 表单样式 */
.admin-form-container {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.admin-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333333;
}

.form-group .required {
    color: #dc3545;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666666;
}

.form-group select.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: #fafafa;
}

.file-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.current-image {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.current-image p {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #666666;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    object-fit: contain;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group .radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"],
.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}


