/**
 * 🏪 Compare Prices Styles
 * ========================
 * 
 * Priskjakt/PriceRunner style price comparison section.
 * Shows same product across different stores.
 */

/* Main container */
.compare-prices-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 20px;
    margin: 0;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.compare-prices-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dee2e6;
    flex-shrink: 0;
}

.compare-prices-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

.compare-prices-title i {
    color: #007bff;
    font-size: 20px;
}

.compare-prices-badge {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Store list */
.store-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
}

/* Individual store card */
.store-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.store-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.store-card.current-store {
    border-color: #27ae60;
    background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%);
}

.store-card.best-price {
    border-color: #ff6b6b;
}

.store-card.best-price::before {
    content: '🏆 Best Price!';
    position: absolute;
    top: -10px;
    right: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

/* Store logo */
.store-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 6px;
    background: white;
    border: 1px solid #eee;
}

.store-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.store-logo-text {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

/* Store info */
.store-info {
    flex: 1;
    min-width: 0;
}

.store-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.store-name .source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    color: white;
}

.store-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}

.store-rating .stars {
    color: #ffc107;
}

/* Store price */
.store-price {
    text-align: right;
    min-width: 80px;
}

.store-price .current-price {
    font-size: 18px;
    font-weight: 800;
    color: #e74c3c;
}

.store-price .original-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.store-price .discount-badge {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 3px;
}

/* Buy button */
.store-buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.store-buy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.store-buy-btn i {
    font-size: 10px;
}

/* Savings banner */
.savings-banner {
    margin-top: 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border-radius: 8px;
    border: 1px solid #ffc107;
    display: flex;
    align-items: center;
    gap: 8px;
}

.savings-banner i {
    color: #856404;
    font-size: 16px;
}

.savings-banner .savings-text {
    font-size: 13px;
    color: #856404;
    font-weight: 500;
}

.savings-banner .savings-amount {
    font-weight: 800;
    color: #27ae60;
}

/* No alternatives message */
.no-alternatives {
    text-align: center;
    padding: 30px;
    color: #666;
}

.no-alternatives i {
    font-size: 40px;
    color: #ddd;
    margin-bottom: 10px;
}

.no-alternatives p {
    margin: 0;
    font-size: 14px;
}

/* Loading state */
.compare-prices-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: #666;
}

.compare-prices-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .compare-prices-section {
        padding: 16px;
        margin-top: 15px;
    }
    
    .store-card {
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .store-logo {
        width: 40px;
        height: 40px;
    }
    
    .store-info {
        flex: 1;
        min-width: 60%;
    }
    
    .store-price {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eee;
    }
    
    .store-price .current-price {
        font-size: 20px;
    }
    
    .store-buy-btn {
        padding: 8px 16px;
    }
    
    .compare-prices-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Two-column layout with price history */
.price-comparison-row {
    display: grid;
    grid-template-columns: 3fr 2fr; /* 60% price history, 40% compare prices */
    gap: 25px;
    margin: 40px 0;
    align-items: stretch; /* Equal height columns */
    width: 100%;
}

.price-comparison-row > * {
    min-width: 0;
    height: 100%; /* Ensure both children fill the row height */
    display: flex;
    flex-direction: column;
}

/* Ensure both sections have consistent height */
.price-comparison-row .price-history-section,
.price-comparison-row .compare-prices-section {
    flex: 1;
    height: auto;
    min-height: 380px;
    max-height: 500px;
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .price-comparison-row {
        grid-template-columns: 1fr 1fr; /* Equal on smaller screens */
    }
}

@media (max-width: 900px) {
    .price-comparison-row {
        grid-template-columns: 1fr;
    }
    
    .price-comparison-row .price-history-section,
    .price-comparison-row .compare-prices-section {
        max-height: none;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .price-comparison-row {
        gap: 15px;
        margin: 20px 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .compare-prices-section {
        background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
        border-color: #3d3d5c;
    }
    
    .compare-prices-title {
        color: #e0e0e0;
    }
    
    .store-card {
        background: #2d2d44;
    }
    
    .store-name {
        color: #e0e0e0;
    }
    
    .store-rating {
        color: #aaa;
    }
}
