:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fb;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航样式 */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.main-nav {
    display: flex;
    gap: 30px;
}

.nav-item {
    text-decoration: none;
    color: var(--gray-color);
    font-weight: 500;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary-color);
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.add-btn:hover {
    background-color: var(--secondary-color);
}

/* 回忆墙布局 */
.memory-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding-bottom: 50px;
}

.memory-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.memory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.memory-image {
    position: relative;
    width: 100%;
    padding-bottom: 60%;  /* 保持16:9.6的宽高比 */
    background-color: #f8f9fa;
    overflow: hidden;
}

.memory-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.memory-image.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
}

.memory-image.empty::after {
    content: "暂无图片";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #adb5bd;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.memory-image.empty:hover::after {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: #adb5bd;
    color: #6c757d;
    transform: translate(-50%, -50%) scale(1.05);
}

/* 记忆卡片内容布局优化 */
.memory-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.memory-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memory-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
    line-height: 1.4;
}

/* 元信息样式重新设计 */
.memory-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    margin-top: -2px;
}

.memory-date,
.memory-location {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    color: #64748b;
}

/* 日期标签样式 */
.memory-date {
    padding-right: 12px;
}

.memory-date::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 12px;
    background: #e2e8f0;
}

.memory-date svg {
    width: 13px;
    height: 13px;
    color: #3b82f6;
}

/* 地点标签样式 */
.memory-location {
    padding-left: 2px;
}

.memory-location svg {
    width: 13px;
    height: 13px;
    color: #10b981;
}

/* 悬停效果 */
.memory-date:hover,
.memory-location:hover {
    transform: translateY(-1px);
}

.memory-date:hover {
    color: #3b82f6;
}

.memory-location:hover {
    color: #10b981;
}

/* 添加装饰性元素 */
.memory-date span,
.memory-location span {
    position: relative;
    z-index: 1;
}

.memory-date span::after,
.memory-location span::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.memory-date:hover span::after {
    transform: scaleX(1);
    background: rgba(59, 130, 246, 0.2);
}

.memory-location:hover span::after {
    transform: scaleX(1);
    background: rgba(16, 185, 129, 0.2);
}

/* 内容布局优化 */
.memory-text {
    margin-top: 4px;
}

.memory-people {
    margin-top: 12px;
}

/* 人物标签区域优化 */
.memory-people {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 12px;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.person-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(67, 97, 238, 0.1);
    letter-spacing: 0.2px;
}

.person-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(67, 97, 238, 0.15);
}

.person-tag svg {
    width: 12px;
    height: 12px;
    opacity: 0.9;
}

/* 移除旧的标签样式 */
.location-tag {
    display: none;
}

/* 标签基础样式 */
.tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

.modal-content {
    background-color: white;
    width: 100%;
    max-width: 500px;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin: auto;
    height: auto;
    display: flex;
    flex-direction: column;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: inherit;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cancel-btn {
    background-color: #e9ecef;
    color: var(--gray-color);
}

.submit-btn {
    background-color: var(--primary-color);
    color: white;
}

.cancel-btn,
.submit-btn {
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cancel-btn:hover {
    background-color: #dee2e6;
}

.submit-btn:hover {
    background-color: var(--secondary-color);
}

/* 操作按钮组样式 */
.action-buttons {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.action-buttons .action-btn {
    position: relative;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.memory-card:hover .action-buttons .action-btn {
    opacity: 1;
    transform: translateY(0);
}

.action-buttons .action-btn:nth-child(2) {
    transition-delay: 0.05s;
}

/* 操作按钮样式 */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    transform: translateY(-5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0 !important;  /* 强制默认隐藏 */
}

.memory-card:hover .action-btn {
    opacity: 0.7 !important;  /* 悬浮时显示，半透明 */
    transform: translateY(0);
}

.memory-card:hover .action-btn:hover {
    opacity: 1 !important;  /* 鼠标悬浮在按钮上时完全不透明 */
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.edit-btn {
    color: #0d6efd;
}

.action-btn.edit-btn:hover {
    background-color: #0d6efd;
    color: white;
}

.action-btn.delete-btn {
    color: #dc3545;
}

.action-btn.delete-btn:hover {
    background-color: #dc3545;
    color: white;
}

.action-btn:disabled {
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.8);
}

.action-btn:disabled:hover {
    opacity: 0.5 !important;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.action-btn:hover svg {
    transform: scale(1.1);
}

/* 当前图片样式 */
.current-photo {
    position: relative;
    display: inline-block;
}

.remove-photo {
    position: absolute;
    top: 15px;
    right: 5px;
    padding: 6px 12px;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.remove-photo:hover {
    background-color: #dc3545;
}

/* 删除旧的删除按钮样式 */
.card-actions {
    display: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .app-container {
        padding: 0 15px;
    }

    .app-header {
        padding: 15px 0;
        margin-bottom: 20px;
        flex-wrap: wrap;
        gap: 15px;
    }

    .logo {
        font-size: 20px;
        flex: 1;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        gap: 12px;
        padding-left: 5px;
    }

    .nav-item {
        font-size: 14px;
        padding: 8px 12px;
        position: relative;
    }

    .nav-item:not(:last-child)::after {
        content: "";
        position: absolute;
        right: -6px;
        top: 50%;
        transform: translateY(-50%);
        height: 12px;
        width: 1px;
        background-color: var(--gray-color);
        opacity: 0.3;
    }

    .add-btn {
        order: 2;
        padding: 8px 15px;
        font-size: 14px;
    }

    .modal-overlay {
        padding: 15px;
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 0;
        padding: 20px;
        min-height: auto;
        width: 100%;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-actions {
        margin-top: 20px;
        padding-bottom: 10px;
    }

    .photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
}

/* 小屏幕手机适配 */
@media (max-width: 360px) {
    .app-header {
        padding: 12px 0;
    }

    .logo {
        font-size: 18px;
    }

    .main-nav {
        gap: 8px;
    }

    .nav-item {
        font-size: 13px;
        padding: 8px 10px;
    }

    .nav-item:not(:last-child)::after {
        right: -4px;
    }

    .add-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Loading 遮罩层样式优化 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    display: flex;
    opacity: 1;
}

.loading-content {
    background: white;
    padding: 24px 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.loading-overlay.active .loading-content {
    transform: translateY(0);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

.loading-text {
    color: var(--dark-color);
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: white;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.toast-content svg {
    flex-shrink: 0;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success svg {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error svg {
    color: #ef4444;
}

.toast span {
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
}

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

/* 禁用按钮样式 */
.submit-btn:disabled,
.cancel-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 现代化的图片上传按钮样式 */
.image-upload-container {
    position: relative;
    width: 100%;
    min-height: 120px;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-top: 8px;
}

.image-upload-container:hover {
    border-color: var(--primary-color);
    background: #f0f2f5;
}

.image-upload-container input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 24px;
    color: #6c757d;
    margin-bottom: 8px;
}

.upload-text {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
}

/* 图片预览区域样式 */
.image-preview {
    width: 100%;
    margin-top: 8px;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    display: none; /* 默认隐藏 */
}

.image-preview.has-image {
    display: block; /* 有图片时显示 */
}

.image-preview img {
    width: 100%;
    height: 300px; /* 固定高度，避免图片变形 */
    object-fit: contain; /* 保持图片比例 */
    background: #f8f9fa;
    display: block;
    border-radius: var(--border-radius);
}

.image-preview .remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #dc3545;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.image-preview .remove-image:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.image-preview .remove-image svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.image-preview .remove-image:hover svg {
    transform: scale(1.1);
}

/* 当有图片时隐藏上传区域 */
.image-upload-container.hidden {
    display: none;
}