/* ============================================
   全局样式
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --blog: #667eea;
    --voice: #f093fb;
    --github: #4facfe;
    --other: #feca57;
    --success: #2ecc71;
    --danger: #e74c3c;
    --white: #ffffff;
    --gray: #f5f5f5;
    --dark: #333333;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   顶部导航
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.site-title {
    font-size: 2.8em;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 1px;
}

.site-subtitle {
    color: #666;
    font-size: 1.1em;
    opacity: 0.8;
}

/* ============================================
   固定链接区
   ============================================ */
.fixed-links-section {
    margin-bottom: 50px;
}

.fixed-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* ============================================
   链接卡片
   ============================================ */
.link-card {
    display: block;
    background: var(--white);
    padding: 35px 25px;
    border-radius: 20px;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.link-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(102, 126, 234, 0.3);
}

.link-card.blog::before { background: linear-gradient(90deg, var(--blog), #5568d3); }
.link-card.voice::before { background: linear-gradient(90deg, var(--voice), #e86cd9); }
.link-card.github::before { background: linear-gradient(90deg, var(--github), #00d2ff); }
.link-card.other::before { background: linear-gradient(90deg, var(--other), #ff9a3d); }

.card-icon {
    font-size: 3.5em;
    margin-bottom: 15px;
    display: block;
    transition: transform 0.3s ease;
}

.link-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.card-content h2 {
    font-size: 1.4em;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
}

.card-desc {
    color: #666;
    font-size: 0.95em;
    opacity: 0.9;
}

/* ============================================
   动态链接区
   ============================================ */
.dynamic-links-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray);
}

.section-title {
    font-size: 1.8em;
    color: var(--primary);
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--gray);
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
}

.filter-select:hover {
    border-color: var(--primary);
}

/* ============================================
   链接网格
   ============================================ */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    min-height: 200px;
}

/* ============================================
   加载状态
   ============================================ */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   分页
   ============================================ */
.pagination-container {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid var(--gray);
    background: var(--white);
    color: var(--dark);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    font-weight: bold;
}

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

/* ============================================
   管理员按钮
   ============================================ */
.admin-btn-container {
    text-align: center;
    margin-top: 40px;
}

.admin-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid var(--white);
    color: var(--white);
    padding: 15px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.admin-btn:hover {
    background: var(--white);
    color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.admin-btn span {
    font-size: 1.3em;
    margin-right: 8px;
}

/* ============================================
   管理员面板
   ============================================ */
.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.admin-panel.active {
    display: flex;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
    backdrop-filter: blur(5px);
}

.overlay.active {
    display: block;
}

.admin-panel-content {
    background: var(--white);
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.admin-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: var(--white);
}

.admin-header h2 {
    font-size: 1.6em;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ============================================
   登录表单
   ============================================ */
.admin-login {
    padding: 40px 30px;
    text-align: center;
}

.login-box {
    max-width: 400px;
    margin: 0 auto;
}

.login-box h3 {
    margin-bottom: 30px;
    color: var(--primary);
    font-size: 1.5em;
}

#login-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--gray);
    border-radius: 12px;
    font-size: 1em;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

#login-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: var(--white);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ============================================
   管理功能
   ============================================ */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray);
    background: var(--gray);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.tab-btn.active {
    background: var(--white);
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.tab-contents {
    padding: 30px;
}

.tab-content {
    display: none;
}

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

/* ============================================
   表单样式
   ============================================ */
.admin-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray);
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-success {
    background: linear-gradient(to right, var(--success), #27ae60);
    color: var(--white);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

/* ============================================
   链接列表
   ============================================ */
.admin-links-list {
    display: grid;
    gap: 15px;
}

.link-item {
    background: var(--gray);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
}

.link-item.blog { border-left-color: var(--blog); }
.link-item.voice { border-left-color: var(--voice); }
.link-item.github { border-left-color: var(--github); }
.link-item.other { border-left-color: var(--other); }

.link-info {
    flex: 1;
}

.link-info h4 {
    margin-bottom: 5px;
    font-size: 1.1em;
    color: var(--dark);
}

.link-info p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 3px;
}

.link-actions {
    display: flex;
    gap: 10px;
}

.btn-delete {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.btn-delete:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* ============================================
   统计信息
   ============================================ */
.stats-content {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--gray);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.stat-icon {
    font-size: 2.5em;
    width: 60px;
    text-align: center;
}

.stat-label {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary);
}

.btn-logout {
    background: linear-gradient(to right, var(--danger), #c0392b);
    color: var(--white);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .site-title {
        font-size: 2em;
    }
    
    .fixed-links-grid {
        grid-template-columns: 1fr;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-panel-content {
        width: 95%;
        max-width: 95%;
    }
    
    .tab-btn {
        font-size: 1.1em;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 20px 15px;
        margin-bottom: 30px;
    }
    
    .site-title {
        font-size: 1.6em;
    }
    
    .admin-btn {
        padding: 12px 30px;
        font-size: 1em;
    }
}