/**
 * 移动端编辑功能样式
 */

/* 移动端编辑按钮 */
.mobile-edit-button {
    position: fixed;
    z-index: 10000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 
        0 8px 20px rgba(102, 126, 234, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0) translateY(10px);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.mobile-edit-button.show {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
    animation: editButtonPop 0.3s ease-out;
}

.mobile-edit-button.hidden {
    transform: scale(0) translateY(10px);
    opacity: 0;
    pointer-events: none;
}

@keyframes editButtonPop {
    0% {
        transform: scale(0.8) translateY(10px);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) translateY(-2px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.edit-button-content {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.edit-button-content i {
    font-size: 16px;
}

.mobile-edit-button:active {
    transform: scale(0.95) translateY(1px);
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 移动端编辑元素高亮 */
.mobile-edit-highlight {
    background: rgba(102, 126, 234, 0.1) !important;
    outline: 2px dashed #667eea !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
    animation: mobileHighlight 1s ease-in-out;
    position: relative;
}

@keyframes mobileHighlight {
    0%, 100% {
        background: rgba(102, 126, 234, 0.1);
    }
    50% {
        background: rgba(102, 126, 234, 0.2);
    }
}

/* 移动端编辑状态 */
.mobile-editing {
    background: rgba(102, 126, 234, 0.2) !important;
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
    border-radius: 6px !important;
    animation: mobileEditPulse 1.5s ease-in-out infinite;
}

@keyframes mobileEditPulse {
    0%, 100% { background: rgba(102, 126, 234, 0.2); }
    50% { background: rgba(102, 126, 234, 0.3); }
}

/* 移动端内联编辑器 */
.mobile-inline-editor {
    background: white !important;
    color: #333 !important;
    border: 2px solid #667eea !important;
    border-radius: 8px !important;
    padding: 8px !important;
    font-size: 16px !important;
    width: 100% !important;
    min-height: 40px !important;
    resize: vertical !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3) !important;
    outline: none !important;
    backdrop-filter: blur(10px) !important;
}

.mobile-inline-editor:focus {
    border-color: #764ba2 !important;
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4) !important;
}

/* 移动端编辑提示 */
.mobile-edit-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10001;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: all 0.3s ease-out;
    pointer-events: none;
}

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

/* 保存成功提示 */
.mobile-save-hint {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%) !important;
    animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
    0% { transform: translateX(-50%) scale(0.8); }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); }
}

/* 针对小屏幕的特殊处理 */
@media (max-width: 480px) {
    .mobile-edit-button {
        padding: 6px 12px;
        border-radius: 20px;
    }
    
    .edit-button-content {
        font-size: 13px;
        gap: 4px;
    }
    
    .edit-button-content i {
        font-size: 14px;
    }
    
    .mobile-edit-hint {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 20px;
    }
}

/* 长按提示动画 */
@keyframes longPressHint {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0.1);
    }
}

[data-editable]:active {
    animation: longPressHint 0.5s ease-out;
}

/* 触摸反馈 */
@media (hover: none) and (pointer: coarse) {
    [data-editable] {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
        tap-highlight-color: rgba(102, 126, 234, 0.2);
    }
    
    [data-editable]:active {
        background-color: rgba(102, 126, 234, 0.1);
        transition: background-color 0.1s ease;
    }
}

/* 防止文本选择干扰 */
.mobile-edit-button {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 确保编辑按钮在所有元素之上 */
.mobile-edit-button {
    position: fixed !important;
    z-index: 2147483647 !important; /* 最大z-index值 */
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    .mobile-inline-editor {
        background: #2d3748 !important;
        color: #e2e8f0 !important;
        border-color: #667eea !important;
    }
    
    .mobile-edit-hint {
        background: rgba(45, 55, 72, 0.95) !important;
        border: 1px solid rgba(102, 126, 234, 0.3);
    }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    .mobile-edit-button,
    .mobile-edit-highlight,
    .mobile-editing,
    .mobile-edit-hint {
        animation: none;
        transition: opacity 0.3s ease;
    }
}
