:root {
  --primary-color: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary-color: #6b7280;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --light-color: #f9fafb;
  --dark-color: #1f2937;
  --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 20px;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #374151;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* 现代玻璃态头部 */
header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  color: #1f2937;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1::before {
  content: '🚀';
  margin-right: 12px;
  font-size: 1.8rem;
  background: none;
  -webkit-text-fill-color: initial;
}

.tabs {
  display: flex;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  position: relative;
}

.tab.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.tab:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

.tab a {
  color: white;
  text-decoration: none;
  display: block;
}

main {
  padding: 40px 0;
  flex: 1;
  min-height: calc(100vh - 80px);
}

.tab-content {
  display: none;
}

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

/* 现代化分类标签 - 优化版本 */
.categories {
  margin-bottom: 40px;
  position: relative;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.category-tab {
  padding: 12px 24px;
  background: transparent;
  backdrop-filter: blur(10px);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  font-size: 0.95rem;
  color: #6b7280;
  z-index: 1;
}

/* 选中状态的背景层 */
.category-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 50px;
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
  transform: scale(0.95);
}

/* 悬停状态的背景层 */
.category-tab::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50px;
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
}

.category-tab span {
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

/* 选中状态 - 完全显示 */
.category-tab.active {
  color: white;
  border-color: transparent;
  transform: none;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.category-tab.active::before {
  opacity: 1;
  transform: scale(1);
}

.category-tab.active span {
  color: white;
  font-weight: 700;
}

/* 悬停状态 */
.category-tab:not(.active):hover {
  color: var(--primary-color);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.category-tab:not(.active):hover::after {
  opacity: 1;
}

/* 确保标签内容完全可见 */
.category-tab span {
  display: inline-block;
  padding: 2px 0;
  white-space: nowrap;
}

/* 为特殊分类添加颜色标识 */
.category-tab[data-category="常用"]::before {
  background: linear-gradient(135deg, #10b981, #059669);
}

.category-tab[data-category="工作"]::before {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.category-tab[data-category="学习"]::before {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.category-tab[data-category="娱乐"]::before {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.category-tab[data-category="工具"]::before {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.category-tab[data-category="自己"]::before {
  background: linear-gradient(135deg, #ec4899, #db2777);
}

/* 现代化网格布局 - 浮动效果 */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 30px;
  padding: 20px 0;
}

.site-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  height: 100%;
  cursor: pointer;
}

.site-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}

.site-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.site-card:hover::before {
  transform: scaleX(1);
}

.site-card:hover::after {
  opacity: 1;
}

/* 卡片内容布局 - 优化 */
.site-card-content {
  display: flex;
  align-items: flex-start;
  margin-bottom: 24px;
  flex: 1;
  position: relative;
  z-index: 2;
}

.site-icon {
  width: 70px;
  height: 70px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  font-size: 1.8rem;
  color: white;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.site-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-card:hover .site-icon {
  transform: scale(1.1) rotate(8deg);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.site-card:hover .site-icon::before {
  opacity: 1;
}

.site-info {
  flex: 1;
  min-width: 0;
}

.site-name {
  font-weight: 800;
  margin-bottom: 10px;
  font-size: 1.3rem;
  color: #1f2937;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.025em;
}

.site-desc {
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 现代化分类标签 - 固定在右上角 */
.site-category {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #4f46e5;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.1);
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 3;
}

.site-card:hover .site-category {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* 现代化访问按钮 */
.site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  text-align: center;
  transition: var(--transition);
  font-weight: 700;
  position: relative;
  overflow: hidden;
  z-index: 2;
  width: 100%;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.site-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.site-link::after {
  content: '↗';
  margin-left: 8px;
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.site-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.site-link:hover::before {
  opacity: 1;
}

.site-link:hover::after {
  transform: translate(3px, -3px);
}

/* 后台管理样式 */
.admin-form {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--card-shadow);
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.admin-form h2 {
  margin-bottom: 24px;
  color: #1f2937;
  font-weight: 700;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
}

.admin-form h2::before {
  content: '✎';
  margin-right: 10px;
  font-size: 1.3rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
  background-color: #f9fafb;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background-color: white;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: var(--transition);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-color), #4b5563);
  color: white;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

.sites-list {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.site-item {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: var(--transition);
}

.site-item:hover {
  background-color: #f9fafb;
}

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

.site-info {
  flex: 1;
}

.site-info h3 {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.site-info p {
  color: var(--secondary-color);
  font-size: 0.9rem;
}

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

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--secondary-color);
  grid-column: 1 / -1;
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-state h3 {
  margin-bottom: 12px;
  color: #6b7280;
  font-size: 1.5rem;
  font-weight: 700;
}

/* 通知样式优化 */
.notification {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateX(150%);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification::before {
  content: '✓';
  margin-right: 10px;
  font-weight: bold;
  font-size: 1.1rem;
}

.notification.show {
  transform: translateX(0);
}

.notification.error {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.notification.error::before {
  content: '✕';
}

.category-management {
  background-color: white;
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--card-shadow);
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.category-management h2 {
  margin-bottom: 20px;
  color: #1f2937;
  font-weight: 700;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
}

.category-management h2::before {
  content: '📁';
  margin-right: 10px;
  font-size: 1.3rem;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary-dark);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
  transition: var(--transition);
}

.category-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
}

.category-tag .delete-category {
  margin-left: 8px;
  cursor: pointer;
  color: var(--danger-color);
  font-weight: bold;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.category-tag .delete-category:hover {
  background-color: rgba(239, 68, 68, 0.1);
  transform: scale(1.1);
}

/* 加载动画优化 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loader {
  width: 70px;
  height: 70px;
  border: 4px solid #e0e7ff;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 20px;
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.1rem;
}

/* 骨架屏优化 */
.skeleton-card {
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  padding: 30px;
  height: 200px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.skeleton-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* 响应式设计优化 */
@media (max-width: 1200px) {
  .sites-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }
  
  .sites-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .site-card {
    padding: 24px;
  }
  
  .site-card-content {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .site-icon {
    width: 60px;
    height: 60px;
    margin-right: 18px;
    font-size: 1.6rem;
  }
  
  .category-tabs {
    gap: 6px;
    padding: 6px;
    border-radius: 40px;
  }
  
  .category-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    border-width: 1px;
  }
  
  .category-tab span {
    padding: 1px 0;
  }
  
  h1 {
    font-size: 1.6rem;
  }
  
  /* 后台响应式优化 */
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .tabs {
    margin-top: 15px;
    width: 100%;
  }
  
  .tab {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .admin-form,
  .category-management {
    padding: 20px;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn {
    width: 100%;
    padding: 14px 20px;
  }
  
  .site-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }
  
  .site-actions {
    margin-top: 15px;
    width: 100%;
    justify-content: space-between;
  }
  
  .site-actions .btn {
    flex: 1;
    margin: 0 5px;
  }
  
  .category-management .form-group > div {
    flex-direction: column;
    gap: 10px;
  }
  
  .category-management .form-group input {
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .site-card-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .site-icon {
    margin-right: 0;
    margin-bottom: 16px;
  }
  
  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 8px 12px;
    border-radius: 40px;
  }
  
  .category-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 0.8rem;
  }
  
  /* 隐藏滚动条但保持滚动功能 */
  .category-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .category-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  h1 {
    font-size: 1.4rem;
  }
  
  .site-name {
    font-size: 1.2rem;
  }
  
  .admin-form h2,
  .category-management h2 {
    font-size: 1.3rem;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-dark), #3730a3);
}

/* 添加浮动动画 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.site-card:hover .site-icon {
  animation: float 2s ease-in-out infinite;
}

/* 添加微妙的动画效果 */
@keyframes tabPulse {
  0% {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.6);
  }
  100% {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  }
}

.category-tab.active {
  animation: tabPulse 2s ease-in-out infinite;
}

/* 确保选中状态不会被遮挡 */
.category-tab.active {
  z-index: 2;
}