/**
 * 代付卡片与礼物气泡样式
 * Pay Card & Gift Bubble Styles
 */

/* === 月光香槟主题变量 === */
:root {
    --card-bg: #ffffff;
    --text-main-pay: #4e4840;
    --text-sub-pay: #7a756f;
    --text-muted: #b0aba5;

    /* 香槟金主题色 */
    --champagne-light: #fcfaf8;
    --champagne-gold: #d8c3a5;
    --champagne-dark: #8e7d5f;
    --champagne-glow: rgba(216, 195, 165, 0.3);

    /* 实体卡片背景 */
    --solid-card-bg: linear-gradient(145deg, #ffffff 0%, #fdfbf9 100%);
    --solid-border: rgba(216, 195, 165, 0.35);
    --solid-shadow: 0 8px 24px rgba(142, 125, 95, 0.06);

    /* 代付弹窗金色主题 */
    --pay-gold-light: #fffaf5;
    --pay-gold-lighter: #fff5eb;
    --pay-gold-bg: #fffcf8;
    --pay-gold-medium: #e8c98e;
    --pay-gold-dark: #d4af6a;
    --pay-gold-text: #8b6914;
    --pay-gold-text-light: #a08050;
    --pay-gold-text-medium: #c9a66b;
    --pay-border: rgba(212,175,140,0.2);
    --pay-border-medium: rgba(212,175,140,0.3);

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Noto Serif SC', serif;
    --font-script: 'Great Vibes', cursive;
}

/* === 代付弹窗动画 === */
@keyframes payOverlayIn { from{opacity:0} to{opacity:1} }
@keyframes paySlideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }

/* === 代付弹窗容器 === */
.pay-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    will-change: opacity;
    /* 注意：这是底部弹出的半屏面板，不需要顶部补偿 */
}

.pay-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.pay-modal-panel {
    background: #ffffff;
    border-radius: 32px 32px 0 0;
    height: 75vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.pay-modal-overlay.show .pay-modal-panel {
    transform: translateY(0);
}

/* === 顶部栏 === */
.pay-modal-header {
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pay-modal-title {
    font-family: var(--font-script);
    font-size: 32px;
    color: var(--champagne-dark);
    line-height: 1;
}

.pay-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 300;
}

/* === Tab切换 === */
.pay-modal-tabs {
    display: flex;
    padding: 0 24px 16px;
    gap: 20px;
    border-bottom: 1px solid var(--solid-border);
}

.pay-tab {
    background: transparent;
    border: none;
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--text-muted);
    padding-bottom: 8px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pay-tab i {
    font-size: 16px;
    font-weight: 400;
}

.pay-tab.active {
    color: var(--champagne-dark);
    font-weight: 700;
}

.pay-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    border-radius: 2px;
    background: var(--champagne-gold);
}

/* === 内容区 === */
.pay-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: none;
}

.pay-modal-content.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pay-modal-content.hidden {
    display: none;
}

/* === 购物车列表 === */
.pay-cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--solid-border);
    border-radius: 20px;
}

.pay-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    cursor: pointer;
    position: relative;
}

.pay-checkbox.checked {
    border-color: var(--champagne-gold);
    background: var(--champagne-gold);
}

.pay-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.pay-item-image,
.cart-item-pic {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #f0ebe1;
    object-fit: cover;
}

.pay-item-emoji {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg,#f5f5f5,#e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.pay-item-info,
.cart-item-info {
    flex: 1;
}

.pay-item-name,
.cart-item-name {
    font-size: 15px;
    color: var(--text-main-pay);
    margin-bottom: 6px;
    font-weight: 500;
}

.pay-item-price,
.cart-item-price {
    font-family: -apple-system, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--champagne-dark);
}

/* === 自定义表单 === */
.pay-custom-form {
    padding: 0;
}

.pay-form-group,
.pay-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.pay-form-label,
.pay-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--champagne-dark);
    font-weight: 600;
}

.pay-label span {
    font-family: var(--font-sans);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pay-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(252, 250, 248, 0.6);
    border: 1px solid rgba(216, 195, 165, 0.4);
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-main-pay);
    outline: none;
    transition: all 0.3s ease;
}

.pay-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
}

.pay-input:focus {
    background: #fff;
    border-color: var(--champagne-gold);
    box-shadow: 0 4px 12px rgba(216, 195, 165, 0.15);
}

.pay-textarea,
textarea.pay-input {
    resize: none;
    height: 80px;
}

/* === 自定义下拉框样式 === */
.custom-select-container {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 14px 16px;
    background: rgba(252, 250, 248, 0.6);
    border: 1px solid rgba(216, 195, 165, 0.4);
    border-radius: 12px;
    font-family: var(--font-serif);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.custom-select-trigger:hover {
    background: #fff;
    border-color: var(--champagne-gold);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(216, 195, 165, 0.3);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(142, 125, 95, 0.12);
    overflow-y: auto;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 220px;
}

.custom-select-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 14px 18px;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--text-main-pay);
    cursor: pointer;
    border-bottom: 1px dashed rgba(216, 195, 165, 0.2);
    transition: background 0.2s, color 0.2s;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: #fcfaf8;
    color: var(--champagne-dark);
    font-weight: 600;
}

.pay-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--pay-border-medium);
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    color: #2d3436;
}

/* === 底部栏 === */
.pay-modal-footer {
    padding: 16px 24px 32px;
    background: #ffffff;
    border-top: 1px solid var(--solid-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pay-modal-footer.single {
    justify-content: center;
}

.pay-total-wrap {
    display: flex;
    flex-direction: column;
}

.pay-total-label {
    font-size: 12px;
    color: var(--text-sub-pay);
    margin-bottom: 2px;
}

.pay-total-amount,
.pay-total-price {
    font-family: -apple-system, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--champagne-dark);
}

.pay-btn-primary {
    background: linear-gradient(135deg, #eaddc9, var(--champagne-gold));
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 24px;
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.pay-btn-primary:active {
    transform: scale(0.95);
}

.pay-btn-primary.full {
    width: 100%;
    padding: 14px;
}

/* === 空状态 === */
.pay-empty {
    text-align: center;
    padding: 40px 20px;
    color: #b2bec3;
}

.pay-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.pay-empty-text {
    margin-top: 12px;
    font-size: 14px;
}

.pay-empty-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #dfe6e9;
}

/* === 群聊成员选择 === */
.pay-member-select {
    padding: 16px 20px;
    border-bottom: 1px solid var(--pay-border);
    background: var(--pay-gold-light);
}

/* === 核心：代付卡片样式 === */
.pay-card {
    position: relative;
    width: 270px;
    background: var(--solid-card-bg);
    border: 1px solid var(--solid-border);
    border-radius: 24px;
    box-shadow: var(--solid-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    transform-origin: right center;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8) translateX(20px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

.pc-watermark {
    position: absolute;
    top: -10px;
    right: -15px;
    font-family: var(--font-script);
    font-size: 90px;
    color: rgba(216, 195, 165, 0.15);
    pointer-events: none;
    user-select: none;
    line-height: 1;
    z-index: 0;
}

.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

.pc-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--champagne-dark);
    letter-spacing: 0.5px;
}

.pc-brand i {
    font-size: 15px;
    font-weight: 400;
}

.pc-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.pc-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1;
}

.pc-title {
    font-family: var(--font-serif);
    font-size: 15px;
    color: #6b5e48;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pc-amount-wrap {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-top: 4px;
}

.pc-currency {
    font-size: 18px;
    font-weight: 600;
    color: var(--champagne-dark);
}

.pc-amount {
    font-family: -apple-system, "SF Pro Display", sans-serif;
    font-size: 38px;
    font-weight: 700;
    color: var(--champagne-dark);
    letter-spacing: -1px;
}

.pc-remark {
    font-family: var(--font-serif);
    font-size: 12px;
    color: var(--text-sub-pay);
    background: #fcfaf8;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 2px solid var(--champagne-gold);
    margin-top: 6px;
    font-style: italic;
    line-height: 1.4;
}

.pc-items-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.item-pic-small {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f0ebe1;
    border: 1px solid #ffffff;
}

.item-count {
    font-size: 12px;
    color: var(--text-sub-pay);
    margin-left: 4px;
    font-weight: 500;
}

.pc-desc {
    font-size: 12px;
    color: var(--text-sub-pay);
    margin-top: 6px;
}

.pc-relation {
    font-size: 11px;
    color: var(--text-sub-pay);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pc-relation i {
    font-size: 12px;
}

.pc-relation span {
    color: var(--champagne-dark);
    font-weight: 600;
}

.pc-receiver {
    font-size: 12px;
    color: var(--champagne-dark);
    margin-top: 4px;
}

.pc-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px dashed var(--solid-border);
    z-index: 1;
}

.status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--champagne-gold);
    animation: breathe 2s infinite ease-in-out;
    will-change: opacity, transform;
}

.status-text {
    font-size: 12px;
    color: var(--champagne-dark);
    font-weight: 500;
}

@keyframes breathe {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* === 状态：已支付 (Paid) === */
.pay-card.paid,
.pay-card.is-paid {
    background: #fcfaf8;
    border-color: #eae5de;
    box-shadow: none;
    opacity: 0.7;
}

.pay-card.paid .status-pulse,
.pay-card.is-paid .status-pulse {
    display: none;
}

.pay-card.paid .status-text,
.pay-card.is-paid .status-text {
    color: var(--text-muted);
}

/* 盖章动画 */
.stamp-paid,
.pc-stamp {
    position: absolute;
    right: 16px;
    bottom: 26px;
    font-family: var(--font-script);
    font-size: 36px;
    color: var(--champagne-dark);
    border: 2px solid var(--champagne-dark);
    border-radius: 12px;
    padding: 0 16px;
    transform: rotate(-15deg) scale(2);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.pay-card.paid .stamp-paid,
.pay-card.paid .pc-stamp,
.pay-card.is-paid .pc-stamp {
    animation: stampDrop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes stampDrop {
    0% { opacity: 0; transform: rotate(-25deg) scale(2.5); }
    50% { opacity: 1; transform: rotate(-10deg) scale(0.9); }
    100% { opacity: 0.9; transform: rotate(-15deg) scale(1); }
}

/* === 礼物气泡样式 === */
.gift-bubble {
    background: var(--gift-bubble-bg, #fff);
    border: 2px solid var(--gift-bubble-border, #f0f0f0);
    border-radius: 16px;
    padding: 16px;
    max-width: 280px;
    box-shadow: var(--gift-bubble-shadow, 0 2px 8px rgba(0,0,0,0.08));
    position: relative;
    overflow: hidden;
}

.gift-deco {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: var(--gift-icon-bg, rgba(161, 140, 209, 0.1));
    border-radius: 50%;
}

.gift-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.gift-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.gift-info {
    flex: 1;
    min-width: 0;
}

.gift-title {
    font-size: 13px;
    color: var(--gift-text-main, #333);
    font-weight: 700;
}

.gift-target {
    font-size: 11px;
    color: var(--gift-text-sub, #666);
}

.gift-name {
    font-size: 13px;
    color: var(--gift-text-sub, #666);
    margin-top: 8px;
}

.msg-right .gift-bubble {
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    color: #fff;
    border-color: transparent;
}
