/* AI智能推荐系统样式 */

/* 推荐区块基础样式 */
.ai-recommendations-section {
    margin: 3rem 0;
    padding: 0 15px;
}

.ai-recommendations-section .section-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    color: #333;
    position: relative;
}

.ai-recommendations-section .section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    border-radius: 2px;
}

/* 推荐网格布局 */
.ai-recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    transition: transform 0.3s ease;
    will-change: transform;
}

/* 推荐卡片样式 */
.ai-recommendation-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    will-change: transform, box-shadow;
}

.ai-recommendation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.ai-recommendation-card .product-image {
    position: relative;
    padding-top: 100%; /* 1:1 宽高比 */
    overflow: hidden;
}

.ai-recommendation-card .product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ai-recommendation-card:hover .product-image img {
    transform: scale(1.05);
}

.ai-recommendation-card .product-content {
    padding: 16px;
}

.ai-recommendation-card .product-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.4;
    color: #333;
    min-height: 48px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-recommendation-card .product-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 12px;
}

.ai-recommendation-card .product-rating {
    margin-bottom: 12px;
}

.ai-recommendation-card .product-rating .star {
    color: #FFD700;
    font-size: 14px;
}

.ai-recommendation-card .product-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ai-recommendation-card .add-to-cart-btn {
    flex: 1;
    padding: 8px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ai-recommendation-card .add-to-cart-btn:hover {
    background-color: #45a049;
}

.ai-recommendation-card .quick-view-btn {
    padding: 8px 12px;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-recommendation-card .quick-view-btn:hover {
    background-color: #e0e0e0;
}

/* AI推荐标签 */
.ai-recommendation-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #9C27B0, #673AB7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

/* 加载状态 */
.ai-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    font-size: 1.125rem;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.ai-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading-animated 1.5s infinite;
}

@keyframes loading-animated {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 错误状态 */
.ai-error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.125rem;
    color: #e74c3c;
    background-color: #fdf2f2;
    border-radius: 12px;
    border: 1px solid #f5c6cb;
}

/* 轮播样式 */
.ai-recommendations-carousel {
    position: relative;
    overflow: hidden;
    padding: 0 40px;
}

.ai-recommendations-carousel .ai-recommendations-grid {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 10px;
}

.ai-recommendations-carousel .ai-recommendations-grid::-webkit-scrollbar {
    display: none;
}

.ai-recommendations-carousel .ai-recommendation-card {
    flex: 0 0 auto;
    width: 240px;
}

/* 轮播控制按钮 */
.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.carousel-prev {
    left: 0;
}

.carousel-next {
    right: 0;
}

.carousel-prev:hover:not(.disabled), .carousel-next:hover:not(.disabled) {
    background-color: #f5f5f5;
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev.disabled, .carousel-next.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 响应式轮播调整 */
@media (max-width: 768px) {
    .ai-recommendations-carousel {
        padding: 0 30px;
    }
    
    .carousel-prev, .carousel-next {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .ai-recommendations-carousel .ai-recommendation-card {
        width: 200px;
    }
}

/* AI推荐通知 */
.ai-recommendation-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 0;
    max-width: 400px;
    width: 90%;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
}

.ai-recommendation-notification.show {
    bottom: 30px;
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.notification-icon {
    font-size: 20px;
}

.notification-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.notification-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.notification-view {
    background-color: white;
    color: #4CAF50;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.notification-view:hover {
    background-color: #f5f5f5;
    transform: translateY(-1px);
}

/* AI偏好设置面板 */
.ai-preference-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #9C27B0, #673AB7);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 9999;
}

.ai-preference-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.6);
}

.ai-preference-panel {
    position: fixed;
    bottom: -500px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9998;
}

.ai-preference-panel.show {
    bottom: 0;
}

.ai-preference-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-preference-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.ai-preference-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
}

.ai-preference-content {
    padding: 20px;
}

.ai-preference-section {
    margin-bottom: 24px;
}

.ai-preference-section h4 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #555;
}

.ai-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ai-category-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-category-checkbox {
    cursor: pointer;
}

.ai-price-range {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-price-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.ai-price-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.ai-update-frequency {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.ai-preference-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.ai-preference-save {
    flex: 1;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ai-preference-save:hover {
    background-color: #45a049;
}

.ai-preference-reset {
    padding: 12px 20px;
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-preference-reset:hover {
    background-color: #e0e0e0;
}

/* 偏好保存成功提示 */
.ai-preference-success {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10001;
}

.ai-preference-success.show {
    top: 30px;
    opacity: 1;
}

/* 智能分析仪表盘样式 */
.ai-analytics-dashboard {
    background-color: #f9f9f9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.ai-analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.ai-analytics-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.ai-analytics-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-analytics-date-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-analytics-date {n    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.export-analytics-data {
    padding: 8px 16px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.export-analytics-data:hover {
    background-color: #1976D2;
}

.ai-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ai-analytics-card {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-analytics-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.ai-analytics-card .analytics-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.ai-analytics-card .analytics-change {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.analytics-change.positive {
    color: #4CAF50;
}

.analytics-change.negative {
    color: #e74c3c;
}

.ai-analytics-chart {
    background-color: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
}

.ai-analytics-chart h3 {
    margin: 0 0 20px;
    font-size: 1.25rem;
    color: #333;
}

.chart-container {
    height: 300px;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .ai-recommendations-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .ai-recommendations-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .ai-recommendations-section .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .ai-recommendations-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }
    
    .ai-recommendation-card .product-content {
        padding: 12px;
    }
    
    .ai-recommendation-card .product-title {
        font-size: 0.875rem;
        min-height: 42px;
    }
    
    .ai-recommendation-card .product-price {
        font-size: 1rem;
    }
    
    .ai-recommendations-carousel .ai-recommendation-card {
        width: 180px;
    }
    
    .ai-analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .ai-recommendations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .ai-recommendations-section .section-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .ai-recommendation-card .product-actions {
        flex-direction: column;
    }
    
    .ai-analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .ai-analytics-filters {
        flex-direction: column;
        align-items: stretch;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ai-recommendations-section .section-title {
        color: #fff;
    }
    
    .ai-recommendation-card {
        background-color: #2d2d2d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .ai-recommendation-card .product-title {
        color: #e0e0e0;
    }
    
    .ai-recommendation-card .quick-view-btn {
        background-color: #3d3d3d;
        color: #e0e0e0;
        border-color: #4d4d4d;
    }
    
    .ai-recommendation-card .quick-view-btn:hover {
        background-color: #4d4d4d;
    }
    
    .ai-loading {
        background-color: #2d2d2d;
        color: #b0b0b0;
    }
    
    .ai-loading::before {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    }
    
    .ai-error {
        background-color: #442222;
        color: #f5c6cb;
        border-color: #663333;
    }
    
    .carousel-prev, .carousel-next {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    .carousel-prev:hover:not(.disabled), .carousel-next:hover:not(.disabled) {
        background-color: #3d3d3d;
    }
    
    .ai-preference-panel {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    .ai-preference-header {
        border-color: #4d4d4d;
    }
    
    .ai-preference-header h3 {
        color: #fff;
    }
    
    .ai-preference-close {
        color: #b0b0b0;
    }
    
    .ai-preference-section h4 {
        color: #b0b0b0;
    }
    
    .ai-price-input, .ai-update-frequency {
        background-color: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .ai-preference-actions {
        background-color: #333333;
        border-color: #4d4d4d;
    }
    
    .ai-preference-reset {
        background-color: #4d4d4d;
        color: #b0b0b0;
        border-color: #5d5d5d;
    }
    
    .ai-preference-reset:hover {
        background-color: #5d5d5d;
    }
    
    .ai-analytics-dashboard {
        background-color: #2d2d2d;
    }
    
    .ai-analytics-header h2 {
        color: #fff;
    }
    
    .ai-analytics-card {
        background-color: #3d3d3d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .ai-analytics-card h3 {
        color: #b0b0b0;
    }
    
    .ai-analytics-card .analytics-value {
        color: #fff;
    }
    
    .ai-analytics-date {
        background-color: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .ai-analytics-chart {
        background-color: #3d3d3d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .ai-analytics-chart h3 {
        color: #fff;
    }
}