/* ==================== CSS Variables ==================== */
:root {
    /* Light mode colors */
    --bg-primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-white: white;
    --text-primary: #333;
    --text-secondary: #555;
    --text-tertiary: #666;
    --text-muted: #777;
    --text-light: #888;
    --border-color: #f0f0f0;
    --border-input: #e0e0e0;
    --shadow-light: rgba(0,0,0,0.1);
    --shadow-medium: rgba(0,0,0,0.2);
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-color: #667eea;
    --accent-hover: rgba(102, 126, 234, 0.1);
    --accent-hover-strong: rgba(102, 126, 234, 0.15);
    --stat-bg: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));

    /* Logo colors - 柔和的紫蓝色 */
    --logo-color-1: #667eea;
    --logo-color-2: #764ba2;
    --logo-icon-main: #667eea;
    --logo-icon-light: #9aa5f5;
}

/* Dark mode colors */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #2d1b4e 100%);
    --bg-card: rgba(30, 35, 45, 0.95);
    --bg-white: #1e2330;
    --text-primary: #e4e6eb;
    --text-secondary: #b8bac0;
    --text-tertiary: #9ca3af;
    --text-muted: #8b92a0;
    --text-light: #6b7280;
    --border-color: #2d3340;
    --border-input: #3d4350;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-medium: rgba(0,0,0,0.5);
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --accent-color: #7c3aed;
    --accent-hover: rgba(124, 58, 237, 0.15);
    --accent-hover-strong: rgba(124, 58, 237, 0.25);
    --stat-bg: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.15));

    /* Logo colors - 柔和的紫色 */
    --logo-color-1: #8b7beb;
    --logo-color-2: #b68ff7;
    --logo-icon-main: #8b7beb;
    --logo-icon-light: #c4b5fd;
}

/* Cherry Blossom - 樱花粉 */
[data-theme="cherry"] {
    --bg-primary: linear-gradient(135deg, #ffeef8 0%, #ffc2e2 50%, #ff9fd5 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-white: white;
    --text-primary: #4a1942;
    --text-secondary: #6b2e5f;
    --text-tertiary: #8b4578;
    --text-muted: #a65c91;
    --text-light: #c273aa;
    --border-color: #ffe8f5;
    --border-input: #ffd4ec;
    --shadow-light: rgba(255, 105, 180, 0.1);
    --shadow-medium: rgba(255, 105, 180, 0.2);
    --accent-gradient: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    --accent-color: #ff69b4;
    --accent-hover: rgba(255, 105, 180, 0.1);
    --accent-hover-strong: rgba(255, 105, 180, 0.15);
    --stat-bg: linear-gradient(135deg, rgba(255, 105, 180, 0.1), rgba(255, 20, 147, 0.1));

    /* Logo colors - 柔和的粉色 */
    --logo-color-1: #ff8fc7;
    --logo-color-2: #ffa8d8;
    --logo-icon-main: #ff8fc7;
    --logo-icon-light: #ffc4e8;
}

/* Ocean Blue - 海洋蓝 */
[data-theme="ocean"] {
    --bg-primary: linear-gradient(135deg, #1a365d 0%, #2563eb 50%, #3b82f6 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-white: white;
    --text-primary: #1e3a8a;
    --text-secondary: #1e40af;
    --text-tertiary: #3b82f6;
    --text-muted: #60a5fa;
    --text-light: #93c5fd;
    --border-color: #dbeafe;
    --border-input: #bfdbfe;
    --shadow-light: rgba(37, 99, 235, 0.1);
    --shadow-medium: rgba(37, 99, 235, 0.2);
    --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --accent-color: #0ea5e9;
    --accent-hover: rgba(14, 165, 233, 0.1);
    --accent-hover-strong: rgba(14, 165, 233, 0.15);
    --stat-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(6, 182, 212, 0.1));

    /* Logo colors - 柔和的蓝色 */
    --logo-color-1: #3b9ff6;
    --logo-color-2: #14b8d4;
    --logo-icon-main: #3b9ff6;
    --logo-icon-light: #7cc5fa;
}

/* Forest Green - 森林绿 */
[data-theme="forest"] {
    --bg-primary: linear-gradient(135deg, #14532d 0%, #15803d 50%, #16a34a 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-white: white;
    --text-primary: #14532d;
    --text-secondary: #15803d;
    --text-tertiary: #16a34a;
    --text-muted: #22c55e;
    --text-light: #4ade80;
    --border-color: #dcfce7;
    --border-input: #bbf7d0;
    --shadow-light: rgba(34, 197, 94, 0.1);
    --shadow-medium: rgba(34, 197, 94, 0.2);
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --accent-color: #10b981;
    --accent-hover: rgba(16, 185, 129, 0.1);
    --accent-hover-strong: rgba(16, 185, 129, 0.15);
    --stat-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));

    /* Logo colors - 柔和的绿色（比亮绿色柔和） */
    --logo-color-1: #4ade80;
    --logo-color-2: #22c55e;
    --logo-icon-main: #4ade80;
    --logo-icon-light: #86efac;
}

/* Sunset Orange - 日落橙 */
[data-theme="sunset"] {
    --bg-primary: linear-gradient(135deg, #7c2d12 0%, #ea580c 50%, #f97316 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-white: white;
    --text-primary: #7c2d12;
    --text-secondary: #9a3412;
    --text-tertiary: #c2410c;
    --text-muted: #ea580c;
    --text-light: #f97316;
    --border-color: #ffedd5;
    --border-input: #fed7aa;
    --shadow-light: rgba(249, 115, 22, 0.1);
    --shadow-medium: rgba(249, 115, 22, 0.2);
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --accent-color: #f59e0b;
    --accent-hover: rgba(245, 158, 11, 0.1);
    --accent-hover-strong: rgba(245, 158, 11, 0.15);
    --stat-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));

    /* Logo colors - 柔和的橙红色 */
    --logo-color-1: #fb923c;
    --logo-color-2: #f87171;
    --logo-icon-main: #fb923c;
    --logo-icon-light: #fdba74;
}

/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background 0.3s ease;
}

/* ==================== Top Navigation ==================== */
.top-nav {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
    transition: background 0.3s ease;
}

.top-nav-content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.8em;
    font-weight: bold;
    background: linear-gradient(135deg, var(--logo-color-1) 0%, var(--logo-color-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

/* SVG Logo颜色控制 */
.logo-circle-outer {
    fill: var(--logo-icon-main);
}

.logo-circle-middle {
    fill: var(--logo-icon-light);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.logo-text {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo:hover .logo-icon {
    animation: logoSpin 0.6s ease-in-out;
}

@keyframes logoSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Online Users Badge */
.online-users-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border-radius: 12px;
    font-size: 0.75em;
    color: var(--text-muted);
    transition: all 0.3s ease;
    cursor: help;
    opacity: 0.6;
    border: 1px solid var(--border-color);
}

.online-users-badge svg {
    color: var(--text-muted);
    stroke-width: 2;
    opacity: 0.7;
}

.online-users-badge:hover {
    background: var(--bg-primary);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow-light);
}

.online-users-badge:hover svg {
    color: var(--accent-color);
    opacity: 1;
}

#onlineUsersCount {
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 16px;
    text-align: center;
    font-size: 0.9em;
}

.online-users-badge:hover #onlineUsersCount {
    color: var(--accent-color);
    font-weight: 600;
}

#onlineUsersCount[data-count="0"],
#onlineUsersCount:empty {
    color: var(--text-muted);
}

.search-container {
    flex: 1;
    max-width: 580px;
    margin: 0 30px;
    position: relative;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    height: 44px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-wrapper:hover {
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.search-wrapper:focus-within {
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}

.search-engine-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 0 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
    border-radius: 24px 0 0 24px;
    height: 100%;
}

.search-engine-selector:hover {
    background: rgba(0,0,0,0.04);
}

.current-engine-icon {
    width: 20px;
    height: 20px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.current-engine-icon svg {
    width: 16px;
    height: 16px;
    color: #5f6368;
}

.current-engine-icon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.current-engine {
    font-size: 14px;
    font-weight: 400;
    color: #5f6368;
    white-space: nowrap;
}

.dropdown-icon {
    color: #5f6368;
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.search-engine-selector.active .dropdown-icon {
    transform: rotate(180deg);
}

.search-divider {
    width: 1px;
    height: 28px;
    background: #dadce0;
    margin: 0 8px;
}

.search-wrapper input {
    flex: 1;
    padding: 0 14px;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    color: #202124;
    font-family: arial, sans-serif;
}

.search-wrapper input::placeholder {
    color: #9aa0a6;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #5f6368;
    cursor: pointer;
    transition: background 0.1s ease;
    border-radius: 50%;
    margin-right: 4px;
}

.search-btn:hover {
    background: rgba(0,0,0,0.04);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 1000;
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 14px;
    min-height: 40px;
}

.search-option:hover {
    background: #f1f3f4;
}

.search-option.selected {
    background: #e8f0fe;
    color: #1a73e8;
}

.option-icon {
    width: 24px;
    height: 24px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-icon svg {
    width: 18px;
    height: 18px;
    color: #5f6368;
}

.option-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.option-name {
    font-size: 14px;
    color: #202124;
}

.search-option.selected .option-name {
    color: #1a73e8;
    font-weight: 500;
}

/* ==================== Theme Selector ==================== */
.theme-selector {
    position: relative;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle .dropdown-arrow {
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.theme-dropdown.show ~ .theme-toggle .dropdown-arrow {
    transform: rotate(180deg);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.theme-option:first-child {
    border-radius: 12px 12px 0 0;
}

.theme-option:last-child {
    border-radius: 0 0 12px 12px;
}

.theme-option:hover {
    background: var(--bg-hover);
}

.theme-option .theme-icon {
    font-size: 1.2em;
}

.theme-option .theme-name {
    color: var(--text-primary);
    font-size: 0.9em;
}

/* ==================== Main Container ==================== */
.main-container {
    display: flex;
    max-width: 1800px;
    margin: 0 auto;
    padding: 30px;
    gap: 30px;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 300px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px 0;
    height: calc(100vh - 110px);
    max-height: calc(100vh - 110px);
    position: sticky;
    top: 90px;
    box-shadow: 0 4px 15px var(--shadow-light);
    overflow-y: auto;
    transition: background 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-hover-strong);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.sidebar-title {
    padding: 0 25px 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin: 5px 0;
}

/* 大类样式 */
.menu-category {
    margin-bottom: 20px;
}

.category-label {
    padding: 12px 25px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, var(--accent-hover-strong) 0%, transparent 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.category-label:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, transparent 100%);
}

.category-label .category-icon {
    margin-right: 10px;
    font-size: 1.2em;
}

.category-label .expand-icon {
    margin-left: auto;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.category-label.collapsed .expand-icon {
    transform: rotate(-90deg);
}

/* 子菜单样式 */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.submenu.expanded {
    max-height: 500px;
    opacity: 1;
}

.submenu.collapsed {
    max-height: 0;
    opacity: 0;
}

.submenu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 25px 10px 50px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.9em;
}

.sidebar-menu a:hover {
    background: linear-gradient(90deg, var(--accent-hover) 0%, transparent 100%);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
}

.sidebar-menu a.active {
    background: linear-gradient(90deg, var(--accent-hover-strong) 0%, transparent 100%);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.menu-icon {
    font-size: 1.3em;
    margin-right: 12px;
    width: 25px;
    text-align: center;
}

/* ==================== Content Area ==================== */
.content {
    flex: 1;
    min-width: 0;
}

.category {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
    scroll-margin-top: 100px;
    transition: background 0.3s ease;
}

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--border-color);
}

.category-icon {
    font-size: 2.2em;
    margin-right: 18px;
}

.category-title {
    font-size: 2em;
    font-weight: bold;
    color: var(--text-primary);
}

.category-desc {
    font-size: 0.9em;
    color: var(--text-light);
    margin-left: auto;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

/* For large screens (1920px), show 5 columns */
@media (min-width: 1600px) {
    .cards {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* For extra large screens */
@media (min-width: 2000px) {
    .cards {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ==================== Card Animations ==================== */
.card {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
}

/* Fade in animation */
.card.fade-in {
    animation: cardFadeIn 0.5s ease-out forwards;
}

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

/* Staggered animation delays */
.card.fade-in:nth-child(1) { animation-delay: 0s; }
.card.fade-in:nth-child(2) { animation-delay: 0.05s; }
.card.fade-in:nth-child(3) { animation-delay: 0.1s; }
.card.fade-in:nth-child(4) { animation-delay: 0.15s; }
.card.fade-in:nth-child(5) { animation-delay: 0.2s; }
.card.fade-in:nth-child(6) { animation-delay: 0.25s; }
.card.fade-in:nth-child(7) { animation-delay: 0.3s; }
.card.fade-in:nth-child(8) { animation-delay: 0.35s; }
.card.fade-in:nth-child(9) { animation-delay: 0.4s; }
.card.fade-in:nth-child(10) { animation-delay: 0.45s; }
.card.fade-in:nth-child(n+11) { animation-delay: 0.5s; }

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

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

.card-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.card-icon-wrapper {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    border-radius: 8px;
    padding: 4px;
    transition: transform 0.3s ease;
}

.card:hover .card-icon-wrapper {
    transform: scale(1.05);
}

.card-favicon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.card-icon-fallback {
    font-size: 1.5em;
}

.card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title {
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 2px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 0.75em;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tag {
    display: none;
}

.card-quick-access-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--accent-color);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
}

.card:hover .card-quick-access-btn {
    opacity: 1;
}

.card-quick-access-btn:hover {
    transform: scale(1.3);
    background: var(--accent-hover);
}

/* Favorite indicator */
.card.favorited .card-icon::after {
    content: '⭐';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.5em;
}

/* ==================== Mobile Menu Button ==================== */
.mobile-menu-btn {
    display: none;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
}

/* ==================== Statistics ==================== */
.stats {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--stat-bg);
    border-radius: 15px;
    margin-bottom: 25px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: var(--bg-white);
    border-radius: 10px;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-tertiary);
    margin-top: 5px;
}

/* ==================== Recent Visits ==================== */
.recent-visits {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px var(--shadow-light);
    transition: all 0.3s ease;
}

.recent-visits.has-items {
    padding: 25px;
}

.recent-visits-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.recent-visits.has-items .recent-visits-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.recent-visits-header h3 {
    font-size: 1.3em;
    color: var(--text-primary);
    margin: 0;
}

.recent-visits-desc {
    font-size: 0.85em;
    color: var(--text-light);
    margin-right: auto;
    margin-left: 15px;
}

.clear-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
}

.clear-history-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
    transform: translateY(-1px);
}

.clear-history-btn svg {
    stroke: currentColor;
}

/* Recent visits uses the same card grid as main content */
.recent-visits .cards {
    display: none;
}

.recent-visits.has-items .cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

/* Badge styles for visit count and time */
.visit-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.card:hover .visit-badge {
    opacity: 1;
}

.time-badge {
    position: absolute;
    bottom: 8px;
    right: 60px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .time-badge {
    opacity: 1;
}

/* ==================== Back to Top Button ==================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent-gradient);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    box-shadow: 0 4px 15px var(--shadow-medium);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
}

.back-to-top:hover {
    transform: scale(1.1);
}

/* ==================== Loading Skeleton ==================== */
.loading-skeleton {
    display: block;
}

.loading-skeleton.hidden {
    display: none;
}

.skeleton-category {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.skeleton-header {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--border-color);
}

.skeleton-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    margin-right: 18px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--border-input) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

.skeleton-title {
    width: 200px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--border-input) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

.skeleton-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.skeleton-card {
    height: 220px;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--border-input) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--border-input) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        display: block;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-show {
        left: 0;
    }

    /* 侧边栏遮罩层 */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: block;
    }

    .cards {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .top-nav-content {
        flex-wrap: wrap;
    }

    .search-container {
        order: 3;
        flex: 1 1 100%;
        margin: 15px 0 0 0;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .category {
        padding: 20px;
    }

    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

/* ==================== Search Highlight ==================== */
.search-highlight {
    background: var(--accent-color);
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    animation: highlightPulse 0.5s ease-out;
}

@keyframes highlightPulse {
    0% {
        background: var(--accent-color);
        transform: scale(1);
    }
    50% {
        background: var(--accent-hover-strong);
        transform: scale(1.05);
    }
    100% {
        background: var(--accent-color);
        transform: scale(1);
    }
}

/* ==================== Search Empty State ==================== */
.search-empty-state {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 60px 40px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

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

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.6;
    animation: emptyIconFloat 2s ease-in-out infinite;
}

@keyframes emptyIconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-state-title {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state-desc {
    font-size: 1em;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.empty-state-desc strong {
    color: var(--accent-color);
    font-weight: 600;
}

.empty-state-tips {
    background: var(--stat-bg);
    border-radius: 12px;
    padding: 20px 30px;
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.empty-state-tips p {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.empty-state-tips li {
    font-size: 0.9em;
    color: var(--text-secondary);
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.5;
}

.empty-state-tips li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: var(--accent-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    .search-empty-state {
        padding: 40px 20px;
    }

    .empty-state-tips {
        padding: 15px 20px;
    }
}

/* ==================== Accessibility ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Remove outline for search input */
.search-wrapper input:focus {
    outline: none;
}

/* ==================== Print Styles ==================== */
@media print {
    .top-nav,
    .sidebar,
    .back-to-top,
    .theme-toggle {
        display: none;
    }

    .main-container {
        max-width: 100%;
    }

    .card {
        break-inside: avoid;
    }
}

/* ==================== Interactive Effects ==================== */

/* Mouse Trail Particles */
@keyframes particleFade {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(random() * 40px - 20px), calc(random() * 40px - 20px)) scale(0);
    }
}

.mouse-particle {
    box-shadow: 0 0 10px currentColor;
}

/* Click Ripple Effect */
.click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    transform: translate(-50%, -50%);
    animation: rippleExpand 0.6s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

/* Cursor change when effects enabled */
body.effects-enabled {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text y="20" font-size="20">✨</text></svg>'), auto;
}

body.effects-enabled a,
body.effects-enabled button,
body.effects-enabled .card {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text y="20" font-size="20">👆</text></svg>'), pointer;
}

/* ==================== Background Decorations ==================== */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.decoration-item {
    position: absolute;
    top: -50px;
    font-size: 1.5em;
    opacity: 0.7;
    pointer-events: none;
    animation: decorationFall linear forwards;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5));
}

/* CSS Bubble for Ocean Theme */
.css-bubble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(173, 216, 230, 0.4) 30%, rgba(100, 180, 255, 0.2));
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        inset 0 0 15px rgba(255, 255, 255, 0.5),
        0 0 15px rgba(100, 180, 255, 0.3),
        inset -5px -5px 10px rgba(173, 216, 230, 0.3);
    position: relative;
    opacity: 0.8;
}

.bubble-shine {
    position: absolute;
    top: 15%;
    left: 25%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent);
    border-radius: 50%;
}

.bubble-shine::after {
    content: '';
    position: absolute;
    top: 40%;
    left: 50%;
    width: 15%;
    height: 15%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent);
    border-radius: 50%;
}

@keyframes decorationFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
        opacity: 0;
    }
}

/* Theme-specific decoration animations */
[data-theme="cherry"] .decoration-item {
    animation: cherryFall linear forwards;
}

[data-theme="ocean"] .decoration-item {
    animation: bubbleRise linear forwards;
}

[data-theme="sunset"] .decoration-item {
    animation: meteorShoot linear forwards;
}

@keyframes cherryFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(720deg);
        opacity: 0;
    }
}

@keyframes bubbleRise {
    0% {
        transform: translateY(100vh) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-50px) translateX(var(--drift)) scale(1.5);
        opacity: 0;
    }
}

@keyframes meteorShoot {
    0% {
        transform: translate(0, 0) rotate(-45deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(var(--drift) * 3), 100vh) rotate(-45deg);
        opacity: 0;
    }
}

/* ==================== Accessibility - Reduced Motion Support ==================== */
/* 尊重用户的动画偏好设置，为运动敏感用户提供更好的体验 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* 完全禁用装饰性动画 */
    .decoration-item {
        display: none !important;
    }

    .mouse-particle {
        display: none !important;
    }

    /* 保留基本的hover效果，但去除动画 */
    .card:hover,
    .theme-toggle:hover,
    .back-to-top:hover,
    .online-users-badge:hover {
        transform: none !important;
    }
}

/* ==================== Footer ==================== */
.site-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    padding: 40px 20px 20px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: var(--text-primary);
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 8px 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin: 8px 0;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
}

.footer-bottom p {
    margin: 8px 0;
}

.footer-bottom a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-bottom a:hover {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .site-footer {
        padding: 30px 15px 15px;
        margin-top: 40px;
    }
}
