/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: #f9fafb;
    color: #374151;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem; 
}

/* 前台样式 */
.frontend {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    flex-grow: 1;
}

.nav-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo-container img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: none; /* 默认隐藏LOGO */
}

.nav-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e40af;
}

/* 分页样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

/* 统一上一页和下一页按钮样式 */
.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.admin-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 按钮样式 */
.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-secondary:hover {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    padding: 0.6rem 1.2rem;
    background: #1e40af;
    border: 1px solid #1e40af;
    border-radius: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-primary:hover {
    background: #1d3f9f;
    transform: translateY(-1px);
}

/* 分类过滤器 */
.nav-categories {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-btn {
    padding: 0.6rem 1.2rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    color: #4b5563; /* 默认字体颜色 */
}

.category-btn.active {
    background: #1e40af;
    color: white; /* 激活状态字体颜色为白色 */
    border-color: #1e40af;
    box-shadow: 0 2px 5px rgba(30, 64, 175, 0.2);
}

.category-btn:hover:not(.active) {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

/* 链接列表 */
.nav-list {
    list-style: none;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    transition: transform 0.2s ease;
}

.nav-item:last-child {
    border-bottom: none;
}

.nav-item:hover {
    transform: translateY(-2px);
    background: #f9fafb;
}

.nav-link {
    display: flex;
    align-items: center;
    color: #4b5563;
    text-decoration: none;
    flex-grow: 1;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #1e40af;
}

.link-info {
    margin-left: 1rem;
    flex-grow: 1;
}

.link-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #111827;
}

.link-desc {
    font-size: 0.7rem;
    color: #6b7280;
}

.link-logo {
    width: 40px;
    height: 40px;
    border-radius: 100rem;
    object-fit: cover;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
}

.status-normal {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #b91c1c;
}

/* 后台样式 */
.backend {
    display: none;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    max-width: 400px;
    margin: 5rem auto 2rem;
}

.admin-panel {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 1.5rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    outline: none;
}

button {
    padding: 0.6rem 1.2rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

button:hover {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 表格样式 */
.links-table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.links-table {
    width: 100%;
    border-collapse: collapse;
}

.links-table th {
    text-align: left;
    padding: 1rem 1.2rem;
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
}

.links-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f3f4f6;
}

.links-table tr:last-child td {
    border-bottom: none;
}

.links-table tr:hover {
    background: #f9fafb;
}

.links-table input, .links-table select, .links-table textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
}

.links-table input:focus, .links-table select:focus, .links-table textarea:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    outline: none;
}

/* 箭头控制样式 */
.arrow-controls {
    display: flex; /* 使用 flex 布局 */
    flex-direction: column; /* 按列方向排列箭头按钮 */
    align-items: center; /* 水平居中对齐箭头按钮 */
    gap: 0.5rem; /* 设置箭头按钮之间的间距为 0.5rem */
}

.arrow-btn {
    padding: 0.4rem 0.8rem; /* 设置按钮的内边距 */
    background: white; /* 设置按钮的背景色为白色 */
    border: 1px solid #e5e7eb; /* 设置按钮的边框 */
    border-radius: 0.5rem; /* 设置按钮的圆角为 0.5rem */
    cursor: pointer; /* 鼠标悬停时显示指针样式 */
    transition: all 0.2s ease; /* 添加过渡效果，使按钮状态变化平滑 */
    font-size: 0.8rem; /* 设置按钮内字体大小为 0.8rem */
    display: flex; /* 使用 flex 布局 */
    align-items: center; /* 垂直居中对齐按钮内容 */
    justify-content: center; /* 水平居中对齐按钮内容 */
    color: #374151; /* 设置箭头颜色为深灰色 */
}

.arrow-btn:hover {
    border-color: #9ca3af; /* 鼠标悬停时边框颜色变为深灰色 */
    transform: translateY(-1px); /* 鼠标悬停时按钮轻微上移 */
}

.arrow-btn:disabled {
    opacity: 0.5; /* 禁用按钮时透明度降低为 0.5 */
    cursor: not-allowed; /* 禁用按钮时鼠标指针显示为不可点击样式 */
}

/* 为箭头按钮所在的单元格设置一个类 */
.arrow-cell {
    border-bottom: none; /* 移除底部边框 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 动作按钮单元格 */
.action-cell {
    display: flex;
    gap: 0.5rem;
}

/* 分类管理样式 */
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.category-item {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.category-item button {
    background: none;
    border: none;
    color: #ef4444;
    margin-left: 0.8rem;
    padding: 0;
    cursor: pointer;
    font-size: 1.25rem;
}

/* 页面标题样式 */
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #111827;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 1rem 0;
    color: #6b7280;
    font-size: 0.7rem;
    margin-top: 1rem;
}

.admin-footer {
    text-align: center;
    padding: 1rem 0;
    color: #6b7280;
    font-size: 0.7rem;
    margin-top: 1rem;
}

/* 密码修改样式 */
.password-change {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .nav-item {
        align-items: flex-start;
    }

    .link-info {
        margin-left: 1rem;
        width: 100%;
    }

    .status-badge {
        margin-top: 0.8rem;
        align-self: flex-end;
    }

    .links-table th, .links-table td {
        padding: 0.8rem 0.5rem;
    }

    .links-table td {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .links-table th {
        display: none;
    }

    .links-table td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-bottom: 0.3rem;
    }

    .pagination-container {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
}