/* ========================================
   全局样式
======================================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --info-color: #3b82f6;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--dark-color);
    background-color: #ffffff;
    overflow-x: hidden;
}

/* ========================================
   通用图片样式
======================================== */

/* 默认图片样式 - 防止图片破坏布局 */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

/* 富文本内容中的图片样式 */
.letter-content img,
.content-section img,
.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin: 1.5rem 0;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.letter-content img:hover,
.content-section img:hover,
.ql-editor img:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* 移动端响应式图片 */
@media (max-width: 768px) {
    .letter-content img,
    .content-section img,
    .ql-editor img {
        border-radius: 8px;
        margin: 1rem 0;
    }
}

/* ========================================
   导航栏
======================================== */
.navbar {
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

/* 用户下拉菜单样式优化 */
.navbar .dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 用户下拉菜单 - 下拉箭头 */
.navbar .dropdown-toggle::after {
    display: inline-block !important;
    margin-left: 0.3rem;
    vertical-align: 0.15em;
    content: "" !important;
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
    transition: transform 0.3s ease;
    width: 0;
    height: 0;
    background: transparent !important;
}

/* 下拉菜单展开时箭头旋转 */
.navbar .dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg) !important;
}

/* 下拉菜单 hover 时不影响箭头 */
.navbar .dropdown-toggle:hover::after {
    transform: none !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: white !important;
}

/* 普通导航链接的下划线动画 - 排除 dropdown-toggle */
.nav-link:not(.dropdown-toggle)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.nav-link:not(.dropdown-toggle):hover::after {
    width: 80%;
}

/* 下拉菜单样式优化 */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0.5rem 0;
    margin-top: 0.5rem !important;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 0.6rem 1.5rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding-left: 2rem;
}

.dropdown-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dropdown-item i {
    opacity: 0.8;
}

/* 移动端导航栏优化 */
@media (max-width: 991px) {
    .navbar .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .navbar .dropdown-toggle::after {
        margin-left: auto !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }
    
    /* 移动端也不要下划线 */
    .navbar .nav-link:not(.dropdown-toggle)::after {
        display: none;
    }
    
    .navbar .dropdown-menu {
        border-radius: 8px;
        margin-top: 0.25rem !important;
    }
    
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 8px;
        margin: 0.25rem 0;
    }
    
    .navbar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    
    /* 确保移动端下拉箭头正确显示 */
    .navbar-nav .dropdown-toggle:hover::after {
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }
}

/* ========================================
   Hero Section
======================================== */
.hero-section {
    position: relative;
    min-height: 100vh;
    background: var(--gradient-hero);
    padding-top: 80px;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.5;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

/* 查看信件卡片样式 */
.view-letter-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 1.8rem 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.view-letter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.view-letter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.view-letter-card:hover::before {
    opacity: 1;
}

/* 卡片内容布局 */
.view-letter-content {
    display: flex;
    display: -webkit-flex;
    display: -ms-flexbox;
    flex-direction: row;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    align-items: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    gap: 1.5rem;
}

.view-letter-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: flex;
    display: -webkit-flex;
    display: -ms-flexbox;
    align-items: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    justify-content: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.view-letter-icon i {
    font-size: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.view-letter-card:hover .view-letter-icon {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(-10deg);
}

.view-letter-card:hover .view-letter-icon i {
    transform: scale(1.1);
}

.view-letter-text {
    flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex-grow: 1;
    -webkit-flex-grow: 1;
    -ms-flex-positive: 1;
    min-width: 0;
}

.view-letter-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    display: block;
    margin-bottom: 0.3rem;
    position: relative;
    z-index: 1;
}

.view-letter-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
}

.btn-view-letter {
    display: inline-flex;
    display: -webkit-inline-flex;
    display: -ms-inline-flexbox;
    align-items: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    gap: 0.6rem;
    background: white;
    color: #667eea;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.8rem;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    overflow: hidden;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
}

.btn-view-letter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
    z-index: -1;
}

.btn-view-letter:hover {
    color: white;
    transform: translateY(-3px);
    -webkit-transform: translateY(-3px);
    -ms-transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-view-letter:hover::before {
    width: 300px;
    height: 300px;
}

.btn-view-letter i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn-view-letter:hover i {
    transform: translateX(5px);
    -webkit-transform: translateX(5px);
    -ms-transform: translateX(5px);
}

/* 移动端适配 - 完全重写确保Safari兼容 */
@media (max-width: 768px) {
    .view-letter-card {
        padding: 1.5rem !important;
        border-radius: 15px !important;
        background: rgba(255, 255, 255, 0.12) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
    }
    
    .view-letter-content {
        display: block !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
    }
    
    .view-letter-icon {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 1rem !important;
        margin-right: 0 !important;
        background: rgba(255, 255, 255, 0.2) !important;
        display: flex !important;
        display: -webkit-flex !important;
        align-items: center !important;
        -webkit-align-items: center !important;
        justify-content: center !important;
        -webkit-justify-content: center !important;
    }
    
    .view-letter-icon i {
        font-size: 24px !important;
        color: white !important;
    }
    
    .view-letter-text {
        margin-bottom: 1rem !important;
        width: 100% !important;
    }
    
    .view-letter-title {
        font-size: 1rem !important;
        color: white !important;
        font-weight: 700 !important;
        margin-bottom: 0.4rem !important;
    }
    
    .view-letter-desc {
        font-size: 0.85rem !important;
        color: rgba(255, 255, 255, 0.8) !important;
        margin-bottom: 0 !important;
    }
    
    .btn-view-letter {
        display: flex !important;
        display: -webkit-flex !important;
        width: 100% !important;
        text-align: center !important;
        align-items: center !important;
        -webkit-align-items: center !important;
        justify-content: center !important;
        -webkit-justify-content: center !important;
        font-size: 0.9rem !important;
        padding: 0.75rem 2rem !important;
        box-sizing: border-box !important;
        -webkit-box-sizing: border-box !important;
        background: white !important;
        color: #667eea !important;
        border-radius: 50px !important;
        text-decoration: none !important;
        gap: 0.6rem !important;
        min-height: 48px !important;
    }
    
    .btn-view-letter span {
        color: #667eea !important;
        display: inline !important;
    }
    
    .btn-view-letter i {
        font-size: 1.1rem !important;
        color: #667eea !important;
        display: inline !important;
    }
}

/* Safari 专用样式修正 */
@supports (-webkit-hyphens:none) {
    @media (max-width: 768px) {
        /* Safari: 增加文字与按钮的间距 */
        .view-letter-text {
            margin-bottom: 1.5rem !important;
            padding-bottom: 0.5rem !important;
        }
        
        /* Safari: 强制按钮拉长 */
        .btn-view-letter {
            padding-left: 2.5rem !important;
            padding-right: 2.5rem !important;
            min-width: 100% !important;
        }
        
        .btn-view-letter span,
        .btn-view-letter i {
            flex-shrink: 0 !important;
            -webkit-flex-shrink: 0 !important;
        }
    }
}

@media (max-width: 576px) {
    .view-letter-card {
        padding: 1.3rem !important;
        border-radius: 12px !important;
    }
    
    .view-letter-icon {
        width: 48px !important;
        height: 48px !important;
    }
    
    .view-letter-icon i {
        font-size: 22px !important;
    }
    
    .view-letter-title {
        font-size: 0.95rem !important;
    }
    
    .view-letter-desc {
        font-size: 0.8rem !important;
    }
    
    .btn-view-letter {
        font-size: 0.85rem !important;
        padding: 0.7rem 1.5rem !important;
        min-height: 44px !important;
    }
}

/* Safari 专用样式修正 - 小屏幕 */
@supports (-webkit-hyphens:none) {
    @media (max-width: 576px) {
        .view-letter-text {
            margin-bottom: 1.5rem !important;
            padding-bottom: 0.5rem !important;
        }
        
        .btn-view-letter {
            padding-left: 2rem !important;
            padding-right: 2rem !important;
        }
    }
}

/* Hero 按钮样式 - 桌面端 */
.hero-btn-start,
.hero-btn-more {
    padding-left: 3rem;
    padding-right: 3rem;
}

.hero-image {
    text-align: center;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

.scroll-indicator i {
    font-size: 2rem;
}

/* ========================================
   Feature Cards
======================================== */
.feature-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-lg);
}

.feature-card h3 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.feature-card ul li {
    padding: 0.5rem 0;
    color: #6b7280;
}

/* ========================================
   How It Works
======================================== */
.step-number {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.step-icon {
    font-size: 3rem;
    color: var(--primary-color);
}

/* ========================================
   CTA Section
======================================== */
.cta-section {
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.5;
}

.cta-section .container {
    position: relative;
    z-index: 1;
}

/* ========================================
   Footer
======================================== */
footer {
    background: var(--dark-color);
}

footer h5, footer h6 {
    font-weight: 600;
}

footer a {
    transition: all 0.3s ease;
}

footer a:hover {
    color: white !important;
    transform: translateX(5px);
}

.social-links a {
    display: inline-block;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-3px);
}

/* ========================================
   Buttons
======================================== */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--primary-dark);
}

.btn-outline-light {
    border: 2px solid white;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.btn-outline-light:hover {
    background: white;
    color: var(--primary-color) !important;
    transform: translateY(-2px);
}

/* ========================================
   动画效果
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ========================================
   响应式设计
======================================== */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    /* 优化首页按钮在移动端的显示 */
    .hero-btn-start,
    .hero-btn-more {
        font-size: 0.9rem !important;
        padding: 0.55rem 1.5rem !important;
        white-space: nowrap;
    }
    
    .hero-section .btn-lg i {
        font-size: 0.85rem;
    }
    
    /* 调整按钮容器间距 */
    .hero-buttons {
        gap: 0.6rem !important;
    }
    
    .feature-card {
        margin-bottom: 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* 更小屏幕优化 */
@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    /* 更小屏幕的按钮优化 */
    .hero-btn-start,
    .hero-btn-more {
        font-size: 0.85rem !important;
        padding: 0.5rem 1.2rem !important;
    }
    
    .hero-section .btn-lg i {
        font-size: 0.8rem;
        margin-right: 0.3rem !important;
    }
    
    .hero-buttons {
        gap: 0.5rem !important;
    }
}

/* 超窄屏幕优化（如 iPhone 14/15 Pro Max 等） */
@media (max-width: 430px) {
    .hero-btn-start,
    .hero-btn-more {
        font-size: 0.8rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    .hero-section .btn-lg i {
        font-size: 0.75rem;
        margin-right: 0.25rem !important;
    }
    
    .hero-buttons {
        gap: 0.4rem !important;
    }
}

/* 极窄屏幕（小于 390px） */
@media (max-width: 390px) {
    .hero-btn-start,
    .hero-btn-more {
        font-size: 0.75rem !important;
        padding: 0.45rem 0.8rem !important;
    }
    
    .hero-section .btn-lg i {
        font-size: 0.7rem;
        margin-right: 0.2rem !important;
    }
    
    .hero-buttons {
        gap: 0.35rem !important;
    }
}

/* ========================================
   辅助类
======================================== */
.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.bg-white-50 {
    background-color: rgba(255, 255, 255, 0.5) !important;
}
