/**
 * Selection Guide - 选品功能分步引导动画
 * Modern step-by-step onboarding experience
 */

/* ====== 引导遮罩层 - 使用半透明而非全黑 ====== */
.guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.guide-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ====== 高亮区域 - 使用clip-path实现镂空效果 ====== */
.guide-spotlight {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.guide-spotlight.active {
    opacity: 1;
}

/* 高亮边框环 */
.guide-spotlight-ring {
    position: fixed;
    z-index: 10001;
    border: 4px solid #ff758c;
    border-radius: 16px;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: scale(0.9);
    box-shadow:
        0 0 20px rgba(255, 117, 140, 0.5),
        0 0 40px rgba(255, 117, 140, 0.3),
        inset 0 0 20px rgba(255, 117, 140, 0.1);
}

.guide-spotlight-ring.active {
    opacity: 1;
    transform: scale(1);
}

.guide-spotlight-ring.circle {
    border-radius: 50%;
}

/* 高亮脉冲动画 */
.guide-spotlight-ring::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid rgba(255, 117, 140, 0.5);
    border-radius: inherit;
    animation: spotlightPulse 2s ease-in-out infinite;
}

.guide-spotlight-ring::after {
    content: '';
    position: absolute;
    top: -16px;
    left: -16px;
    right: -16px;
    bottom: -16px;
    border: 2px solid rgba(255, 117, 140, 0.3);
    border-radius: inherit;
    animation: spotlightPulse 2s ease-in-out infinite 0.3s;
}

@keyframes spotlightPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.5;
    }
}

/* 目标元素高亮 - 通过提升z-index让元素可见可点击 */
/* 重要：不改变 position 属性，因为 z-index 对已有定位的元素（absolute/fixed/relative）本身就生效 */
.guide-target-highlight {
    z-index: 10002 !important;
    animation: targetGlow 1.5s ease-in-out infinite;
}

/* 浮动按钮父容器在引导时提升层级 */
.wishlist-fab.guide-fab-elevated {
    z-index: 10001 !important;
}

@keyframes targetGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(255, 117, 140, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(255, 117, 140, 0.9));
    }
}

/* 交互提示闪烁 */
.guide-click-hint {
    animation: clickHint 0.8s ease-in-out infinite;
}

@keyframes clickHint {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ====== 提示框容器 ====== */
.guide-tooltip {
    position: fixed;
    z-index: 10002;
    max-width: 380px;
    min-width: 320px;
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.25),
        0 10px 30px rgba(255, 117, 140, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 提示框箭头 */
.guide-tooltip-arrow {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.08);
    z-index: -1;
}

.guide-tooltip.arrow-top .guide-tooltip-arrow {
    top: -10px;
    left: 50%;
    margin-left: -10px;
}

.guide-tooltip.arrow-bottom .guide-tooltip-arrow {
    bottom: -10px;
    left: 50%;
    margin-left: -10px;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.08);
}

.guide-tooltip.arrow-left .guide-tooltip-arrow {
    left: -10px;
    top: 50%;
    margin-top: -10px;
}

.guide-tooltip.arrow-right .guide-tooltip-arrow {
    right: -10px;
    top: 50%;
    margin-top: -10px;
    box-shadow: 3px -3px 8px rgba(0, 0, 0, 0.08);
}

/* ====== 提示框头部 ====== */
.guide-tooltip-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.guide-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s ease;
}

.guide-step-dot.active {
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(255, 117, 140, 0.4);
}

.guide-step-dot.completed {
    background: #4ade80;
}

.guide-step-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    margin-left: 8px;
}

.guide-skip-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.guide-skip-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* ====== 提示框内容 ====== */
.guide-tooltip-content {
    padding: 20px 24px;
}

.guide-step-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(255, 117, 140, 0.3);
    animation: iconBounce 2s ease-in-out infinite;
}

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

.guide-step-icon.step-2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.guide-step-icon.step-3 {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.guide-step-icon.step-4 {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
}

.guide-step-icon.step-5 {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.guide-step-icon.step-6 {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    box-shadow: 0 8px 20px rgba(74, 222, 128, 0.3);
}

.guide-step-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.4;
}

.guide-step-desc {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 0;
}

/* 高亮文字 */
.guide-highlight {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(255, 117, 140, 0.1) 0%, rgba(255, 126, 179, 0.1) 100%);
    border-radius: 6px;
    color: #ff758c;
    font-weight: 600;
}

/* ====== 提示框底部 ====== */
.guide-tooltip-footer {
    padding: 16px 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #f3f4f6;
}

.guide-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.guide-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.guide-btn-secondary:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.guide-btn-primary {
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 117, 140, 0.35);
    flex: 1;
    justify-content: center;
}

.guide-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 117, 140, 0.45);
}

.guide-btn-primary:active {
    transform: translateY(0);
}

.guide-btn i {
    font-size: 0.85rem;
}

/* ====== 手指指示动画 ====== */
.guide-finger {
    position: fixed;
    z-index: 10003;
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.guide-finger.active {
    opacity: 1;
    animation: fingerTap 1.5s ease-in-out infinite;
}

@keyframes fingerTap {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-5px, -5px) scale(0.9);
    }
}

/* ====== 欢迎弹窗 ====== */
.guide-welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.guide-welcome-modal.active {
    opacity: 1;
    visibility: visible;
}

.guide-welcome-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.guide-welcome-content {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%);
    border-radius: 28px;
    padding: 40px;
    max-width: 460px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-welcome-modal.active .guide-welcome-content {
    transform: scale(1) translateY(0);
}

.guide-welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 15px 35px rgba(255, 117, 140, 0.35);
    animation: welcomeFloat 3s ease-in-out infinite;
}

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

.guide-welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
}

.guide-welcome-desc {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 28px;
}

.guide-welcome-features {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}

.guide-welcome-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.guide-welcome-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: linear-gradient(135deg, rgba(255, 117, 140, 0.1) 0%, rgba(255, 126, 179, 0.1) 100%);
    color: #ff758c;
}

.guide-welcome-feature-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4b5563;
}

.guide-welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guide-welcome-start-btn {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(255, 117, 140, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.guide-welcome-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 117, 140, 0.45);
}

.guide-welcome-skip-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.guide-welcome-skip-btn:hover {
    color: #6b7280;
}

/* ====== 完成庆祝 ====== */
.guide-complete-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.guide-complete-modal.active {
    opacity: 1;
    visibility: visible;
}

.guide-complete-content {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%);
    border-radius: 28px;
    padding: 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-complete-modal.active .guide-complete-content {
    transform: scale(1);
}

.guide-complete-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 15px 35px rgba(74, 222, 128, 0.35);
    animation: completeCheck 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes completeCheck {
    0% { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.guide-complete-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.guide-complete-desc {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 24px;
}

.guide-complete-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.35);
}

.guide-complete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 222, 128, 0.45);
}

/* ====== 彩带/礼花效果 ====== */
.guide-confetti {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10006;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 20px;
    top: -20px;
    animation: confettiFall 3s ease-in-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .guide-tooltip {
        max-width: 320px;
        min-width: 280px;
    }

    .guide-tooltip-content {
        padding: 16px 20px;
    }

    .guide-tooltip-header {
        padding: 16px 20px 0;
    }

    .guide-tooltip-footer {
        padding: 12px 20px 16px;
    }

    .guide-step-title {
        font-size: 1.1rem;
    }

    .guide-step-desc {
        font-size: 0.9rem;
    }

    .guide-welcome-content {
        padding: 28px;
    }

    .guide-welcome-features {
        gap: 20px;
    }

    .guide-welcome-feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ====== 暗色模式支持 ====== */
@media (prefers-color-scheme: dark) {
    .guide-tooltip {
        background: linear-gradient(145deg, #1f2937 0%, #111827 100%);
        box-shadow:
            0 25px 60px rgba(0, 0, 0, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }

    .guide-tooltip-arrow {
        background: #1f2937;
    }

    .guide-step-title {
        color: #f9fafb;
    }

    .guide-step-desc {
        color: #9ca3af;
    }

    .guide-tooltip-footer {
        border-top-color: #374151;
    }
}

/* ====== 重新查看引导按钮 ====== */
.guide-replay-btn {
    position: fixed;
    bottom: 180px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.guide-replay-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.guide-replay-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.guide-replay-btn i {
    font-size: 1.2rem;
    color: white;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .guide-replay-btn {
        bottom: 160px;
        right: 16px;
        width: 38px;
        height: 38px;
    }

    .guide-replay-btn i {
        font-size: 1rem;
    }
}
