/* BeersnCode Amazon Search Widget Styles */

.beersncode-amazon-widget {
    padding: 20px 0;
}

.beersncode-search-container {
    margin-bottom: 20px;
}

.beersncode-search-wrapper {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.beersncode-search-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.beersncode-search-input:focus {
    outline: none;
    border-color: #ff9900;
}

.beersncode-search-btn {
    padding: 12px 30px;
    background-color: #ff9900;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.beersncode-search-btn:hover:not(:disabled) {
    background-color: #ec7211;
}

.beersncode-search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 80px; /* Account for button width */
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.search-suggestions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-suggestions li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-suggestions li:hover {
    background-color: #f8f8f8;
}

.search-suggestions li:last-child {
    border-bottom: none;
}

/* Search Results Styles */
.beersncode-search-results {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.search-results-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.search-term {
    color: #ff9900;
    font-weight: bold;
}

.view-all-amazon {
    color: #ff9900;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.view-all-amazon:hover {
    color: #ec7211;
    text-decoration: underline;
}

.search-results-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-result-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s;
    display: flex;
    gap: 15px;
}

.search-result-item:hover {
    background: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.result-image {
    flex-shrink: 0;
}

.result-image img {
    max-width: 100px;
    height: auto;
    border-radius: 4px;
    transition: transform 0.3s;
}

.result-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.result-title {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.result-title a {
    color: #0066c0;
    text-decoration: none;
    transition: color 0.3s;
}

.result-title a:hover {
    color: #ff9900;
    text-decoration: underline;
}

.result-category {
    color: #565959;
    font-size: 14px;
    margin-bottom: 10px;
}

.result-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 15px 0;
    flex: 1;
}

.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.result-price {
    font-size: 20px;
    font-weight: bold;
    color: #B12704;
}

.result-button {
    padding: 8px 20px;
    background-color: #ff9900;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.result-button:hover {
    background-color: #ec7211;
}

/* No results message & Amazon redirect */
.no-results-message,
.amazon-redirect-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f8f8;
    border-radius: 6px;
}

.amazon-redirect-message {
    background: linear-gradient(135deg, #fff3e0, #ffecb3);
    border: 2px solid #ff9900;
}

.no-results-message h4,
.amazon-redirect-message h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 22px;
}

.no-results-message p,
.amazon-redirect-message p {
    margin: 10px 0;
    color: #666;
}

.amazon-redirect-message .result-button {
    background-color: #ff9900;
    color: white;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.amazon-redirect-message .result-button:hover {
    background-color: #ec7211;
    transform: scale(1.05);
}

.direct-amazon-link {
    color: #ff9900;
    text-decoration: none;
    font-weight: bold;
}

.direct-amazon-link:hover {
    text-decoration: underline;
}

/* Suggested products message */
.suggested-products-message {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 6px;
    border: 2px solid #2196f3;
    margin-bottom: 20px;
}

.suggested-products-message h4 {
    margin: 0 0 10px 0;
    color: #1976d2;
    font-size: 18px;
}

.suggestion-note {
    color: #1976d2;
    font-style: italic;
    margin: 5px 0 0 0;
}

/* Suggested product items */
.suggested-product {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7) !important;
    border: 2px solid #9c27b0 !important;
}

.suggested-product:hover {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9) !important;
    border-color: #4caf50 !important;
}

.suggested-button {
    background-color: #9c27b0 !important;
    border-color: #9c27b0 !important;
}

.suggested-button:hover {
    background-color: #7b1fa2 !important;
    border-color: #7b1fa2 !important;
}

.result-note {
    font-size: 12px;
    color: #9c27b0;
    font-weight: bold;
    font-style: italic;
}

.amazon-search-fallback {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: #fff3e0;
    border-radius: 6px;
    border: 1px solid #ffcc02;
}

/* Popular Products Section */
.beersncode-popular-products {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #fff3e0, #ffecb3);
    border-radius: 8px;
    border: 2px solid #ff9900;
}

.popular-title {
    margin: 0 0 15px 0;
    text-align: center;
    color: #ff6600;
    font-size: 18px;
    font-weight: bold;
}

.popular-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.popular-product-item {
    background: white;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 153, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.popular-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(255, 153, 0, 0.3);
}

.popular-product-image {
    margin-bottom: 8px;
}

.popular-product-image img {
    max-width: 60px;
    height: auto;
    border-radius: 4px;
}

.popular-product-details h4 {
    margin: 0 0 5px 0;
    font-size: 12px;
    line-height: 1.3;
}

.popular-product-details h4 a {
    color: #333;
    text-decoration: none;
}

.popular-product-details h4 a:hover {
    color: #ff9900;
}

.popular-product-price {
    font-weight: bold;
    color: #B12704;
    font-size: 14px;
    margin-bottom: 3px;
}

.popular-product-clicks {
    font-size: 10px;
    color: #666;
    font-style: italic;
}

/* Quick Categories */
.beersncode-quick-categories {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 4px;
}

.quick-category-label {
    font-weight: bold;
    margin-right: 15px;
    color: #333;
}

.beersncode-category-link {
    display: inline-block;
    margin: 5px 10px;
    color: #ff9900;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.beersncode-category-link:hover {
    color: #ec7211;
    text-decoration: underline;
}

.beersncode-top-picks {
    margin-top: 40px;
}

.beersncode-section-title {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

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

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

.beersncode-product-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.product-image {
    text-align: center;
    margin-bottom: 15px;
}

.product-image img {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    transition: transform 0.3s;
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 18px;
    margin-bottom: 10px;
    line-height: 1.3;
}

.product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.product-title a:hover {
    color: #ff9900;
}

.product-category {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.product-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #B12704;
}

.beersncode-buy-btn {
    padding: 8px 20px;
    background-color: #ff9900;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.beersncode-buy-btn:hover {
    background-color: #ec7211;
}

.beersncode-disclosure {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 12px;
}

/* Loading states */
.beersncode-search-btn.loading {
    position: relative;
    color: transparent;
}

.beersncode-search-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .beersncode-search-wrapper {
        flex-direction: column;
    }
    
    .beersncode-search-btn {
        width: 100%;
    }
    
    .search-suggestions {
        right: 0;
    }
    
    .search-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-result-item {
        flex-direction: column;
        text-align: center;
    }
    
    .result-image {
        align-self: center;
    }
    
    .result-footer {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .beersncode-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .beersncode-quick-categories {
        padding: 10px;
    }
    
    .quick-category-label {
        display: block;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .beersncode-products-grid {
        grid-template-columns: 1fr;
    }
    
    .search-result-item {
        padding: 10px;
    }
    
    .result-image img {
        max-width: 80px;
    }
}

/* Featured product highlighting */
.beersncode-product-card.featured {
    border: 2px solid #ff9900;
    position: relative;
}

.beersncode-product-card.featured::before {
    content: "Featured";
    position: absolute;
    top: -1px;
    right: -1px;
    background: #ff9900;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 0 6px 0 4px;
}

/* Click tracking indicators */
.click-tracked {
    opacity: 0.8;
    transition: opacity 0.3s;
}

/* Amazon link styling */
a[href*="amazon.com"] {
    position: relative;
}

a[href*="amazon.com"]:after {
    content: "🔗";
    font-size: 10px;
    margin-left: 3px;
    opacity: 0.7;
}