/**
 * ChefMaker AI - 菜谱链接样式
 * 为菜谱链接和相关UI组件提供美观的样式
 */

/* 菜谱链接容器 */
.recipe-link-container {
    display: inline;
    margin: 0;
    position: relative;
    vertical-align: baseline;
    line-height: inherit;
}

/* 菜谱链接主体样式 - 改为悬浮提示样式 */
.recipe-hint {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(173, 216, 230, 0.25); /* 浅蓝色底色 */
    color: #2c5282;
    text-decoration: none;
    border-radius: 10px;
    font-size: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid rgba(173, 216, 230, 0.4);
    max-width: none;
    position: relative;
    vertical-align: baseline;
    line-height: 1.2;
    margin: 0 1px;
}

.recipe-hint:hover {
    background: rgba(173, 216, 230, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(173, 216, 230, 0.4);
    text-decoration: none;
    color: #2c5282;
}

.recipe-hint:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(173, 216, 230, 0.3);
}

/* 菜谱名称 */
.recipe-hint-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    margin-right: 3px;
    line-height: 1.2;
}

/* 搜索图标和提示 */
.recipe-search-icon {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 10px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.recipe-search-icon .icon {
    font-size: 10px;
}

.recipe-hint:hover .recipe-search-icon {
    opacity: 1;
}

/* 直接链接样式 */
.recipe-direct-link {
    text-decoration: none !important;
}

.recipe-direct-link:hover {
    text-decoration: none !important;
}

/* 菜谱下拉列表 */
.recipe-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 350px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.recipe-dropdown.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.recipe-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s ease;
}

.recipe-dropdown-item:last-child {
    border-bottom: none;
}

.recipe-dropdown-item:hover {
    background: #f8fafc;
}

/* 下拉菜单链接样式 */
.recipe-dropdown-link {
    text-decoration: none !important;
    color: inherit !important;
}

.recipe-dropdown-link:hover {
    text-decoration: none !important;
    color: inherit !important;
}

.recipe-dropdown-item .recipe-item-name {
    flex: 1;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.recipe-dropdown-item .recipe-item-device {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.recipe-dropdown-header {
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-dropdown-empty {
    padding: 16px 12px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}

/* 未找到的菜谱样式 */
.recipe-not-found {
    display: inline;
    padding: 2px 6px;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px dashed #dee2e6;
    border-radius: 10px;
    font-size: inherit;
    font-style: italic;
    margin: 0 1px;
    vertical-align: baseline;
    line-height: 1.2;
}

/* 流式输出占位符样式 */
.recipe-streaming-placeholder {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(220, 220, 220, 0.3);
    color: #666;
    border: 1px solid rgba(220, 220, 220, 0.5);
    border-radius: 10px;
    font-size: inherit;
    margin: 0 1px;
    animation: placeholderPulse 1.5s ease-in-out infinite;
    vertical-align: baseline;
    line-height: 1.2;
}

.recipe-loading-icon {
    margin-right: 4px;
    animation: spin 1s linear infinite;
}

.recipe-loading-text {
    margin-right: 4px;
}

.recipe-loading-dots {
    display: inline-flex;
    gap: 1px;
}

.recipe-loading-dots .dot {
    animation: dotBlink 1.4s ease-in-out infinite;
    opacity: 0.4;
}

.recipe-loading-dots .dot1 {
    animation-delay: 0s;
}

.recipe-loading-dots .dot2 {
    animation-delay: 0.2s;
}

.recipe-loading-dots .dot3 {
    animation-delay: 0.4s;
}

/* 动画效果 */
@keyframes placeholderPulse {
    0%, 100% { 
        background: rgba(220, 220, 220, 0.3);
        border-color: rgba(220, 220, 220, 0.5);
    }
    50% { 
        background: rgba(220, 220, 220, 0.5);
        border-color: rgba(220, 220, 220, 0.7);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dotBlink {
    0%, 20% { opacity: 0.4; }
    50% { opacity: 1; }
    80%, 100% { opacity: 0.4; }
}

/* Toast 提示样式 */
.recipe-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
    min-width: 250px;
}

.recipe-toast.recipe-toast-show {
    transform: translateX(0);
    opacity: 1;
}

.recipe-toast-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
}

.recipe-toast-icon {
    font-size: 18px;
    margin-right: 10px;
}

.recipe-toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

/* 不同类型的Toast样式 */
.recipe-toast-success .recipe-toast-content {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.recipe-toast-error .recipe-toast-content {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

.recipe-toast-info .recipe-toast-content {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.recipe-toast-warning .recipe-toast-content {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

/* 菜谱搜索弹窗样式 */
.recipe-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.recipe-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.recipe-modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s ease;
}

.recipe-modal-overlay.show .recipe-modal {
    transform: translateY(0) scale(1);
}

.recipe-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.recipe-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.recipe-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.recipe-modal-close:hover {
    background: #e2e8f0;
    color: #334155;
}

.recipe-modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: calc(80vh - 100px);
}

.recipe-modal-list {
    padding: 0;
}

.recipe-modal-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    min-height: 60px;
}

.recipe-modal-item:last-child {
    border-bottom: none;
}

.recipe-modal-item:hover {
    background: #f8fafc;
}

.recipe-modal-link {
    text-decoration: none !important;
    color: inherit !important;
}

.recipe-item-main {
    flex: 1;
    min-width: 0;
}

.recipe-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.recipe-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.recipe-item-tag {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.recipe-tag-official {
    background: #dcfce7;
    color: #166534;
}

.recipe-tag-selected,
.recipe-tag-custom {
    background: #dbeafe;
    color: #1d4ed8;
}

.recipe-item-device {
    font-size: 10px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 5px;
    font-weight: 500;
}

.recipe-item-action {
    margin-left: 16px;
    color: #94a3b8;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.recipe-modal-item:hover .recipe-item-action {
    color: #64748b;
    transform: translateX(2px);
}

/* 空状态样式 */
.recipe-empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.empty-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    max-width: 300px;
    margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .recipe-link {
        font-size: 13px;
        padding: 5px 10px;
        max-width: 220px;
    }
    
    .recipe-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
    }
    
    .recipe-toast-content {
        padding: 10px 12px;
    }
    
    .recipe-toast-message {
        font-size: 13px;
    }
    
    .recipe-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .recipe-modal-header {
        padding: 16px 20px 12px;
    }
    
    .recipe-modal-title {
        font-size: 16px;
    }
    
    .recipe-modal-item {
        padding: 10px 20px;
        min-height: 55px;
    }
    
    .recipe-item-title {
        font-size: 14px;
    }
    
    .recipe-item-meta {
        gap: 8px;
    }
    
    .recipe-item-action {
        margin-left: 12px;
    }
    
    .recipe-empty-state {
        padding: 32px 20px;
    }
    
    .empty-icon {
        font-size: 36px;
    }
    
    .empty-title {
        font-size: 16px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .recipe-link {
        background: linear-gradient(135deg, #e74c3c, #c0392b);
        box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    }
    
    .recipe-link:hover {
        background: linear-gradient(135deg, #c0392b, #e74c3c);
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    }
    
    .recipe-not-found {
        background: #2c2c2c;
        color: #adb5bd;
        border-color: #495057;
    }
    
    .recipe-toast {
        background: #2c2c2c;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .recipe-toast-message {
        color: #e9ecef;
    }
    
    .recipe-toast-success .recipe-toast-content {
        background: #1e4d3a;
        border-left-color: #28a745;
    }
    
    .recipe-toast-error .recipe-toast-content {
        background: #4d1e1e;
        border-left-color: #dc3545;
    }
    
    .recipe-toast-info .recipe-toast-content {
        background: #1e3d4d;
        border-left-color: #17a2b8;
    }
    
    .recipe-toast-warning .recipe-toast-content {
        background: #4d3d1e;
        border-left-color: #ffc107;
    }
}

/* 动画效果 */
@keyframes recipeGlow {
    0% { box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(255, 107, 107, 0.5); }
    100% { box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3); }
}

.recipe-link.loading {
    animation: recipeGlow 1.5s ease-in-out infinite;
}

/* 特殊状态样式 */
.recipe-link:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.recipe-link.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 批量菜谱容器 */
.recipe-links-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.recipe-links-group .recipe-link-container {
    margin: 0;
}

/* 菜谱统计信息 */
.recipe-stats {
    display: inline-block;
    font-size: 12px;
    color: #6c757d;
    margin-left: 8px;
    padding: 2px 6px;
    background: #f8f9fa;
    border-radius: 10px;
}

/* 高亮动画 */
@keyframes highlightRecipe {
    0% { background-color: transparent; }
    50% { background-color: rgba(255, 107, 107, 0.1); }
    100% { background-color: transparent; }
}

.recipe-highlight {
    animation: highlightRecipe 2s ease-in-out;
    border-radius: 4px;
    padding: 2px;
}
