/* 基础样式 */
:root {
    --primary: #4f46e5;
    --bg: #f6f7ff;
    --text: #1f2937;
    --card: #ffffff;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* 卡片样式 */
.site-card {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.drag-handle {
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: grab;
    padding: 0.5rem;
    color: #6b7280;
}

.site-link {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    padding-right: 2rem;
}

.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
}

.site-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.site-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* 加载屏幕 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* 暗色模式 */
.dark {
    --bg: #1a1c2e;
    --text: #f3f4f6;
    --card: #1f2937;
}

.dark .site-card {
    background: var(--card);
}

.dark .site-info p {
    color: #9ca3af;
}

.dark .drag-handle {
    color: #9ca3af;
}

.dark .loading-screen {
    background: var(--bg);
}

/* 现代化全局样式 - 简化版 */
:root {
    --primary-color: #667eea;
    --primary-hover: #5a67d8;
    --primary-light: rgba(102, 126, 234, 0.1);
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-glass: rgba(255, 255, 255, 0.25);
    --bg-secondary: #f1f5f9;
    --text-primary: #2d3748;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: rgba(203, 213, 225, 0.6);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 极简化过渡 - 只保留必要的 */
.loading-screen,
.admin-btn,
.btn-primary {
    transition: all 0.2s ease;
}

/* Screen Reader Only - 无障碍访问 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* 卡片样式 */
.site-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.drag-handle {
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: grab;
    padding: 0.5rem;
    color: var(--text-secondary);
    z-index: 10;
    background: var(--card-bg);
    border-radius: 4px;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.site-link {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    padding-right: 2rem;
}

/* 网站图标容器 */
.site-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    gap: 4px;
}

.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.site-info {
    flex: 1;
}

.site-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.site-info p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 现代化暗色模式 */
.dark {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(129, 140, 248, 0.15);
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-glass: rgba(30, 41, 59, 0.3);
    --bg-secondary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: rgba(71, 85, 105, 0.6);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark body {
    background: var(--bg-gradient);
    background-attachment: fixed;
}

/* 加载页面样式 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* 加载页面样式 */
.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-logo {
    width: auto;
    height: 120px;
    margin-bottom: 2rem;
    object-fit: contain;
    animation: pulse 2s infinite ease-in-out;
}

.loading-text {
    margin-top: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 500;
    animation: fadeInOut 2s infinite ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* 加载进度条样式 */
.loading-progress {
    width: 300px;
    max-width: 90vw;
}

.loading-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #60a5fa);
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

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

.loading-details {
    text-align: center;
    color: var(--primary-color);
    font-size: 0.875rem;
    min-height: 1.25rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* 现代化卡片样式 */
.category-card {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 1.25rem;
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.5;
}

.category-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-light);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-card h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

/* 链接项样式 */
.link-item {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    padding: 1rem;
    display: block;
    text-decoration: none;
    cursor: default;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.link-item:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* 拖拽相关样式 */
.sortable-ghost {
    opacity: 0.4;
    background: rgba(79, 70, 229, 0.1);
}

.sortable-chosen {
    transform: rotate(5deg);
}

.sortable-drag {
    transform: rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 展开按钮样式 */
.toggle-btn {
    background: rgba(243, 244, 246, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: rgba(229, 231, 235, 0.9);
    color: var(--text-primary);
}

.toggle-btn i {
    transition: transform 0.3s ease;
}

.links-container.expanded .toggle-btn i {
    transform: rotate(180deg);
}

/* 点击统计样式 */
.click-count {
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 500;
}

/* 展开内容动画 */
.expanded-content {
    position: absolute;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 10;
    padding: 1rem;
    margin-top: 0.5rem;
}

/* 展开区域样式优化 */
.expanded-links {
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 8px;
    padding: 12px;
    background: rgba(249, 250, 251, 0.5);
    backdrop-filter: blur(5px);
}

/* 简化搜索引擎按钮样式 */
.search-engine-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
}

.search-engine-btn.active {
    background: var(--primary-color);
    color: white;
}

.search-engine-btn i {
    font-size: 1rem;
}

.search-engine-btn span {
    font-size: 0.9rem;
}

/* 搜索引擎容器样式 */
.search-engine-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 9999px;
    padding: 0.25rem;
    display: inline-flex;
    margin-bottom: 0.25rem;
}

/* 搜索框容器样式 */
.search-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1rem;
    padding: 0.25rem;
    width: 100%;
    max-width: 100%;
    margin-top: -0.25rem;
}

#searchInput {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    width: 100%;
    padding: 0.75rem 1rem;
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin: 0.25rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* 现代化管理按钮样式 */
.admin-btn {
    background: var(--primary-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.admin-btn:hover {
    background: var(--primary-hover);
}

/* 常用网站卡片样式 */
.frequent-sites-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    border-radius: 1.25rem;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
}

.frequent-sites-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fbbf24, transparent);
    opacity: 0.6;
}

.frequent-sites-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.frequent-sites-card h2 i {
    color: #fbbf24;
    font-size: 1.375rem;
}

/* 常用网站网格 - 单行固定布局 */
.frequent-sites-grid {
    display: flex;
    overflow: hidden;
    gap: 0.75rem;
    padding: 0.25rem 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    position: relative;
}

/* 简化常用网站项样式 */
.frequent-site-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    flex: 0 0 160px;
    width: 160px;
    text-align: left;
    gap: 0.5rem;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* 常用网站图标容器 */
.frequent-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.frequent-site-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    object-fit: cover;
}

.frequent-site-item .text-sm {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.frequent-site-item .text-xs {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 响应式优化 - 移动端自适应优化 */
@media (max-width: 640px) {
    .frequent-sites-grid {
        gap: 0.5rem;
    }
    
    .frequent-site-item {
        flex: 0 0 160px;
        width: 160px;
        padding: 0.4rem 0.6rem;
    }
    
    .frequent-site-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    .frequent-site-item .text-sm {
        font-size: 0.7rem;
        line-height: 1.1;
    }
    
    .frequent-site-item .text-xs {
        font-size: 0.6rem;
    }
}

/* 现代化页脚样式 */
footer {
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    border-radius: 2rem 2rem 0 0;
    margin-top: 4rem;
    padding: 2rem 0;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.5;
}

footer .text-center {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

footer img {
    filter: grayscale(20%);
    border-radius: 0.5rem;
}

footer a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    position: relative;
}

footer a:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

footer .text-lg {
    color: var(--text-primary);
    font-weight: 600;
}

footer .text-sm {
    color: var(--text-secondary);
}

footer .text-xs {
    color: var(--text-muted);
}

/* 响应式页脚 */
@media (max-width: 768px) {
    footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    footer .flex {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 暗黑模式切换按钮 */
#darkModeToggle {
    background: #4f46e5;
}

#darkModeToggle:hover {
    background: #4338ca;
}

.dark #darkModeToggle:hover {
    background: #4338ca;
}

/* 暗黑模式下的卡片样式 */
.dark .category-card {
    background: var(--card-bg);
    border: 1px solid rgba(55, 65, 81, 0.3);
}

.dark .category-card h2 {
    color: var(--text-primary);
    border-bottom-color: rgba(79, 70, 229, 0.3);
}

/* 暗黑模式下的链接项样式 */
.dark .link-item {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.4);
    color: var(--text-primary);
}

.dark .link-item:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(71, 85, 105, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.dark .frequent-sites-card {
    background: var(--card-bg);
    border: 1px solid rgba(55, 65, 81, 0.3);
}

.dark .frequent-sites-card h2 {
    color: var(--text-primary);
}

.dark .frequent-site-item {
    color: var(--text-primary);
}

.dark .frequent-site-item .text-sm {
    color: var(--text-primary);
}

.dark .frequent-site-item .text-xs {
    color: #60a5fa;
}

.dark .toggle-btn {
    background: rgba(75, 85, 99, 0.8);
    border-color: rgba(107, 114, 128, 0.3);
    color: var(--text-secondary);
}

.dark .toggle-btn:hover {
    background: rgba(55, 65, 81, 0.9);
    color: var(--text-primary);
}

.dark .search-container {
    background: rgba(31, 41, 55, 0.95);
    border: 2px solid rgba(55, 65, 81, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark #searchInput {
    color: var(--text-primary);
}

.dark #searchInput::placeholder {
    color: var(--text-secondary);
}

.dark .search-engine-btn {
    color: var(--text-secondary);
}

.dark .search-engine-btn.active {
    background: var(--primary-color);
    color: white;
}

.dark .btn-primary {
    background: var(--primary-color);
}

.dark .btn-primary:hover {
    background: var(--primary-hover);
}

/* 搜索引擎容器样式 */
.search-engine-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 9999px;
    padding: 0.25rem;
    display: inline-flex;
    margin-bottom: 1.5rem;
}

.dark .search-engine-container {
    background: var(--card-bg);
    border: var(--glass-border);
}

/* 网站图标样式 */
.site-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.site-icon-small {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.7);
}

/* 回到顶部按钮样式 */
#backToTop {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 页面滚动优化 */
html {
    scroll-behavior: smooth;
}

/* 导航内容区域优化 */
#navigationContent {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* 分类卡片内的链接网格布局 */
.category-card .grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* 分类卡片间距优化 */
.category-card {
    margin-bottom: 1.5rem;
}

/* 链接项优化 */
.link-item {
    margin-bottom: 0.5rem;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .category-card {
        margin-bottom: 1rem;
    }
    
    #backToTop {
        width: 44px;
        height: 44px;
    }
    
    .admin-btn span {
        display: none;
    }
    
    .admin-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }
}

/* 响应式网格优化 */
@media (max-width: 1024px) {
    #navigationContent {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #navigationContent {
        grid-template-columns: 1fr;
    }
    
    .category-card .grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    #navigationContent {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 文本截断优化 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toast 提示样式 */
.toast {
    z-index: 1000;
}

/* 重置按钮样式 */
.reset-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: transparent;
    border: 1px solid currentColor;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

/* 链接项布局优化 */
.link-item .flex {
    align-items: center;
    justify-content: space-between;
}

/* 确保拖拽手柄始终可见 */
.sortable-container .link-item {
    position: relative;
}

/* 图标容器样式 */
.icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    padding: 2px;
}

/* 图标加载失败备用样式 */
.site-icon[src=""], 
.site-icon:not([src]),
img.site-icon:not([src*="."]) {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 1.5rem;
    position: relative;
}

.site-icon[src=""]::after, 
.site-icon:not([src])::after,
img.site-icon:not([src*="."])::after {
    content: "🌐";
    font-size: 1.5rem;
}

/* 链接区域保持正常光标 */
.link-item a {
    cursor: pointer;
}

/* 链接容器样式 */
.links-container {
    position: relative;
    transition: all 0.3s ease;
}

/* 隐藏的链接项 */
.links-container .hidden-link {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 展开状态下显示所有链接 */
.links-container.expanded .hidden-link {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 展开状态下的容器样式 */
.links-container.expanded {
    background: rgba(249, 250, 251, 0.5);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    backdrop-filter: blur(5px);
}

/* 拖拽时的视觉反馈 */
.links-container.expanded .sortable-ghost {
    background: rgba(79, 70, 229, 0.1);
    border: 2px dashed rgba(79, 70, 229, 0.3);
}

.site-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.drag-handle {
    position: absolute;
    right: 1rem;
    top: 1rem;
    cursor: grab;
    padding: 0.5rem;
    color: var(--text-secondary);
    z-index: 10;
    background: var(--card-bg);
    border-radius: 4px;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.site-link {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    padding-right: 2rem;
}

/* 暗黑模式下的图标和其他元素 */
.dark .site-icon {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .site-icon-small {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark .icon-container {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
}

.dark .reset-btn {
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.dark .reset-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.dark .links-container.expanded {
    background: rgba(31, 41, 55, 0.5);
    border-color: rgba(55, 65, 81, 0.5);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(79, 70, 229, 0));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(79, 70, 229, 0.3));
    }
}

/* 响应式优化 */
@media (max-width: 640px) {
    .search-container {
        padding: 0.15rem;
    }
    
    #searchInput {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
} 