/**
 * Product Compare 组件样式
 * 文件名：product-compare.css
 * 功能：纯定义样式 - 产品对比视觉样式
 */

/* 主容器样式 */
.product-compare {
    padding: 2rem 0 4rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
}

.product-compare__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 标题区域 */
.product-compare__header {
    text-align: center;
    margin-bottom: 3rem;
}

.product-compare__title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.product-compare__subtitle {
    font-size: 1.25rem;
    color: #cbd5e1;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 产品选择器 */
.product-compare__selector {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 1.5rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
    padding: 2rem;
    margin-bottom: 2rem;
}

.product-compare__search {
    position: relative;
    margin-bottom: 1.5rem;
}

.product-compare__search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #334155;
    border-radius: 1rem;
    color: #f1f5f9;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.product-compare__search-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.product-compare__search-input::placeholder {
    color: #64748b;
}

.product-compare__search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.product-compare__search-result {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-compare__search-result:hover {
    background: #334155;
}

.product-compare__search-result:last-child {
    border-bottom: none;
}

.product-compare__result-image {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    object-fit: cover;
}

.product-compare__result-info {
    flex: 1;
}

.product-compare__result-name {
    color: #f1f5f9;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.product-compare__result-brand {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* 已选产品区域 */
.product-compare__selected {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    min-height: 120px;
}

.product-compare__empty-selection {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #64748b;
    border: 2px dashed #475569;
    border-radius: 1rem;
}

.product-compare__empty-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.product-compare__selected-product {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid #334155;
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.product-compare__selected-product:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);
}

.product-compare__remove-product {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.product-compare__product-image {
    width: 60px;
    height: 60px;
    border-radius: 0.75rem;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 2px solid #475569;
}

.product-compare__product-name {
    color: #f1f5f9;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.product-compare__product-brand {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* 对比表格 */
.product-compare__table-container {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 1.5rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
    padding: 2rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.product-compare__table {
    min-width: 800px;
}

.product-compare__table-row {
    display: grid;
    grid-template-columns: 200px repeat(auto-fit, minmax(180px, 1fr));
    border-bottom: 1px solid #334155;
    transition: background 0.2s ease;
}

.product-compare__table-row:hover {
    background: rgba(51, 65, 85, 0.3);
}

.product-compare__table-row:last-child {
    border-bottom: none;
}

.product-compare__table-header {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 700;
    color: #f1f5f9;
    position: sticky;
    left: 0;
    z-index: 10;
}

.product-compare__table-cell {
    padding: 1rem;
    display: flex;
    align-items: center;
    min-height: 60px;
}

.product-compare__param-name {
    color: #cbd5e1;
    font-weight: 600;
}

.product-compare__param-value {
    color: #f1f5f9;
    text-align: center;
    flex: 1;
}

.product-compare__value-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.product-compare__value-best {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.product-compare__value-good {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    border: 1px solid #60a5fa;
}

.product-compare__value-normal {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid #64748b;
}

/* 对比总结 */
.product-compare__summary {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 1.5rem;
    border: 1px solid rgba(100, 116, 139, 0.2);
    padding: 2rem;
}

.product-compare__summary-title {
    color: #f1f5f9;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.product-compare__recommendations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.product-compare__recommendation {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 1rem;
    padding: 1.5rem;
    border-left: 4px solid #60a5fa;
}

.product-compare__rec-type {
    color: #60a5fa;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.product-compare__rec-product {
    color: #f1f5f9;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product-compare__rec-reason {
    color: #cbd5e1;
    line-height: 1.5;
}

/* 加载状态 */
.product-compare__loading {
    text-align: center;
    padding: 3rem;
    color: #cbd5e1;
}

.product-compare__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #334155;
    border-top: 3px solid #60a5fa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-compare__container {
        padding: 0 1rem;
    }
    
    .product-compare__title {
        font-size: 2rem;
    }
    
    .product-compare__subtitle {
        font-size: 1.125rem;
    }
    
    .product-compare__selector {
        padding: 1.5rem;
    }
    
    .product-compare__selected {
        grid-template-columns: 1fr;
    }
    
    .product-compare__table-container {
        padding: 1rem;
    }
    
    .product-compare__table-row {
        grid-template-columns: 150px repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .product-compare__table-cell {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .product-compare__recommendations {
        grid-template-columns: 1fr;
    }
    
    .product-compare__selected-product {
        padding: 1rem;
    }
}