* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    padding: 40px 20px;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 25px;
    transition: background 0.3s;
}

.back-link:hover {
    background: rgba(255,255,255,0.3);
}

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    margin-bottom: 40px;
}

/* Cities Grid */
.cities-section h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #667eea;
}

.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.city-card {
    display: block;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.city-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.city-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.store-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Filters Section */
.filters-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.store-select,
.search-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.store-select:focus,
.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-info {
    padding: 15px;
    background: white;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

/* Products Grid */
.products-section {
    margin-top: 30px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.product-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 250px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.no-image {
    color: #999;
    font-size: 1rem;
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
    min-height: 50px;
}

.product-brand {
    font-size: 0.9rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 500;
}

.product-prices {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #27ae60;
}

.regular-price {
    font-size: 1.2rem;
    color: #999;
    text-decoration: line-through;
}

.price-discount {
    background: #e74c3c;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.product-savings {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.max-price-info {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.discount-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1rem;
}

.discount-badge.high {
    background: #27ae60;
    color: white;
}

.discount-badge.medium {
    background: #f39c12;
    color: white;
}

.discount-badge.low {
    background: #3498db;
    color: white;
}

.product-store {
    margin-top: auto;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
}

.store-name {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.store-address {
    font-size: 0.9rem;
    color: #666;
}

.product-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    text-align: center;
    transition: background 0.3s;
}

.product-link:hover {
    background: #764ba2;
}

/* Status Messages */
.loading,
.no-results,
.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 1.2rem;
    color: #666;
}

.error {
    color: #e74c3c;
}

.info-section {
    text-align: center;
    padding: 40px;
}

.info-box {
    background: #f8f9fa;
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.info-box h3 {
    color: #667eea;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.info-box p {
    margin-bottom: 15px;
    color: #666;
}

.info-box code {
    display: block;
    background: #333;
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
}

/* Top Deals Section */
.top-deals-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid rgba(255,255,255,0.2);
}

.top-deals-section h2 {
    color: #000;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.top-deals-section .subtitle {
    text-align: center;
    margin-bottom: 30px;
}

.top-deals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.deal-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.deal-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.deal-image {
    position: relative;
    height: 220px;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.deal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.deal-discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e74c3c;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 8px 15px;
    border-radius: 25px;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

.deal-discount-badge.high {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: pulse 2s infinite;
}

.deal-discount-badge.medium {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.deal-discount-badge.low {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
    }
    50% {
        box-shadow: 0 3px 20px rgba(231, 76, 60, 0.8);
    }
}

.deal-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.deal-title {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.4;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deal-brand {
    font-size: 0.9rem;
    color: #95a5a6;
    margin-bottom: 12px;
    font-weight: 500;
}

.deal-prices {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.deal-current-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #27ae60;
}

.deal-old-price {
    font-size: 1rem;
    color: #95a5a6;
    text-decoration: line-through;
}

.deal-savings {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: inline-block;
    align-self: flex-start;
}

.savings-label {
    font-weight: 500;
}

.savings-amount {
    font-weight: bold;
    margin-left: 5px;
}

.deal-location {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.city-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 5px;
    transition: color 0.3s ease;
}

.city-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.deal-address {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 12px;
    line-height: 1.3;
}

.deal-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-align: center;
    margin-top: 10px;
}

.deal-link:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
}

/* Product & Deal Stores Section */
.product-stores-section,
.deal-stores-section {
    margin-top: 15px;
    padding: 12px;
    background: rgba(52, 152, 219, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(52, 152, 219, 0.1);
}

.stores-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.2);
}

.stores-count {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.stores-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 132px;
	overflow-y: scroll;
	height: 132px;
	overflow-x: hidden;
}

.store-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.store-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

.store-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #27ae60;
    min-width: 90px;
    flex-shrink: 0;
}

.store-details {
    flex: 1;
    min-width: 0;
}

.store-city {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.store-city a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s ease;
}

.store-city a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.store-addr {
    font-size: 0.8rem;
    color: #7f8c8d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stores-more {
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
    color: #3498db;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stores-more:hover {
    color: #2980b9;
    background: rgba(52, 152, 219, 0.05);
    border-radius: 4px;
}

.price-label,
.deal-price-label {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-bottom: 2px;
}

.store-details > * {
	line-height: 1.2em;
}
/* Footer */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .cities-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .top-deals-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .top-deals-section h2 {
        font-size: 2rem;
    }
    
    .deal-image {
        height: 180px;
    }
    
    .deal-current-price {
        font-size: 1.5rem;
    }
    
    main {
        padding: 20px;
    }
    
    .current-price {
        font-size: 1.5rem;
    }
}

