/* 
 * 蛇蛇的开发之旅 - 现代 UI 设计系统
 * 风格：Modern Dark + Glassmorphism
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* 核心色彩 (保持一致以维持品牌感) */
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --secondary: #3b82f6;
    --accent: #f59e0b;
    
    /* 默认黑暗模式变量 */
    --bg-dark: #020617;
    --bg-card: rgba(15, 23, 42, 0.7);
    --bg-glass: rgba(15, 23, 42, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    /* 物理属性 */
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 明亮模式变量覆盖 */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --border-glass: rgba(0, 0, 0, 0.08);
    --text-main: #020617;
    --text-muted: #334155;
    --text-dim: #475569;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.12);
    --primary-glow: rgba(16, 185, 129, 0.15);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 动态网格背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 50% 50%, var(--primary-glow) 0%, transparent 60%),
        linear-gradient(var(--border-glass) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-glass) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    z-index: -1;
    animation: backgroundPulse 8s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* 布局容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 毛玻璃导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition);
}

.header.scrolled {
    height: 64px;
    background: rgba(2, 6, 23, 0.8);
}

.nav {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 搜索框 */
.search-container {
    flex: 0 1 400px;
    position: relative;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* 按钮样式 */
.btn {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

/* 英雄区 */
.hero {
    padding: 160px 0 80px;
    text-align: center;
}

.hero h1 {
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -2px;
    background: linear-gradient(to right, #fff 20%, var(--primary) 40%, var(--secondary) 60%, #fff 80%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 8s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.hero p {
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* 文章卡片网格 */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 32px;
    padding-bottom: 80px;
}

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-12px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 40px -10px rgba(16, 185, 129, 0.2);
}

.article-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, var(--primary-glow), transparent 70%);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

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

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: var(--transition);
}

.article-card:hover .card-image {
    transform: scale(1.1);
}

.card-body {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    gap: 16px;
    color: var(--text-dim);
    font-size: 0.875rem;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 40px 0;
}

.pagination button {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button.active {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

/* 用户菜单 */
.user-menu {
    position: relative;
}

.user-trigger {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    padding-top: 15px; /* 视觉间隙 */
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.3s ease;
    transition-delay: 0.3s; /* 较长的退出延迟，非常宽容 */
}

/* 巨大的透明桥梁，向上覆盖整个导航栏区域，确保鼠标移动路径连贯 */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -85px; /* 向上延伸，足以覆盖从按钮到底部的所有空隙 */
    left: -50px; /* 向左扩展一些，防止斜向移动时脱离 */
    right: -50px;
    height: 100px;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition-delay: 0s;
}

/* 内部容器用于背景和边框 */
.user-dropdown-inner {
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-main);
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown-item:first-child {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.dropdown-item:last-child {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

/* 响应式 */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .search-container { display: none; }
    .article-grid { grid-template-columns: 1fr; }
}

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

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-glass);
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* 蛇蛇加载器 */
.snake-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    width: 100%;
}

.snake-loader {
    width: 60px;
    height: 60px;
    position: relative;
}

.snake-loader::before,
.snake-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.snake-loader::before {
    animation: snakeSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.snake-loader::after {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--secondary);
    animation: snakeSpin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

.loader-text {
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

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

/* --- Toast 提示系统 --- */
.toast-container {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    width: 100%;
    max-width: 500px;
}

.toast {
    min-width: 320px;
    max-width: 90%;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
    overflow: hidden;
}

.toast.hiding {
    animation: toastOut 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes toastIn {
    from { transform: translateY(-100%) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(-100%) scale(0.9); opacity: 0; }
}


.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--primary);
    transform-origin: left;
    animation: toastProgress var(--duration, 3000ms) linear forwards;
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-success .toast-icon { color: var(--primary); background: rgba(16, 185, 129, 0.1); }
.toast-error .toast-icon { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.toast-error::before { background: #ef4444; }
.toast-warning .toast-icon { color: var(--accent); background: rgba(245, 158, 11, 0.1); }
.toast-warning::before { background: var(--accent); }

.toast-content {
    flex-grow: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* --- 模态框确认系统 --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    animation: fadeIn 0.3s ease forwards;
}

.modal-overlay.hiding {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirm-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    z-index: 10001;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalIn {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.confirm-modal.hiding {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}


.confirm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.confirm-body {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1rem;
    line-height: 1.6;
}

.confirm-footer {
    display: flex;
    gap: 12px;
}

.confirm-footer .btn {
    flex: 1;
    justify-content: center;
    padding: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}


