/**
 * 豆芽BabyGrowth亲子成长记录系统 - 自定义样式
 * 实现响应式布局和短视频式滑动体验
 */

/* ===== 基础变量 ===== */
:root {
    --pink-color: #ffcce6;
    --pink-dark: #ffb3d9;
    --pink-light: #ffe9f2;
    --text-dark: #343a40;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --border-radius: 0.375rem;
    --transition: all 0.3s ease;
}

/* ===== 全局样式 ===== */
body {
    font-family: 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
}

/* ===== 导航栏 ===== */
.navbar {
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pink-dark) !important;
}

.nav-link {
    font-weight: 500;
    color: var(--text-dark) !important;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--pink-dark) !important;
}

/* ===== 按钮样式 ===== */
.btn-pink {
    background-color: var(--pink-color);
    border-color: var(--pink-color);
    color: var(--text-dark);
    font-weight: 500;
}

.btn-pink:hover, .btn-pink:focus {
    background-color: var(--pink-dark);
    border-color: var(--pink-dark);
    color: var(--text-dark);
}

.btn-outline-pink {
    border-color: var(--pink-color);
    color: var(--pink-dark);
}

.btn-outline-pink:hover, .btn-outline-pink:focus {
    background-color: var(--pink-color);
    border-color: var(--pink-color);
    color: var(--text-dark);
}

.bg-gradient-pink {
    background: linear-gradient(135deg, var(--pink-color) 0%, var(--pink-dark) 100%);
}

.text-pink {
    color: var(--pink-dark) !important;
}

.bg-pink-light {
    background-color: var(--pink-light);
}

/* ===== 横幅区域 ===== */
.hero-section {
    background: linear-gradient(135deg, #ffcce6 0%, #ffb3d9 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/pattern.svg') repeat;
    opacity: 0.1;
}

.hero-section > .container {
    position: relative;
    z-index: 1;
}

/* ===== 功能卡片 ===== */
.feature-card {
    border: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--pink-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.feature-icon i {
    font-size: 1.5rem;
}

/* ===== 宝宝卡片 ===== */
.baby-card {
    border: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.baby-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.baby-avatar .avatar-md {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.avatar-placeholder {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
}

/* ===== 时间轴卡片 ===== */
.timeline-section {
    background-color: #f8f9fa;
}

.post-card {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.post-content {
    min-height: 60px;
}

.post-media {
    position: relative;
}

.media-item {
    overflow: hidden;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.media-item img, 
.media-item video {
    transition: var(--transition);
}

.media-item:hover img,
.media-item:hover video {
    transform: scale(1.05);
}

.video-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    opacity: 0;
    transition: var(--transition);
}

.video-container:hover .video-overlay {
    opacity: 1;
}

.more-media {
    margin-top: 0.5rem;
}

/* ===== Swiper 样式 ===== */
.timelineSwiper {
    padding: 1rem 0;
}

.swiper-slide {
    height: auto;
}

.swiper-pagination-bullet-active {
    background: var(--pink-dark);
}

.swiper-button-next, .swiper-button-prev {
    background: var(--pink-color);
    color: var(--text-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.swiper-button-next::after, .swiper-button-prev::after {
    font-size: 1rem;
    font-weight: bold;
}

.swiper-button-next:hover, .swiper-button-prev:hover {
    background: var(--pink-dark);
}

/* ===== 空状态 ===== */
.empty-section {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
}

/* ===== 媒体模态框 ===== */
#mediaModal .modal-body {
    padding: 0;
    max-height: 80vh;
    overflow: auto;
}

#mediaModal .modal-body img,
#mediaModal .modal-body video {
    max-width: 100%;
    max-height: 100%;
}

/* ===== 页脚 ===== */
footer {
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--text-muted);
    transition: var(--transition);
}

footer a:hover {
    color: var(--pink-dark);
}

/* ===== 工具类 ===== */
.text-decoration-none {
    text-decoration: none !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
    .feature-card, .baby-card, .post-card {
        margin-bottom: 1rem;
    }
    
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .timelineSwiper {
        padding: 0.5rem 0;
    }
    
    .swiper-button-next, .swiper-button-prev {
        width: 30px;
        height: 30px;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
    }
    
    .feature-icon i {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .d-flex.gap-3 {
        gap: 0.5rem !important;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* ===== 动画效果 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.feature-card, .baby-card, .post-card {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.baby-avatar:hover, .feature-icon:hover {
    animation: pulse 0.8s infinite;
}

/* ===== 深色模式支持 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f8f9fa;
        --text-muted: #adb5bd;
        --border-color: #495057;
        --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
        --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.6);
    }
    
    body {
        background-color: #212529;
        color: var(--text-dark);
    }
    
    .navbar, .footer {
        background-color: #343a40 !important;
        border-color: var(--border-color);
    }
    
    .timeline-section {
        background-color: #343a40;
    }
    
    .card {
        background-color: #495057;
        color: var(--text-dark);
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar, .hero-section, .feature-section, .empty-section, .footer {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 1rem;
        break-inside: avoid;
    }
}

/* 短视频式交互效果 */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.media-item:hover .video-controls {
    opacity: 1;
}

.video-progress {
    height: 3px;
    background: rgba(255,255,255,0.3);
    width: 0%;
    transition: width 0.3s ease;
}

.video-timer {
    font-size: 0.75rem;
    margin-left: auto;
}

.swiper-progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--pink-color);
    width: 0%;
    z-index: 1000;
    transition: width 0.3s ease;
}

.touch-active {
    cursor: grabbing;
}

.touch-active * {
    cursor: grabbing !important;
}

/* 滑动提示动画 */
@keyframes swipeHint {
    0% { transform: translateX(-10px); opacity: 0.3; }
    50% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(10px); opacity: 0.3; }
}

.swiper-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--pink-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    opacity: 0;
    z-index: 10;
    pointer-events: none;
}

.show-swiper-hint .swiper-hint {
    animation: swipeHint 1s ease;
}