/* 图片源选择器样式 */
.source-selector-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.source-selector-container.visible {
    display: block;
}

.source-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9999; /* 确保层级高于其他元素 */
}

.source-selector-modal {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    width: 320px;
    overflow: hidden;
    position: relative;
    animation: fadeInUp 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    transform: translateZ(0);
    margin: 0 auto; /* 确保居中 */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.source-selector-header {
    text-align: center;
    margin-bottom: 0;
    font-size: 17px;
    font-weight: bold;
    padding: 18px 15px;
    color: #333;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#source-list {
    max-height: 55vh;
    overflow-y: auto;
    padding: 10px 15px 15px;
    scrollbar-width: thin;
}

#source-list::-webkit-scrollbar {
    width: 5px;
}

#source-list::-webkit-scrollbar-track {
    background: #f5f5f5;
}

#source-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}

#source-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.source-item {
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 10px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.source-item:last-child {
    margin-bottom: 0;
}

.source-item:hover {
    background-color: #f0f3f8;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.source-item.selected {
    background-color: #3a4b66;
    color: white;
    border-color: #3a4b66;
    box-shadow: 0 4px 10px rgba(58, 75, 102, 0.3);
}

.source-item.selected::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 5px;
    background-color: #5c7bbd;
}

.source-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #333;
}

.source-item.selected .source-name {
    color: white;
}

.source-desc {
    font-size: 13px;
    color: #777;
    line-height: 1.4;
}

.source-item.selected .source-desc {
    color: rgba(255, 255, 255, 0.85);
}

.source-selector-footer {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
}

.cancel-source-button {
    display: block;
    width: 85%;
    padding: 12px 0;
    margin: 0 auto;
    background-color: #3a4b66;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(58, 75, 102, 0.25);
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cancel-source-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.cancel-source-button:hover::before {
    left: 100%;
}

.cancel-source-button:hover {
    background-color: #2d3c54;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(58, 75, 102, 0.35);
}

.cancel-source-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(58, 75, 102, 0.25);
}

/* 源切换按钮样式 */
#image-source {
    position: fixed;
    /* right: 1rem; */
    bottom: 10rem;
    z-index: 950;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

/* 加载提示样式 */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* 切换成功提示 */
.source-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(58, 75, 102, 0.9);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    z-index: 10000;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    animation: toastPulse 2s infinite;
}

@keyframes toastPulse {
    0% {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    }
    50% {
        box-shadow: 0 6px 20px rgba(92, 123, 189, 0.4);
    }
    100% {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    }
}
