/**
 * 小月短链接 - UI质感增强样式
 * 包含：字体、颜色、阴影、动画、毛玻璃、骨架屏
 */

/* ============================================
   1. CSS 变量定义
   ============================================ */
:root {
    /* 主色系 */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-500: #206bc4;
    --primary-600: #1b59a3;
    --primary-700: #164785;
    
    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, #206bc4 0%, #1b59a3 100%);
    --gradient-hero: linear-gradient(135deg, #206bc4 0%, #1e3a8a 100%);
    --gradient-card: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    --gradient-blue: linear-gradient(135deg, #206bc4 0%, #1b59a3 100%);
    
    /* 中性色 - 更柔和 */
    --gray-50: #fafbfc;
    --gray-100: #f4f6f8;
    --gray-200: #e8ecef;
    --gray-300: #dde2e7;
    --gray-400: #c1c9d0;
    --gray-500: #8f9ba8;
    --gray-600: #64748b;
    --gray-700: #475569;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* 彩色阴影 */
    --shadow-primary: 0 10px 30px -5px rgba(32, 107, 196, 0.3);
    --shadow-primary-lg: 0 20px 40px -10px rgba(32, 107, 196, 0.4);
    
    /* 间距系统 */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --space-8: 64px;
    --space-10: 80px;
    --space-12: 96px;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    
    /* 过渡 */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   2. 字体系统优化
   ============================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--gray-900);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 标题优化 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--gray-900);
}

h1 {
    font-size: 3rem;
    line-height: 1.1;
}

h2 {
    font-size: 2.25rem;
    line-height: 1.2;
}

h3 {
    font-size: 1.75rem;
    line-height: 1.3;
}

h4 {
    font-size: 1.5rem;
    line-height: 1.4;
}

/* 段落优化 */
p {
    line-height: 1.8;
    margin-bottom: 1.25em;
}

p + p {
    margin-top: 1.5em;
}

/* ============================================
   3. 导航栏毛玻璃效果
   ============================================ */
header {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06) !important;
    transition: var(--transition-base);
}

/* 滚动时导航栏效果增强 */
header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

/* Logo 渐变文字 */
.logo-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* 导航链接优化 */
nav a {
    font-weight: 500;
    transition: var(--transition-fast);
}

nav a:hover {
    color: var(--primary-600) !important;
    transform: translateY(-1px);
}

/* 下拉菜单优化 */
.dropdown-menu,
[class*="dropdown"] > div {
    background: white !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 12px 0 !important;
    margin-top: 8px !important;
}

.dropdown-menu a,
[class*="dropdown"] a {
    padding: 14px 24px !important;
    margin: 0 8px !important;
    border-radius: var(--radius-md) !important;
    transition: var(--transition-fast) !important;
    font-weight: 500;
}

.dropdown-menu a:hover,
[class*="dropdown"] a:hover {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    transform: translateX(4px) !important;
    color: var(--primary-600) !important;
}

/* ============================================
   4. 卡片组件优化
   ============================================ */
.card,
.bg-white.rounded-xl,
.bg-white.rounded-lg {
    background: var(--gradient-card) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    transition: var(--transition-base) !important;
    overflow: hidden;
    position: relative;
}

.card:hover,
.card-hover:hover,
.bg-white.rounded-xl:hover,
.bg-white.rounded-lg:hover {
    transform: translateY(-8px) !important;
    box-shadow: var(--shadow-2xl) !important;
}

/* 卡片光泽效果 */
.card-shine::before,
.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
    transition: left 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.card-shine:hover::before,
.card-hover:hover::before {
    left: 100%;
}

/* ============================================
   5. 按钮组件优化
   ============================================ */
.btn-primary,
.bg-primary,
button.bg-primary,
a.bg-primary {
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-primary) !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    border: none !important;
    transition: var(--transition-base) !important;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.bg-primary:hover,
button.bg-primary:hover,
a.bg-primary:hover {
    box-shadow: var(--shadow-primary-lg) !important;
    transform: translateY(-2px) !important;
}

.btn-primary:active,
.bg-primary:active {
    transform: translateY(0) !important;
}

/* 按钮光泽效果 */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* 次要按钮 */
.btn-secondary {
    background: white !important;
    border: 2px solid var(--gray-200) !important;
    font-weight: 600 !important;
    transition: var(--transition-base) !important;
}

.btn-secondary:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-300) !important;
    transform: translateY(-2px);
}

/* ============================================
   6. 输入框优化
   ============================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
    border: 2px solid var(--gray-200) !important;
    border-radius: var(--radius-md) !important;
    padding: 14px 18px !important;
    font-size: 16px !important;
    transition: var(--transition-fast) !important;
    background: white !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-500) !important;
    box-shadow: 0 0 0 4px rgba(32, 107, 196, 0.1) !important;
    outline: none !important;
    background: white !important;
}

/* ============================================
   7. 渐变文字
   ============================================ */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   8. 骨架屏加载效果
   ============================================ */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #f8f8f8 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.4s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* 骨架屏组件 */
.skeleton-text {
    height: 16px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-title {
    height: 32px;
    width: 60%;
    margin-bottom: 16px;
    border-radius: 8px;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-lg);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-button {
    height: 44px;
    width: 120px;
    border-radius: var(--radius-md);
}

/* 骨架屏容器 */
.skeleton-wrapper {
    padding: 20px;
}

/* ============================================
   9. 移动端优化
   ============================================ */
@media (max-width: 768px) {
    /* 字体缩放 */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    /* 间距调整 */
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* 卡片间距 */
    .card,
    .bg-white.rounded-xl {
        margin-bottom: 1rem;
    }
    
    /* 按钮全宽 */
    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
    
    /* 导航栏优化 */
    header {
        backdrop-filter: blur(10px) saturate(150%);
    }
    
    /* Hover效果在移动端禁用浮起 */
    .card:hover,
    .card-hover:hover {
        transform: none !important;
    }
    
    /* 输入框移动端优化 */
    input,
    textarea,
    select {
        font-size: 16px !important; /* 防止iOS自动缩放 */
    }
}

/* 小屏幕设备 */
@media (max-width: 640px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* 减少间距 */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* ============================================
   10. 滚动优化
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 5px;
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ============================================
   11. 动画效果
   ============================================ */
/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* 从左滑入 */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

/* 从右滑入 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* 缩放进入 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* ============================================
   12. 特殊效果
   ============================================ */
/* 毛玻璃容器 */
.glass {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
}

/* 渐变背景 */
.gradient-bg {
    background: var(--gradient-primary);
}

/* 彩色阴影 */
.shadow-primary {
    box-shadow: var(--shadow-primary) !important;
}

.shadow-primary-lg {
    box-shadow: var(--shadow-primary-lg) !important;
}

/* Hover提升效果 */
.hover-lift {
    transition: var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* ============================================
   13. 辅助类
   ============================================ */
/* 文字省略 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 性能优化 */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* ============================================
   14. 打印优化
   ============================================ */
@media print {
    header,
    footer,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card,
    .bg-white {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ============================================
   15. 可访问性优化
   ============================================ */
/* 焦点可见 */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* 减少动画（尊重用户偏好）*/
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   16. 深色模式支持（预留）
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* 暂时保持浅色，未来可扩展 */
}

