/**
 * 主样式文件
 * 定义首页的所有样式和布局
 * @file main.css
 */

/* ========================================
   全局样式
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ec4899;
    --secondary-color: #a855f7;
}

.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #ffeef8 0%, #fff5f7 100%);
    min-height: 100vh;
    padding: 0;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   导航栏样式
   ======================================== */

.nav-bar {
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-right {
    display: flex;
    gap: 1rem;
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ========================================
   页面标题样式
   ======================================== */

.header {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 30px;
    position: relative;
}

.header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.header p {
    color: #64748b;
    font-size: 1.1rem;
}

/* ========================================
   天数计时器样式
   ======================================== */

.day-counter {
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 20px 40px rgba(236, 72, 153, 0.3);
}

.counter-value {
    font-size: 5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.counter-label {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* ========================================
   回忆卡片容器
   ======================================== */

.memories-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 80px;
}

/* ========================================
   回忆卡片样式
   ======================================== */

.memory-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out;
}

.memory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 回忆卡片 - 图片区域 */
.memory-image {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e3e7ed 100%);
}

.memory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.memory-image img.lazy-image {
    opacity: 0;
}

.memory-image img.lazy-image.loaded {
    opacity: 1;
}

.memory-card:hover .memory-image img {
    transform: scale(1.05);
}

.memory-mood {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* 回忆卡片 - 内容区域 */
.memory-content {
    padding: 30px;
}

.memory-date {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.memory-mood-inline {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.memory-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 15px;
    line-height: 1.4;
}

.memory-text {
    color: #475569;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 删除按钮 */
.delete-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* ========================================
   悬浮上传按钮
   ======================================== */
.upload-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4);
    transition: transform 0.3s ease;
}

.upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(236, 72, 153, 0.5);
}

/* 淡出动画 */
@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ========================================
   加载状态样式
   ======================================== */

.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(236, 72, 153, 0.1);
    border-top-color: #ec4899;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   空状态样式
   ======================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state-text {
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1.8;
}

.retry-btn {
    margin-top: 20px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(236, 72, 153, 0.4);
}

/* ========================================
   响应式设计
   ======================================== */

/* 响应式 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    #app {
        padding: 1rem;
    }
    
    .nav-container {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-left {
        flex-direction: row;
        gap: 0.5rem;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-link {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .nav-right {
        width: 100%;
    }
    
    .btn-secondary {
        width: 100%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .day-counter {
        padding: 30px 20px;
        border-radius: 15px;
    }
    
    .counter-value {
        font-size: 3rem;
    }
    
    .counter-label {
        font-size: 1rem;
    }
    
    .memory-card {
        border-radius: 15px;
    }
    
    .memory-image {
        height: 250px;
    }
    
    .memory-title {
        font-size: 1.4rem;
    }
    
    .upload-btn {
        width: 56px;
        height: 56px;
        font-size: 2rem;
        bottom: 20px;
        right: 20px;
    }
}
