/* ===================================
   cards.css — 弹出卡片（模态层）
   =================================== */

/* ---- 卡片覆盖层 ---- */
.card-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.card-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---- 卡片容器 ---- */
.card-container {
    position: relative;
    width: 92%;
    max-width: 500px;
    max-height: 88vh;
    margin: 20px 0;
    background: linear-gradient(175deg, #FFFBF7 0%, #FFF5ED 30%, #FEF0E5 100%);
    border-radius: 24px;
    box-shadow:
        0 4px 10px rgba(0,0,0,0.08),
        0 12px 30px rgba(0,0,0,0.12),
        0 30px 70px rgba(0,0,0,0.22),
        0 0 0 1px rgba(255,215,0,0.3),
        0 0 0 3px var(--color-gold);
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.5s var(--ease-bounce);
}

/* 画廊/心想事成模式：更宽的卡片 */
.card-container.wide {
    max-width: 960px;
    max-height: 90vh;
}

.card-overlay.active .card-container {
    transform: scale(1);
}

/* ---- 关闭按钮 ---- */
.card-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    font-size: 1.1rem;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.card-close:hover {
    background: rgba(0,0,0,0.15);
    transform: rotate(90deg);
}

/* ---- 卡片内容 ---- */
.card-inner {
    padding: 30px 36px 34px;
}

/* 卡片标题 */
.card-title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-dark-purple);
    text-align: center;
    margin-bottom: 8px;
}

.card-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    color: #999;
    text-align: center;
    margin-bottom: 24px;
}

/* 照片区域 */
.card-photos {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.card-photo {
    flex-shrink: 0;
    width: 160px;
    height: 200px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-pink-light), var(--color-mint));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
}

/* 拍立得边框 */
.card-photo.polaroid {
    background: #fff;
    padding: 8px 8px 28px 8px;
    width: 170px;
    height: 210px;
}

.card-photo.polaroid .photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.card-photo-placeholder {
    font-size: 3rem;
    opacity: 0.5;
}

.card-photo-label {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    margin-top: 4px;
}

/* 祝福文字 */
.card-message {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
    text-align: center;
    padding: 20px;
    background: rgba(255, 215, 0, 0.08);
    border-radius: 12px;
    border-left: 3px solid var(--color-gold);
    margin: 16px 0;
}

/* 专属祝福编辑按钮 */
.blessing-edit-btn {
    padding: 8px 20px;
    border: 1px solid #e0d8e8;
    border-radius: 20px;
    background: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.25s ease;
}
.blessing-edit-btn:hover {
    border-color: var(--color-pink);
    color: var(--color-dark-purple);
    background: #fff5f8;
}

/* 未来约定特殊样式 */
.card-future-ticket {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #FFEAA7, #FFD93D);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(255, 200, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.card-future-ticket::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #FFF8F0;
    border-radius: 50%;
    transform: translateY(-50%);
}

.card-future-ticket::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #FFF8F0;
    border-radius: 50%;
    transform: translateY(-50%);
}

.ticket-title {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-dark-purple);
    margin-bottom: 8px;
}

.ticket-detail {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    color: var(--color-dark);
    line-height: 1.6;
}

/* 音频播放按钮（专属祝福卡片中） */
.audio-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px auto;
    padding: 12px 24px;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--color-pink), var(--color-purple));
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.audio-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 183, 197, 0.4);
}

/* ==================== 照片画廊 ==================== */
.gallery-sort-row {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 12px;
}
.gallery-sort-label {
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem; font-weight: 600;
    color: #9a8ea0;
}
.gallery-sort-select {
    padding: 5px 10px;
    border: 1px solid #e0d8e8; border-radius: 8px;
    background: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem; font-weight: 600;
    color: #6C5B7B;
    cursor: pointer;
    outline: none;
}
.gallery-sort-select:focus { border-color: #C7CEEA; }

.gallery-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

/* 每张卡片固定宽度，不压缩 */
.gallery-grid .gallery-card {
    flex-shrink: 0;
    width: 260px;
    scroll-snap-align: start;
}

.gallery-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
    position: relative;
}

.gallery-card:hover {
    transform: translateY(-4px);
}

.gallery-img-wrap {
    width: 100%;
    height: 180px;
    position: relative;
    background: linear-gradient(135deg, #f8f0ff, #fff0f5);
    overflow: hidden;
}

.gallery-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ccc;
}

.gallery-img-placeholder small {
    font-size: 0.7rem;
    margin-top: 4px;
}

/* 悬停显示编辑/删除按钮 */
.gallery-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-card:hover .gallery-actions {
    opacity: 1;
}

.gal-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.gal-btn:hover {
    transform: scale(1.15);
    background: #fff;
}

.gal-del:hover { background: #FFE0E0; }

/* 照片文字描述 */
.gallery-date {
    padding: 4px 12px 0;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.73rem;
    color: #b8a8c0;
    text-align: center;
}
.gallery-caption {
    padding: 6px 12px 10px;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    color: #5B4B5E;
    line-height: 1.5;
    text-align: center;
}

/* 添加按钮（右上角小按钮） */
.gallery-add-btn {
    position: absolute;
    top: 28px;
    right: 48px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed #ddd;
    background: rgba(255,255,255,0.9);
    color: #bbb;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
    padding: 0;
}

.gallery-add-btn:hover {
    border-color: var(--color-pink);
    color: var(--color-pink);
    background: #fff;
    transform: scale(1.1);
}

/* ==================== 编辑器弹窗 ==================== */
.editor-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
}

/* 记忆编辑器：挂载在 body 上，全屏独立 */
.editor-overlay.memory-editor {
    position: fixed;
    z-index: 70;
    border-radius: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.editor-overlay.memory-editor .editor-dialog {
    max-width: 500px;
}

.editor-dialog {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.editor-dialog h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    color: var(--color-dark-purple);
    margin-bottom: 16px;
    text-align: center;
}

.editor-dialog label {
    display: block;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #888;
    margin: 12px 0 6px;
}

.editor-dialog input[type="text"],
.editor-dialog textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #eee;
    border-radius: 10px;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.editor-dialog input[type="text"]:focus,
.editor-dialog textarea:focus {
    outline: none;
    border-color: var(--color-pink);
}

.editor-img-row {
    display: flex;
    gap: 8px;
}

.editor-img-row input[type="text"] {
    flex: 1;
}

.editor-img-row .gal-btn {
    width: 36px;
    height: auto;
    border-radius: 10px;
    font-size: 1.1rem;
}

.editor-preview {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    max-height: 150px;
}

.editor-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
}

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

.editor-cancel,
.editor-save {
    padding: 8px 24px;
    border-radius: 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-cancel {
    background: #f0f0f0;
    color: #888;
}

.editor-cancel:hover { background: #e0e0e0; }

.editor-save {
    background: linear-gradient(135deg, #FFB7C5, #C7CEEA);
    color: #fff;
}

.editor-save:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(255, 183, 197, 0.4);
}

/* ==================== 图片预览（全屏灯箱） ==================== */
.photo-preview-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.photo-preview-close {
    position: absolute; top: 20px; right: 24px;
    width: 44px; height: 44px;
    border: none; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s ease;
    z-index: 2;
}
.photo-preview-close:hover { background: rgba(255,255,255,0.3); transform: rotate(90deg); }
.photo-preview-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.4);
    cursor: default;
}

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
    .card-container {
        width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }
    .card-inner {
        padding: 24px 16px;
    }
    .card-title {
        font-size: 1.3rem;
    }
    .card-photo {
        width: 130px;
        height: 160px;
    }
    .card-photo.polaroid {
        width: 140px;
        height: 170px;
        padding: 6px 6px 22px 6px;
    }
}
