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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background: #f8fafc;
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

/* 前台样式 */
.frontend {
    max-width: 1200px;
    margin: 2rem auto 4rem;
    padding: 0 1.5rem;
    flex-grow: 1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

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

.logo-container img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    display: none; /* 默认隐藏LOGO */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e40af;
    letter-spacing: -0.02em;
}

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

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

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

/* 按钮样式 */
.btn-secondary {
    padding: 0.7rem 1.4rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #475569;
}

.btn-secondary:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    padding: 0.7rem 1.4rem;
    background: #1e40af;
    border: 1px solid #1e40af;
    border-radius: 0.6rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(30, 64, 175, 0.3);
    font-weight: 500;
}

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.btn-success {
    padding: 0.7rem 1.4rem;
    background: #059669;
    border: 1px solid #059669;
    border-radius: 0.6rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
    font-weight: 500;
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

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

.category-btn {
    padding: 0.6rem 1.2rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    color: #475569;
    font-weight: 500;
}

.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: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

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

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

.nav-item:hover {
    transform: translateY(-2px);
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    z-index: 1;
    position: relative;
}

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

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

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

.link-name {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #0f172a;
    font-size: 1rem;
}

.link-desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

.link-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.link-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.4rem 0.9rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    white-space: nowrap;
    font-weight: 500;
}

.status-normal {
    background: #dcfce7;
    color: #166534;
}

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

/* 删除前台检测时间提示 */
.last-checked-time {
    display: none;
}

/* 后台样式 */
.backend {
    display: none;
    max-width: 1300px;
    margin: 2rem auto 4rem;
    padding: 0 1.5rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

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

.admin-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f1f5f9;
}

.admin-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-title {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    color: #0f172a;
    font-weight: 600;
}

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

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: auto;
    margin: 0;
}

.form-check-label {
    margin: 0;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    font-size: 0.9rem;
    transition: all 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.7rem 1.4rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #475569;
}

button:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 表格样式 */
.links-table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: 0.6rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.links-table th {
    text-align: left;
    padding: 1rem 1.2rem;
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
}

.links-table th:first-child {
    border-top-left-radius: 0.6rem;
}

.links-table th:last-child {
    border-top-right-radius: 0.6rem;
}

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

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

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

.links-table input, .links-table select, .links-table textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    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;
}

/* 移动后台检测时间提示到网址下面 */
.last-checked {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* 箭头控制样式 */
.arrow-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.arrow-btn {
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.arrow-btn:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.arrow-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 为箭头按钮所在的单元格设置一个类 */
.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.8rem;
    margin-top: 1.5rem;
}

.category-item {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    padding: 0.6rem 1.2rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #475569;
}

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

.category-item button:hover {
    transform: scale(1.1);
    box-shadow: none;
}

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

.page-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

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

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 2rem;
}

.admin-footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* 加载缓冲页样式 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* 整体上移25% */
    transform: translateY(-25%);
}

.loading-icon {
    width: 42px;
    height: 42px;
    background: url('favicon.ico') no-repeat center;
    background-size: contain;
    margin-bottom: 1.5rem;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

.loading-title {
    font-size: 1.2rem;
    color: #1e40af;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.loading-progress {
    width: 128px;
    height: 6px;
    background-color: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 1px 3px rgba(30, 64, 175, 0.3);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .frontend {
        margin: 1.5rem auto 3rem;
        padding: 0 1rem;
    }
    
    .nav-header {
        margin-bottom: 1.5rem;
    }
    
    .nav-header h1 {
        font-size: 1.5rem;
    }
    
    .logo-container img {
        width: 38px;
        height: 38px;
    }
    
    .nav-item {
        padding: 1rem;
        display: flex;
        flex-direction: row;
        align-items: center;
    }
    
    .nav-link {
        display: flex;
        align-items: center;
        flex-grow: 1;
    }
    
    .link-info {
        margin-left: 1.2rem;
        flex-grow: 1;
    }
    
    .link-status {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }
    
    .status-badge {
        margin-top: 0;
    }
    
    .links-table-container {
        margin-top: 1rem;
        border-radius: 0.6rem;
    }
    
    .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;
        color: #475569;
    }
    
    .pagination-container {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .admin-panel {
        padding: 1.5rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row .form-group {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    /* 优化后台手机端显示 */
    .mobile-form-layout {
        padding: 0.5rem;
    }
    
    .touch-friendly {
        min-height: 44px;
        font-size: 16px;
    }
    
    /* 移动端浮动添加按钮 */
    .floating-action-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #1e40af;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
        cursor: pointer;
        transition: all 0.3s ease;
        z-index: 100;
    }
    
    .floating-action-button i {
        font-size: 24px;
    }
    
    .floating-action-button:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(30, 64, 175, 0.4);
    }
}

/* 平板响应式调整 */
@media (min-width: 769px) and (max-width: 1024px) {
    .frontend {
        margin: 2rem auto 3rem;
    }
    
    .nav-item {
        padding: 1rem 1.2rem;
    }
    
    .link-logo {
        width: 40px;
        height: 40px;
    }
    
    .admin-panel {
        padding: 2rem;
    }
    
    /* 优化后台平板端显示 */
    .touch-friendly {
        min-height: 44px;
    }
}

/* 后台标签页样式 */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

.admin-tab {
    padding: 0.7rem 1.2rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-tab.active {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.admin-tab:hover:not(.active) {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.admin-tab-content {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
}

.admin-tab-content.active {
    display: block;
}

/* 自检设置卡片 */
.check-status-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 0.6rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.check-status-icon {
    font-size: 2rem;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.check-status-info {
    flex-grow: 1;
}

.check-status-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.check-status-info p {
    color: #64748b;
    font-size: 0.9rem;
}

/* 导入导出按钮组 */
.import-export-group {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-tab {
        width: 100%;
        justify-content: center;
    }
    
    .check-status-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .import-export-group {
        flex-direction: column;
        width: 100%;
    }
    
    .import-export-group button {
        width: 100%;
    }
}
