@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;800&family=Noto+Sans+SC:wght@400;700;900&display=swap');

/* 品牌色定义 */
:root {
    --color-brand-50: #f0f9ff;
    --color-brand-100: #e0f2fe;
    --color-brand-200: #bae6fd;
    --color-brand-300: #7dd3fc;
    --color-brand-400: #38bdf8;
    --color-brand-500: #0ea5e9;
    --color-brand-600: #0284c7;
    --color-brand-700: #0369a1;
    --color-brand-800: #075985;
    --color-brand-900: #0c4a6e;
}

/* Tailwind品牌色类 */
.bg-brand-50 { background-color: var(--color-brand-50); }
.bg-brand-100 { background-color: var(--color-brand-100); }
.bg-brand-200 { background-color: var(--color-brand-200); }
.bg-brand-300 { background-color: var(--color-brand-300); }
.bg-brand-400 { background-color: var(--color-brand-400); }
.bg-brand-500 { background-color: var(--color-brand-500); }
.bg-brand-600 { background-color: var(--color-brand-600); }
.bg-brand-700 { background-color: var(--color-brand-700); }
.bg-brand-800 { background-color: var(--color-brand-800); }
.bg-brand-900 { background-color: var(--color-brand-900); }

.text-brand-50 { color: var(--color-brand-50); }
.text-brand-100 { color: var(--color-brand-100); }
.text-brand-200 { color: var(--color-brand-200); }
.text-brand-300 { color: var(--color-brand-300); }
.text-brand-400 { color: var(--color-brand-400); }
.text-brand-500 { color: var(--color-brand-500); }
.text-brand-600 { color: var(--color-brand-600); }
.text-brand-700 { color: var(--color-brand-700); }
.text-brand-800 { color: var(--color-brand-800); }
.text-brand-900 { color: var(--color-brand-900); }

body {
    font-family: 'Plus Jakarta Sans', 'Noto Sans SC', sans-serif;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

/* 深色主题修复 - 重新设计，确保所有元素正确响应 */

/* 基础深色主题 - 简化背景色设置，避免多层覆盖 */
.dark {
    color: #f1f5f9;
}

/* 只在body上设置一次背景色，其他容器继承或透明 */
.dark body {
    background-color: #0f172a !important;
}

/* 确保所有容器背景透明，避免多层覆盖 */
.dark main,
.dark header,
.dark footer,
.dark section {
    background-color: transparent !important;
}

/* 确保body内容不会被固定导航栏遮挡 */
body {
    padding-top: 80px; /* 导航栏高度为80px */
}

/* 玻璃态导航栏基础样式 - 增强磨砂效果 */
.glass-nav {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 玻璃态导航栏深色主题 */
.dark .glass-nav {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(51, 65, 85, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 筛选栏深色主题 */
.dark .bg-white {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

/* 卡片深色主题 */
.dark .group {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

.dark .card-entry {
    background-color: transparent;
}

/* 输入框深色主题 */
.dark input[type="text"],
.dark input[type="password"],
.dark input[type="email"] {
    background-color: #1e293b;
    color: #f1f5f9;
    border-radius: inherit !important;
    box-shadow: none !important;
}

/* 确保搜索框在暗黑主题下没有边框 */
.dark .search-input {
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* 修复搜索框父容器背景 */
.dark .relative.group {
    background: transparent !important;
}

.dark input[type="text"]::placeholder,
.dark input[type="password"]::placeholder,
.dark input[type="email"]::placeholder {
    color: #94a3b8;
}

/* 按钮深色主题 */
.dark button {
    color: #f1f5f9;
}

/* 按钮悬停效果 */
.dark button:hover {
    background-color: #334155;
}

/* 模态框深色主题 */
.dark #modal {
    background-color: rgba(0, 0, 0, 0.8);
}

.dark #modal-content {
    background-color: #1e293b;
    color: #f1f5f9;
}

.dark #modal .bg-slate-50,
.dark #modal .bg-slate-800\/50 {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

/* 英雄搜索区深色主题 */
.dark header .bg-white {
    background-color: #1e293b;
    border-color: #334155;
}

/* 分类标签深色主题 */
.dark .bg-slate-100 {
    background-color: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

.dark .bg-slate-100:hover {
    background-color: #334155;
}

.dark .bg-slate-900 {
    background-color: #0f172a;
    color: #f1f5f9;
}

/* 排序菜单深色主题 */
.dark #sort-list {
    background-color: #1e293b;
    border-color: #334155;
}

/* 文本颜色修复 */
.dark .text-slate-900 {
    color: #f1f5f9;
}

.dark .text-slate-600 {
    color: #cbd5e1;
}

.dark .text-slate-600:hover {
    color: #f1f5f9;
}

.dark .text-slate-500 {
    color: #94a3b8;
}

.dark .text-slate-400 {
    color: #64748b;
}

/* 背景色修复 */
.dark .bg-slate-50 {
    background-color: #1e293b;
}

.dark .bg-slate-700 {
    background-color: #334155;
    color: #f1f5f9;
}

.dark .bg-slate-800 {
    background-color: #1e293b;
}

/* 边框颜色修复 */
.dark .border-slate-200,
.dark .border-slate-100,
.dark .border-slate-800 {
    border-color: #334155;
}

/* 认证模态框深色主题 */
.dark #auth-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

.dark #auth-content {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

/* 确保所有链接在深色主题下有正确颜色 */
.dark a {
    color: #60a5fa;
}

.dark a:hover {
    color: #93c5fd;
}

/* 确保所有图标在深色主题下显示正确 */
.dark [data-lucide] {
    color: inherit;
}

/* 调整模态框内按钮样式 */
.dark #modal-fav-btn,
.dark #modal-like-btn {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

.dark #modal-fav-btn:hover,
.dark #modal-like-btn:hover {
    background-color: #334155;
}

/* 确保复制按钮在深色主题下显示正确 */
.dark button.bg-brand-600 {
    background-color: #0ea5e9;
    color: white;
}

.dark button.bg-brand-600:hover {
    background-color: #0284c7;
}

/* 确保统计信息文本在深色主题下显示正确 */
.dark #item-count {
    color: #94a3b8;
}

/* 确保排序按钮在深色主题下显示正确 */
.dark .text-slate-600 {
    color: #cbd5e1;
}

.dark .text-slate-600:hover {
    color: #f1f5f9;
    background-color: transparent;
}

/* 统一主要容器的宽度设置 */
:root {
    --max-container-width: 1440px;
}

/* 主容器 - 确保整个内容区域居中 */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 1rem;
    width: 100%;
    margin: 0 auto;
    max-width: var(--max-container-width);
}

/* 筛选栏 - 确保筛选栏也居中 */
main > div:first-of-type {
    width: 100%;
    max-width: var(--max-container-width);
}

/* 瀑布流容器 - 优化性能，使用CSS Grid实现 */
.masonry-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 1.5rem;
    margin: 0 auto 2rem;
    width: 100%;
    max-width: var(--max-container-width);
}

/* 瀑布流卡片样式 - 确保卡片不会跨列 */
.card-entry {
    break-inside: avoid;
    animation: card-entrance 0.8s cubic-bezier(0.2, 1, 0.2, 1) backwards;
}

/* 响应式调整列数 */
@media (max-width: 1199px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        grid-gap: 1.5rem;
    }
}

@media (max-width: 991px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        grid-gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-gap: 1.25rem;
    }
}

@media (max-width: 575px) {
    .masonry-container {
        grid-template-columns: 1fr;
        grid-gap: 1.25rem;
    }
}

/* 响应式导航栏优化 */
@media (max-width: 640px) {
    .glass-nav {
        padding: 0 1rem;
    }
    
    .glass-nav .max-w-\[1440px\] {
        padding: 0 1rem;
    }
}

/* 响应式搜索区域优化 */
@media (max-width: 640px) {
    header {
        padding-top: 16px;
        padding-bottom: 16px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
}

/* 响应式筛选区域优化 */
@media (max-width: 767px) {
    section {
        margin-bottom: 1rem;
    }
    
    .grid-cols-1\.md\:grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 响应式模态框优化 */
@media (max-width: 767px) {
    #modal-content {
        flex-direction: column;
        max-height: 90vh;
    }
    
    #modal-content > div:first-child {
        width: 100%;
        height: 300px;
    }
    
    #modal-content > div:last-child {
        padding: 1rem;
    }
}

/* 触控目标优化 */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .card-entry {
        touch-action: manipulation;
    }
}

/* 打字机特效 */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* 图片悬停时的提示词打字机效果 */
.card-info-gradient p {
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    transition: width 0s ease;
}

.group:hover .card-info-gradient p {
    animation: typewriter 1.5s steps(40, end) forwards;
}



/* 清除按钮样式 */
#clearSearch {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

/* 全局变量定义 */
:root {
    --bg-color: #ffffff;
    --border-radius: 14px;
    --text-color: #000000;
    --placeholder-color: #444444;
    --icon-color: #555555;
}

/* 深色主题变量 */
.dark {
    --bg-color: rgba(30, 41, 59, 0.98);
    --text-color: #f1f5f9;
    --placeholder-color: #64748b;
    --icon-color: #94a3b8;
}

/* 搜索框主体样式优化 */
#searchInput {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(10px);
    border: none;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* 搜索框聚焦效果 */
#searchInput:focus {
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.15),
        0 0 0 2px rgba(59, 130, 246, 0.3) inset;
    transform: translateY(-1px);
}

/* 深色主题搜索框样式 */
.dark #searchInput {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(51, 65, 85, 0.5) inset;
}

/* 深色主题搜索框聚焦效果 */
.dark #searchInput:focus {
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.4),
        0 0 0 2px rgba(59, 130, 246, 0.2) inset;
    transform: translateY(-1px);
}



/* 加载状态 */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(107, 114, 128, 0.2);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin 1s ease-in-out infinite;
}

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

/* 无更多数据 */
.no-more-data {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 页底模块 */
footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 3rem 0 1.5rem;
}

.dark footer {
    background: #0f172a;
    border-top: 1px solid #1e293b;
}

.footer-content {
    max-width: var(--max-container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-logo span {
    font-size: 1.5rem;
    font-weight: 900;
    color: #111827;
}

.dark .footer-logo span {
    color: white;
}

.footer-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.dark .footer-description {
    color: #94a3b8;
}

.footer-section h3 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #111827;
    margin-bottom: 1rem;
}

.dark .footer-section h3 {
    color: white;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s;
}

.dark .footer-links a {
    color: #94a3b8;
}

.footer-links a:hover {
    color: #4f46e5;
}

.dark .footer-links a:hover {
    color: #818cf8;
}

.footer-bottom {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

.dark .footer-bottom {
    border-top: 1px solid #1e293b;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    transition: all 0.2s;
}

.dark .footer-social a {
    background: #1e293b;
    color: #94a3b8;
}

.footer-social a:hover {
    background: #4f46e5;
    color: white;
    transform: translateY(-2px);
}

.footer-copyright {
    color: #6b7280;
    font-size: 0.75rem;
    text-align: center;
}

.dark .footer-copyright {
    color: #94a3b8;
}

@keyframes card-entrance {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.glass-nav {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.dark .glass-nav { background: rgba(15, 23, 42, 0.7); }

.heart-active, .like-active {
    fill: #ef4444 !important;
    stroke: #ef4444 !important;
    animation: heart-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.thumb-active {
    fill: #3b82f6 !important;
    stroke: #3b82f6 !important;
    animation: heart-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 自定义滚动条样式 - 融合深色主题 */
#modal-content .overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 108, 132, 0.3) transparent;
}

/* WebKit浏览器滚动条样式 */
#modal-content .overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

#modal-content .overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#modal-content .overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(94, 108, 132, 0.3);
    border-radius: 3px;
    transition: all 0.3s ease;
}

#modal-content .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 108, 132, 0.5);
}

#modal-content .overflow-y-auto::-webkit-scrollbar-corner {
    background: transparent;
}

/* 深色主题下的滚动条优化 */
.dark #modal-content .overflow-y-auto {
    scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.dark #modal-content .overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
}

.dark #modal-content .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

.card-info-gradient {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
}

#toast {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
}
#toast.visible { transform: translate(-50%, -40px); opacity: 1; }

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }