* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #2d3748;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    text-align: center;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.site-description {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 搜索框 */
.search-box {
    position: relative;
    max-width: 500px;
    margin: 2rem auto;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box i {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

/* 分类导航 */
.categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.category-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-btn:hover,
.category-btn.active {
    background-color: var(--category-color, var(--primary-color));
    color: white;
    border-color: var(--category-color, var(--primary-color));
}

/* 网站网格 - 更紧凑的布局 */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* 缩小最小宽度 */
    gap: 1rem; /* 缩小间距 */
    margin-bottom: 2rem;
}

/* 网站卡片 - 更紧凑的尺寸 */
.site-card {
    background: var(--card-bg);
    border-radius: 10px; /* 稍微缩小圆角 */
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 140px; /* 固定高度，更紧凑 */
}

.site-card:hover {
    transform: translateY(-3px); /* 减小悬停移动距离 */
    box-shadow: 0 8px 15px -5px rgba(0, 0, 0, 0.1);
}

.site-link {
    display: block;
    padding: 1rem; /* 缩小内边距 */
    text-decoration: none;
    color: inherit;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 网站图标 - 更小尺寸 */
.site-icon {
    width: 48px;/* 缩小图标容器 */
    height: 48px;
    border-radius: 12px;/* 缩小圆角 */
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;/* 缩小间距 */
    position: relative;
}

.site-icon img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.icon-fallback {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.site-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.site-info p {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.4;
}

.site-category {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 管理入口 */
.admin-entry {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
}

.admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.admin-btn:hover {
    transform: scale(1.1);
    background: #2980b9;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .site-title {
        font-size: 2rem;
    }
    
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .categories {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}
/* 空状态样式 */
.no-sites {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.no-sites h3 {
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.no-sites .btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.no-sites .btn:hover {
    background: #2980b9;
}
/* 操作消息样式 */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
/* 编辑按钮样式 */
.btn-edit {
    background: #f39c12;
}

.btn-edit:hover {
    background: #e67e22;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* 表单在模态框中的样式 */
.modal-content .form-grid {
    padding: 2rem;
}

.modal-content .form-group {
    margin-bottom: 1.5rem;
}

/* 网站图标样式优化 */
.site-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.site-icon-img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.icon-fallback {
    display: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.icon-fallback.show {
    display: flex;
}

/* 图标加载状态 */
.site-icon.loading .site-icon-img {
    opacity: 0.5;
}

.site-icon.loading .icon-fallback {
    display: none;
}

/* 图标悬停效果 */
.site-card:hover .site-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}