/* ===== Base Styles ===== */
.encens-pkg-elementor-widget,
.encens-pkg-search-widget {
    --epkg-primary: #2271b1;
    --epkg-primary-hover: #135e96;
    --epkg-border: #ddd;
    --epkg-bg: #fff;
    --epkg-text: #333;
    --epkg-shadow: rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

/* ===== Search Bar ===== */
.epkg-search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.epkg-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    gap: 8px;
}

.epkg-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--epkg-border);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.epkg-search-input:focus {
    outline: none;
    border-color: var(--epkg-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.epkg-search-button {
    padding: 12px 20px;
    background: var(--epkg-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.epkg-search-button:hover {
    background: var(--epkg-primary-hover);
}

.epkg-search-button:active {
    transform: scale(0.98);
}

/* ===== Suggestions Dropdown ===== */
.epkg-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--epkg-border);
    border-radius: 4px;
    box-shadow: 0 4px 12px var(--epkg-shadow);
    margin-top: 4px;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.epkg-suggestions-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
}

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

.epkg-suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.epkg-suggestion-item:hover,
.epkg-suggestion-item.epkg-suggestion-active {
    background: #f5f5f5;
}

.epkg-suggestion-icon {
    font-size: 18px;
}

.epkg-suggestion-text {
    font-size: 14px;
    color: var(--epkg-text);
}

/* ===== Loading State ===== */
.epkg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #666;
}

.epkg-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top-color: var(--epkg-primary);
    border-radius: 50%;
    animation: epkg-spin 0.8s linear infinite;
}

@keyframes epkg-spin {
    to { transform: rotate(360deg); }
}

/* ===== Products Grid ===== */
.epkg-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .epkg-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* ===== Product Card ===== */
.epkg-product-card {
    border: 1px solid var(--epkg-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}

.epkg-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--epkg-shadow);
}

.epkg-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.epkg-product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.epkg-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.epkg-match-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.epkg-product-info {
    padding: 16px;
}

.epkg-product-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--epkg-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.epkg-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--epkg-primary);
    margin-bottom: 8px;
}

.epkg-product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.epkg-match-score {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ===== No Results ===== */
.epkg-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.epkg-no-results svg {
    color: #ccc;
    margin-bottom: 16px;
}

.epkg-no-results h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
}

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

/* ===== Error Message ===== */
.epkg-error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #d63638;
    background: #fdd;
    border-radius: 8px;
    margin: 20px 0;
}

/* ===== Screen Reader ===== */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .epkg-search-bar {
        flex-direction: column;
    }

    .epkg-search-button {
        width: 100%;
    }

    .epkg-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}