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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* ==================== 左侧菜单栏 - 玻璃拟态 ==================== */
.sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    transition: all 0.3s ease;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .menu-title span,
.sidebar.collapsed .user-center span {
    display: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h2 {
    color: white;
    font-size: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#toggleSidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.3s;
}

.menu-title:hover {
    background: rgba(255, 255, 255, 0.25);
}

.menu-title .arrow {
    margin-left: auto;
    transition: transform 0.3s;
}

.menu-title.collapsed .arrow {
    transform: rotate(-90deg);
}

.menu-list {
    list-style: none;
    padding-left: 10px;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.3s;
}

.menu-list.collapsed {
    max-height: 0;
}

.menu-list li {
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 6px;
    transition: background 0.3s;
}

.menu-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-list a {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.user-center {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
}

.user-center button {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.user-center button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
    transition: margin-left 0.3s;
}

.sidebar.collapsed + .main-content {
    margin-left: 60px;
}

/* ==================== 头部区域 ==================== */
.header-section {
    text-align: center;
    margin-bottom: 40px;
}

.site-title {
    font-size: 48px;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.site-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
}

/* ==================== 搜索栏 - 玻璃拟态 ==================== */
.search-section {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 30px;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto 25px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 18px;
}

.search-box input {
    width: 100%;
    padding: 18px 20px 18px 55px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.search-box input:focus {
    background: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==================== 分类按钮 ==================== */
.category-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-buttons button {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.category-buttons button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.category-buttons button.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==================== 网站卡片网格 - 整卡可点击 ==================== */
.website-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);  /* 每行10个 */
    gap: 12px;
    padding: 0 10px;
}

/* 卡片容器 - 整卡可点击 */
.website-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 5 / 3;
    cursor: pointer;  /* 手型光标 */
    font-size: 11px;
}

.website-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* 卡片内容区 */
.card-content {
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: none;  /* 防止内部元素阻止卡片点击 */
}

/* 头部区域 */
.card-header {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* 网站Logo */
.website-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* 网站信息 */
.card-info {
    flex: 1;
    min-width: 0;
}

.website-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.website-description {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

/* 分类标签和访问量 */
.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    flex-shrink: 0;
}

.category-tag {
    padding: 2px 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
}

.visit-count {
    font-size: 9px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ==================== 星标收藏按钮 ==================== */
/* ==================== 星标收藏按钮 ==================== */
/* ==================== 星标收藏按钮 - 最终修复版 ==================== */
.star-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    display: flex !important; /* 强制显示 */
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    pointer-events: auto; /* 确保可点击 */
}

.star-btn:hover {
    background: white;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.star-btn.active {
    background: #fff3cd;
    color: #ffc107;
}

/* 删除所有其他 .star-btn 定义和 ::before 伪元素 */
/* ==================== 管理员操作按钮 ==================== */
.admin-actions {
    position: absolute;
    top: 4px;
    left: 4px;
    display: flex;
    gap: 3px;
    z-index: 10;
}

.admin-edit, .admin-delete {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 10px;
    padding: 0;
    color: white;
}

.admin-edit { background: #4299e1; }
.admin-edit:hover { background: #3182ce; transform: scale(1.1); }

.admin-delete { background: #e53e3e; }
.admin-delete:hover { background: #c53030; transform: scale(1.1); }

/* ==================== 响应式布局 ==================== */
@media (max-width: 1600px) {
    .website-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (max-width: 1300px) {
    .website-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 1024px) {
    .website-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .website-grid { grid-template-columns: repeat(3, 1fr); }
    .main-content { margin-left: 0; padding: 20px; }
}

@media (max-width: 576px) {
    .website-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .website-card { aspect-ratio: 2 / 3; }
}

@media (max-width: 360px) {
    .website-grid { grid-template-columns: 1fr; }
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    border-color: #667eea;
    outline: none;
}

.modal-content button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ==================== 侧边栏收缩状态 - 布局修复 ==================== */

.sidebar.collapsed .sidebar-header {
    flex-direction: column; /* 垂直排列 */
    align-items: center;    /* 水平居中 */
    padding: 15px 0;        /* 上下间距 */
    gap: 15px;              /* 图标与按钮间距 */
}

.sidebar.collapsed .sidebar-header h2 {
    font-size: 24px;        /* 只显示图标，放大 */
    margin: 0;
}

.sidebar.collapsed .sidebar-header h2 span {
    display: none;          /* 隐藏文字 */
}

.sidebar.collapsed #toggleSidebar {
    margin: 0;              /* 移除外边距 */
    font-size: 18px;        /* 调整按钮大小 */
}

/* 菜单项居中 */
.sidebar.collapsed .menu-title {
    justify-content: center; /* 图标居中 */
    padding: 15px 0;         /* 上下间距 */
}

.sidebar.collapsed .menu-list {
    padding: 0;              /* 移除内边距 */
}

.sidebar.collapsed .menu-list li {
    display: flex;           /* 强制居中 */
    justify-content: center;
    padding: 10px 0;         /* 上下间距 */
}

.sidebar.collapsed .menu-list a {
    justify-content: center; /* 图标居中 */
}

/* 用户中心按钮居中 */
.sidebar.collapsed .user-center {
    left: 0;
    right: 0;
    display: flex;           /* 改为flex布局 */
    flex-direction: column;  /* 垂直排列 */
    align-items: center;     /* 水平居中 */
    gap: 10px;               /* 按钮间距 */
    padding: 0 10px;         /* 左右内边距 */
}

.sidebar.collapsed .user-center button {
    width: 40px;             /* 固定宽度 */
    height: 40px;            /* 固定高度 */
    border-radius: 50%;      /* 圆形按钮 */
    padding: 0;              /* 移除内边距 */
    display: flex;           /* 图标居中 */
    align-items: center;
    justify-content: center;
    font-size: 18px;         /* 放大图标 */
}

.sidebar.collapsed .user-center span {
    display: none;           /* 隐藏文字 */
}

/* 隐藏箭头图标 */
.sidebar.collapsed .menu-title .arrow {
    display: none;
}

/* 为所有元素添加平滑过渡 */
.sidebar .sidebar-header,
.sidebar .menu-title,
.sidebar .menu-list a,
.sidebar .user-center button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 图标缩放动画 */
.sidebar.collapsed #toggleSidebar i {
    transform: rotate(180deg); /* 旋转图标表示状态 */
}

/* ==================== 当前分类提示横幅 ==================== */
.current-category-banner {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 12px;
    margin: 0 30px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.clear-filter-btn {
    margin-left: auto;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .current-category-banner {
        margin: 0 20px 20px;
        font-size: 14px;
        padding: 12px 20px;
    }
}


/* ==================== 分类区块样式 ==================== */
.category-section {
    margin-bottom: 50px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.category-title {
    font-size: 28px;
    color: white;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.category-count {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: normal;
}

/* 隐藏空分类区块 */
.category-section.hidden {
    display: none !important;
}

/* 筛选状态过渡动画 */
.website-card {
    transition: all 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.website-card[style*="display: none"] {
    opacity: 0;
    transform: scale(0.9);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .category-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    .category-section {
        margin-bottom: 40px;
    }
}
/* ==================== 双搜索框左右并排 ==================== */
/* ==================== 双搜索框并排布局 ==================== */


