/* 自动favicon功能相关样式 */

/* favicon加载状态样式 */
.projectItemRight img[data-favicon-loading="true"] {
    opacity: 0.6;
    transform: scale(0.9);
    filter: grayscale(50%);
    transition: all 0.3s ease;
}

.projectItemRight img[data-favicon-loaded="true"] {
    opacity: 1;
    transform: scale(1);
    filter: none;
    transition: all 0.3s ease;
}

.projectItemRight img[data-favicon-loaded="error"] {
    opacity: 0.8;
    filter: sepia(20%);
}

/* 自动favicon功能指示器 */
.projectList[data-auto-favicon="true"] {
    position: relative;
}

.projectList[data-auto-favicon="true"]::before {
    content: "🔄 自动识别图标中...";
    position: absolute;
    top: -30px;
    right: 0;
    font-size: 12px;
    color: #888;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.projectList[data-auto-favicon="true"].favicon-loading::before {
    opacity: 1;
}

.projectList[data-auto-favicon="true"].favicon-complete::before {
    content: "✅ 图标识别完成";
    opacity: 1;
}

/* 悬停时显示原始图标 */
.projectItem[data-favicon-auto="true"]:hover .projectItemRight img,
.projectItem[data-favicon-smart="true"]:hover .projectItemRight img {
    position: relative;
}

.projectItem[data-favicon-auto="true"]:hover .projectItemRight img::after,
.projectItem[data-favicon-smart="true"]:hover .projectItemRight img::after {
    content: "🔄";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.projectItem[data-favicon-auto="true"][data-favicon-loaded="true"]:hover .projectItemRight img::after,
.projectItem[data-favicon-smart="true"][data-favicon-loaded="true"]:hover .projectItemRight img::after {
    content: "✅";
    opacity: 1;
}

.projectItem[data-favicon-auto="true"][data-favicon-loaded="error"]:hover .projectItemRight img::after,
.projectItem[data-favicon-smart="true"][data-favicon-loaded="error"]:hover .projectItemRight img::after {
    content: "❌";
    opacity: 1;
}

/* 智能favicon特殊样式 - 更新优先级显示 */
.projectItem[data-favicon-smart="true"] .projectItemRight img[data-favicon-source="auto"]::after {
    content: "🤖";
    background: rgba(0, 200, 0, 0.8); /* 绿色背景表示优先级最高 */
}

.projectItem[data-favicon-smart="true"] .projectItemRight img[data-favicon-source="original"]::after {
    content: "🖼️";
    background: rgba(255, 165, 0, 0.8); /* 橙色背景表示次优先级 */
}

.projectItem[data-favicon-smart="true"] .projectItemRight img[data-favicon-source="fallback"]::after {
    content: "🔄";
    background: rgba(100, 100, 100, 0.8); /* 灰色背景表示备用 */
}

.projectItem[data-favicon-smart="true"] .projectItemRight img[data-favicon-source="default"]::after {
    content: "❌";
    background: rgba(220, 20, 60, 0.8); /* 红色背景表示失败 */
}

/* 右键菜单样式（如果需要） */
.favicon-context-menu {
    position: fixed;
    background: var(--item_bg_color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 120px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
}

.favicon-context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--item_left_title_color);
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.favicon-context-menu-item:hover {
    background-color: var(--item_hover_color);
}

/* 加载动画 */
@keyframes faviconRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.projectItemRight img[data-favicon-loading="true"] {
    animation: faviconRotate 1s linear infinite;
}

/* 成功加载动画 */
@keyframes faviconSuccess {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.projectItemRight img[data-favicon-loaded="true"] {
    animation: faviconSuccess 0.5s ease-out;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .projectList[data-auto-favicon="true"]::before {
        font-size: 10px;
        top: -25px;
    }
    
    .projectItem[data-favicon-auto="true"]:hover .projectItemRight img::after {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }
}

/* 深色模式适配 */
[data-theme="Dark"] .favicon-context-menu {
    background: rgba(35, 39, 48, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="Dark"] .projectList[data-auto-favicon="true"]::before {
    color: #aaa;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .projectItemRight img[data-favicon-loaded="error"] {
        filter: contrast(1.5);
        border: 1px solid #ff6b6b;
    }
}